icmpv6_autoconfig.c: fix crash when ipv6 address modified during autoconfig

During the autoconfig process, if the user modifies the link local
address while waiting for the Router Advertisement message, a crash will
occur when sending the ICMPv6 Neighbor Advertisement message because
netdev_ipv6_lladdr returns NULL.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu
2025-08-05 14:45:21 +08:00
committed by archer
parent 79d7ada455
commit a7f084bfd4
+7
View File
@@ -189,6 +189,13 @@ static int icmpv6_send_message(FAR struct net_driver_s *dev, bool advertise)
struct icmpv6_router_s state;
int ret;
/* Check whether the link-local address has been overwritten. */
if (netdev_ipv6_lladdr(dev) == NULL)
{
return -EADDRNOTAVAIL;
}
/* Initialize the state structure with the network locked. */
nxsem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */