This is an automated email from the ASF dual-hosted git repository.
archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new a7f084bfd4d icmpv6_autoconfig.c: fix crash when ipv6 address modified
during autoconfig
a7f084bfd4d is described below
commit a7f084bfd4dfb0e3a17a4039283146c9e0f43ed0
Author: zhanghongyu <[email protected]>
AuthorDate: Tue Aug 5 14:45:21 2025 +0800
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 <[email protected]>
---
net/icmpv6/icmpv6_autoconfig.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/icmpv6/icmpv6_autoconfig.c b/net/icmpv6/icmpv6_autoconfig.c
index 1121807f01c..70a7dd09fec 100644
--- a/net/icmpv6/icmpv6_autoconfig.c
+++ b/net/icmpv6/icmpv6_autoconfig.c
@@ -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 */