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:
parent
5f4ddc48ca
commit
cdff532bfa
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* 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>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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. */
|
||||
|
||||
dev->d_flags &= ~IFF_NOARP;
|
||||
IFF_CLR_IPv6(dev->d_flags);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -134,7 +134,7 @@ static uint16_t arp_send_interrupt(FAR struct net_driver_s *dev,
|
||||
* 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. */
|
||||
|
||||
|
@ -279,6 +279,10 @@ void icmpv6_input(FAR struct net_driver_s *dev)
|
||||
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",
|
||||
dev->d_len, (icmp->len[0] << 8) | icmp->len[1]);
|
||||
|
||||
|
@ -180,6 +180,16 @@ void icmpv6_solicit(FAR struct net_driver_s *dev,
|
||||
/* Move our source Ethernet addresses into the Ethernet header */
|
||||
|
||||
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
|
||||
|
||||
|
@ -131,19 +131,18 @@ void neighbor_out(FAR struct net_driver_s *dev)
|
||||
FAR struct ipv6_hdr_s *ip = IPv6BUF;
|
||||
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
|
||||
* 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. */
|
||||
|
||||
dev->d_flags &= ~IFF_NOARP;
|
||||
IFF_CLR_IPv6(dev->d_flags);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Find the destination IPv6 address in the ARP table and construct
|
||||
* the Ethernet header. If the destination IPv6 address isn't on the
|
||||
|
@ -132,7 +132,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
|
||||
* 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. */
|
||||
|
Loading…
Reference in New Issue
Block a user