mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
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:
@@ -189,6 +189,13 @@ static int icmpv6_send_message(FAR struct net_driver_s *dev, bool advertise)
|
|||||||
struct icmpv6_router_s state;
|
struct icmpv6_router_s state;
|
||||||
int ret;
|
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. */
|
/* Initialize the state structure with the network locked. */
|
||||||
|
|
||||||
nxsem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */
|
nxsem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */
|
||||||
|
|||||||
Reference in New Issue
Block a user