mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +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);
|
int icmpv6_autoconfig(FAR struct net_driver_s *dev);
|
||||||
#endif
|
#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
|
* 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
|
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
|
||||||
void icmpv6_rnotify(FAR struct net_driver_s *dev,
|
void icmpv6_rnotify(FAR struct net_driver_s *dev);
|
||||||
const net_ipv6addr_t draddr,
|
|
||||||
const net_ipv6addr_t prefix,
|
|
||||||
unsigned int preflen);
|
|
||||||
#else
|
#else
|
||||||
# define icmpv6_rnotify(d,p,l)
|
# define icmpv6_rnotify(d) (0)
|
||||||
#endif
|
#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)
|
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 */
|
/* Notify any waiting threads */
|
||||||
|
|
||||||
icmpv6_rnotify(dev, ipv6->srcipaddr,
|
icmpv6_rnotify(dev);
|
||||||
prefixopt->prefix, prefixopt->preflen);
|
|
||||||
prefix = true;
|
prefix = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,22 +58,22 @@
|
|||||||
static struct icmpv6_rnotify_s *g_icmpv6_rwaiters;
|
static struct icmpv6_rnotify_s *g_icmpv6_rwaiters;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: icmpv6_setaddresses
|
* Name: icmpv6_setaddresses
|
||||||
*
|
*
|
||||||
* Description:
|
* 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.
|
* addresses in the driver structure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void icmpv6_setaddresses(FAR struct net_driver_s *dev,
|
void icmpv6_setaddresses(FAR struct net_driver_s *dev,
|
||||||
const net_ipv6addr_t draddr,
|
const net_ipv6addr_t draddr,
|
||||||
const net_ipv6addr_t prefix,
|
const net_ipv6addr_t prefix,
|
||||||
unsigned int preflen)
|
unsigned int preflen)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@@ -139,10 +139,6 @@ static void icmpv6_setaddresses(FAR struct net_driver_s *dev,
|
|||||||
net_unlock();
|
net_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: icmpv6_rwait_setup
|
* 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,
|
void icmpv6_rnotify(FAR struct net_driver_s *dev)
|
||||||
const net_ipv6addr_t draddr, const net_ipv6addr_t prefix,
|
|
||||||
unsigned int preflen)
|
|
||||||
{
|
{
|
||||||
FAR struct icmpv6_rnotify_s *curr;
|
FAR struct icmpv6_rnotify_s *curr;
|
||||||
|
|
||||||
@@ -307,10 +301,6 @@ void icmpv6_rnotify(FAR struct net_driver_s *dev,
|
|||||||
if (curr->rn_result != OK &&
|
if (curr->rn_result != OK &&
|
||||||
strncmp(curr->rn_ifname, dev->d_ifname, IFNAMSIZ) == 0)
|
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 */
|
/* And signal the waiting, returning success */
|
||||||
|
|
||||||
curr->rn_result = OK;
|
curr->rn_result = OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user