From f739fd010de8cd5114cafa730a0cb0fc130bd699 Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Wed, 24 Jan 2024 15:00:38 +0800 Subject: [PATCH] icmpv6_neighbor: skip neighbor solicitation on L3 Nic Otherwise, sending will fail because the neighbor table cannot be found Signed-off-by: zhanghongyu --- net/icmpv6/icmpv6_neighbor.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/icmpv6/icmpv6_neighbor.c b/net/icmpv6/icmpv6_neighbor.c index ac2c7b4a94..b6bd1df0db 100644 --- a/net/icmpv6/icmpv6_neighbor.c +++ b/net/icmpv6/icmpv6_neighbor.c @@ -216,6 +216,17 @@ int icmpv6_neighbor(FAR struct net_driver_s *dev, goto errout; } + /* Neighbor support is only built if the Ethernet link layer is supported. + * Continue and send the Solicitation only if this device uses the + * Ethernet link layer protocol. + */ + + if (dev->d_lltype != NET_LL_ETHERNET && + dev->d_lltype != NET_LL_IEEE80211) + { + return OK; + } + /* Check if the destination address is on the local network. */ if (NETDEV_V6ADDR_ONLINK(dev, ipaddr) || net_is_addr_linklocal(ipaddr))