From 6bc36ec02001182bd45591c1497f293cdb387666 Mon Sep 17 00:00:00 2001 From: zwx Date: Wed, 7 Aug 2024 14:52:09 +0800 Subject: [PATCH] ND6: reply NS without LL opt * This issue should be fixed for the upstream * Reference to the RFC-4861#section-4.3 source Link-Layer address SHOULD be included in unicast solicitations. But there might be some NS messages which do not contain source link-layer address option. * NA will be replied to those NS messages which do not contain source link layer option. --- src/core/ipv6/nd6.c | 11 ++++++++++- src/include/lwip/opt.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c index 408f23f22..b8399258b 100644 --- a/src/core/ipv6/nd6.c +++ b/src/core/ipv6/nd6.c @@ -505,7 +505,16 @@ nd6_input(struct pbuf *p, struct netif *inp) /* Sender is trying to resolve our address. */ /* Verify that they included their own link-layer address. */ if (lladdr_opt == NULL) { - /* Not a valid message. */ + /* Per RFC4861#section-4.3, source Link-Layer address SHOULD be included in unicast solicitations. + * But, there might be some NSs which do not contain source link-layer address option. + * For LwIP implement, this kind of NS will be ignored. This issue should be fixed. + * Although this Neighbor Solicitation (NS) will be ignored in the subsequent process, + * a Neighbor Advertisement (NA) is still sent in response. */ +#if ESP_LWIP && LWIP_FORCE_ROUTER_FORWARDING + nd6_send_na(inp, &target_address, ND6_FLAG_ROUTER | ND6_FLAG_SOLICITED | ND6_FLAG_OVERRIDE); +#else + nd6_send_na(inp, &target_address, ND6_FLAG_SOLICITED | ND6_FLAG_OVERRIDE); +#endif pbuf_free(p); ND6_STATS_INC(nd6.proterr); ND6_STATS_INC(nd6.drop); diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 91aa3513f..4ac02d5dd 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -2424,7 +2424,7 @@ #endif /** - * when LWIP_FORCE_ROUTER_FORWARDING is enbaled in lwip, the router flag in NA packet will always + * when LWIP_FORCE_ROUTER_FORWARDING is enabled in lwip, the router flag in NA packet will always * set to 1, otherwise, never set router flag for NA packets. */ #if !defined LWIP_FORCE_ROUTER_FORWARDING || defined __DOXYGEN__