Networking: When sending ICMPv6 advertisements and solicitations, set the NOARP bit so that we don't overwrite the destination MAC address

This commit is contained in:
Gregory Nutt
2015-01-20 15:59:52 -06:00
parent 5f4ddc48ca
commit cdff532bfa
6 changed files with 23 additions and 10 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* net/arp/arp_out.c * net/arp/arp_out.c
* *
* Copyright (C) 2007-2011, 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2011, 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Based on uIP which also has a BSD style license: * Based on uIP which also has a BSD style license:
@@ -144,11 +144,11 @@ void arp_out(FAR struct net_driver_s *dev)
* written into a packet socket. * written into a packet socket.
*/ */
if ((dev->d_flags & IFF_NOARP) != 0) if (IFF_IS_NOARP(dev->d_flags))
{ {
/* Clear the indication and let the packet continue on its way. */ /* Clear the indication and let the packet continue on its way. */
dev->d_flags &= ~IFF_NOARP; IFF_CLR_IPv6(dev->d_flags);
return; return;
} }
#endif #endif
+1 -1
View File
@@ -134,7 +134,7 @@ static uint16_t arp_send_interrupt(FAR struct net_driver_s *dev,
* flag will be cleared in arp_out(). * flag will be cleared in arp_out().
*/ */
dev->d_flags |= IFF_NOARP; IFF_SET_NOARP(dev->d_flags);
/* Don't allow any further call backs. */ /* Don't allow any further call backs. */
+4
View File
@@ -279,6 +279,10 @@ void icmpv6_input(FAR struct net_driver_s *dev)
goto typeerr; goto typeerr;
} }
/* No additional neighbor lookup is required on this packet. */
IFF_SET_NOARP(dev->d_flags);
nllvdbg("Outgoing ICMPv6 packet length: %d (%d)\n", nllvdbg("Outgoing ICMPv6 packet length: %d (%d)\n",
dev->d_len, (icmp->len[0] << 8) | icmp->len[1]); dev->d_len, (icmp->len[0] << 8) | icmp->len[1]);
+10
View File
@@ -180,6 +180,16 @@ void icmpv6_solicit(FAR struct net_driver_s *dev,
/* Move our source Ethernet addresses into the Ethernet header */ /* Move our source Ethernet addresses into the Ethernet header */
memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN);
#if 0
/* No additional neighbor lookup is required on this packet.
* REVISIT: It is inappropriate to set this bit if we get here
* via neighbor_out(); It is no necessary to set this bit if we
* get here via icmpv6_input(). Is it ever necessary?
*/
IFF_SET_NOARP(dev->d_flags);
#endif
} }
#endif #endif
+4 -5
View File
@@ -131,19 +131,18 @@ void neighbor_out(FAR struct net_driver_s *dev)
FAR struct ipv6_hdr_s *ip = IPv6BUF; FAR struct ipv6_hdr_s *ip = IPv6BUF;
net_ipv6addr_t ipaddr; net_ipv6addr_t ipaddr;
#if defined(CONFIG_NET_PKT) || defined(CONFIG_NET_NEIGHBOR_SEND)
/* Skip sending ARP requests when the frame to be transmitted was /* Skip sending ARP requests when the frame to be transmitted was
* written into a packet socket. * written into a packet socket or if we are sending certain Neighbor
* messages (soliciation, advertisement, echo request).
*/ */
if ((dev->d_flags & IFF_NOARP) != 0) if (IFF_IS_NOARP(dev->d_flags))
{ {
/* Clear the indication and let the packet continue on its way. */ /* Clear the indication and let the packet continue on its way. */
dev->d_flags &= ~IFF_NOARP; IFF_CLR_IPv6(dev->d_flags);
return; return;
} }
#endif
/* Find the destination IPv6 address in the ARP table and construct /* Find the destination IPv6 address in the ARP table and construct
* the Ethernet header. If the destination IPv6 address isn't on the * the Ethernet header. If the destination IPv6 address isn't on the
+1 -1
View File
@@ -132,7 +132,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
* flag will be cleared in arp_out(). * flag will be cleared in arp_out().
*/ */
dev->d_flags |= IFF_NOARP; IFF_SET_NOARP(dev->d_flags);
} }
/* Don't allow any further call backs. */ /* Don't allow any further call backs. */