mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 04:16:35 +08:00
update IPv6 NIC parameters unconditionally when ICMPv6 RA is received
Signed-off-by: luojun1 <luojun1@xiaomi.com> Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
7c2986bb34
commit
00cf3e559d
+20
-5
@@ -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
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user