ICMPv6: Add logic to behave like a router (if so configured): NuttX will not send the router advertisement message in response to any router solicitation messages.

This commit is contained in:
Gregory Nutt 2015-02-05 09:43:29 -06:00
parent 111f4a45a3
commit 6568d94902
4 changed files with 57 additions and 0 deletions

View file

@ -3537,6 +3537,15 @@ static void stm32_ipv6multicast(FAR struct stm32_ethmac_s *priv)
(void)stm32_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
(void)stm32_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */

View file

@ -3995,6 +3995,15 @@ static void tiva_ipv6multicast(FAR struct tiva_ethmac_s *priv)
(void)tiva_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
(void)tiva_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */

View file

@ -273,6 +273,28 @@ void icmpv6_rsolicit(FAR struct net_driver_s *dev);
void icmpv6_advertise(FAR struct net_driver_s *dev,
const net_ipv6addr_t destipaddr);
/****************************************************************************
* Name: icmpv6_radvertise
*
* Description:
* Send an ICMPv6 Router Advertisement
*
* Parameters:
* dev - The device driver structure containing the outgoing ICMPv6 packet
* buffer
*
* Return:
* None
*
* Assumptions:
* The network is locked
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6_ROUTER
void icmpv6_radvertise(FAR struct net_driver_s *dev);
#endif
/****************************************************************************
* Function: icmpv6_wait_setup
*

View file

@ -194,6 +194,23 @@ void icmpv6_input(FAR struct net_driver_s *dev)
}
break;
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Check if we received a Router Solicitation */
case ICMPV6_ROUTER_SOLICIT:
{
/* Just give a knee-jerk Router Advertisement in respond with no
* further examination of the Router Solicitation.
*/
icmpv6_radvertise(dev);
/* All statistics have been updated. Nothing to do but exit. */
return;
}
#endif
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Check if we received a Router Advertisement */