icmpv6: Allow IPv6 address obtained by both

stateless and stateful to coexist.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
This commit is contained in:
liqinhui 2024-02-01 16:34:20 +08:00 committed by Xiang Xiao
parent c00ff58baa
commit 590c7fe129
1 changed files with 6 additions and 10 deletions

View File

@ -442,22 +442,18 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen)
FAR struct icmpv6_prefixinfo_s *prefixopt = FAR struct icmpv6_prefixinfo_s *prefixopt =
(FAR struct icmpv6_prefixinfo_s *)opt; (FAR struct icmpv6_prefixinfo_s *)opt;
/* if "M" flag isn't set, and the "A" flag is set. /* Is the "A" flag set? */
* Set the new network addresses.
*/
if ((adv->flags & ICMPv6_RADV_FLAG_M) == 0 && if ((prefixopt->flags & ICMPv6_PRFX_FLAG_A) != 0)
(prefixopt->flags & ICMPv6_PRFX_FLAG_A) != 0)
{ {
icmpv6_setaddresses(dev, ipv6->srcipaddr, /* Yes.. Set the new network addresses. */
icmpv6_setaddresses(dev, ipv6->srcipaddr,
prefixopt->prefix, prefixopt->preflen); prefixopt->prefix, prefixopt->preflen);
netlink_ipv6_prefix_notify(dev, RTM_NEWPREFIX, netlink_ipv6_prefix_notify(dev, RTM_NEWPREFIX,
prefixopt); prefixopt);
} }
else if ((adv->flags & ICMPv6_RADV_FLAG_M) != 0)
/* Set the router address for the stateful process. */
if ((adv->flags & ICMPv6_RADV_FLAG_M))
{ {
net_ipv6addr_copy(dev->d_ipv6draddr, net_ipv6addr_copy(dev->d_ipv6draddr,
ipv6->srcipaddr); ipv6->srcipaddr);