diff --git a/net/icmpv6/icmpv6.h b/net/icmpv6/icmpv6.h index 1e3fbbe2e0d..5b1b498afb1 100644 --- a/net/icmpv6/icmpv6.h +++ b/net/icmpv6/icmpv6.h @@ -424,6 +424,24 @@ void icmpv6_notify(net_ipv6addr_t ipaddr); int icmpv6_autoconfig(FAR struct net_driver_s *dev); #endif +/**************************************************************************** + * Name: icmpv6_setaddresses + * + * Description: + * We successfully obtained the Router Advertisement. Set the new IPv6 + * addresses in the driver structure. + * + ****************************************************************************/ + +#ifdef CONFIG_NET_ICMPv6_AUTOCONF +void icmpv6_setaddresses(FAR struct net_driver_s *dev, + const net_ipv6addr_t draddr, + const net_ipv6addr_t prefix, + unsigned int preflen); +#else +# define icmpv6_setaddresses(d,d,p,p) (0) +#endif + /**************************************************************************** * Name: icmpv6_rwait_setup * @@ -502,12 +520,9 @@ int icmpv6_rwait(FAR struct icmpv6_rnotify_s *notify, unsigned int timeout); ****************************************************************************/ #ifdef CONFIG_NET_ICMPv6_AUTOCONF -void icmpv6_rnotify(FAR struct net_driver_s *dev, - const net_ipv6addr_t draddr, - const net_ipv6addr_t prefix, - unsigned int preflen); +void icmpv6_rnotify(FAR struct net_driver_s *dev); #else -# define icmpv6_rnotify(d,p,l) +# define icmpv6_rnotify(d) (0) #endif /**************************************************************************** diff --git a/net/icmpv6/icmpv6_input.c b/net/icmpv6/icmpv6_input.c index 4684eb0f49f..1408f1d82aa 100644 --- a/net/icmpv6/icmpv6_input.c +++ b/net/icmpv6/icmpv6_input.c @@ -391,10 +391,14 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen) if ((prefixopt->flags & ICMPv6_PRFX_FLAG_A) != 0) { + /* Yes.. Set the new network addresses. */ + + icmpv6_setaddresses(dev, ipv6->srcipaddr, + prefixopt->prefix, prefixopt->preflen); + /* Notify any waiting threads */ - icmpv6_rnotify(dev, ipv6->srcipaddr, - prefixopt->prefix, prefixopt->preflen); + icmpv6_rnotify(dev); prefix = true; } } diff --git a/net/icmpv6/icmpv6_rnotify.c b/net/icmpv6/icmpv6_rnotify.c index 5c5c563a0b0..392b83883f2 100644 --- a/net/icmpv6/icmpv6_rnotify.c +++ b/net/icmpv6/icmpv6_rnotify.c @@ -58,22 +58,22 @@ static struct icmpv6_rnotify_s *g_icmpv6_rwaiters; /**************************************************************************** - * Private Functions + * Public Functions ****************************************************************************/ /**************************************************************************** * Name: icmpv6_setaddresses * * Description: - * We successfully obtained the Router Advertisement. See the new IPv6 + * We successfully obtained the Router Advertisement. Set the new IPv6 * addresses in the driver structure. * ****************************************************************************/ -static void icmpv6_setaddresses(FAR struct net_driver_s *dev, - const net_ipv6addr_t draddr, - const net_ipv6addr_t prefix, - unsigned int preflen) +void icmpv6_setaddresses(FAR struct net_driver_s *dev, + const net_ipv6addr_t draddr, + const net_ipv6addr_t prefix, + unsigned int preflen) { unsigned int i; @@ -139,10 +139,6 @@ static void icmpv6_setaddresses(FAR struct net_driver_s *dev, net_unlock(); } -/**************************************************************************** - * Public Functions - ****************************************************************************/ - /**************************************************************************** * Name: icmpv6_rwait_setup * @@ -287,9 +283,7 @@ int icmpv6_rwait(FAR struct icmpv6_rnotify_s *notify, unsigned int timeout) * ****************************************************************************/ -void icmpv6_rnotify(FAR struct net_driver_s *dev, - const net_ipv6addr_t draddr, const net_ipv6addr_t prefix, - unsigned int preflen) +void icmpv6_rnotify(FAR struct net_driver_s *dev) { FAR struct icmpv6_rnotify_s *curr; @@ -307,10 +301,6 @@ void icmpv6_rnotify(FAR struct net_driver_s *dev, if (curr->rn_result != OK && strncmp(curr->rn_ifname, dev->d_ifname, IFNAMSIZ) == 0) { - /* Yes.. Set the new network addresses. */ - - icmpv6_setaddresses(dev, draddr, prefix, preflen); - /* And signal the waiting, returning success */ curr->rn_result = OK;