From 33bb6659d1107df2f6c782aa15e85ed2c3a1805d Mon Sep 17 00:00:00 2001 From: cecille Date: Wed, 4 Oct 2023 16:29:45 -0400 Subject: [PATCH 1/4] lwip: Add patch to fix RA LLADDR processing --- src/lwip/patches/README.md | 7 +++++++ src/lwip/patches/nd6_lladdr_fix.patch | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/lwip/patches/nd6_lladdr_fix.patch diff --git a/src/lwip/patches/README.md b/src/lwip/patches/README.md index b41708670b2ef9..f64f26a22b6de1 100644 --- a/src/lwip/patches/README.md +++ b/src/lwip/patches/README.md @@ -19,6 +19,13 @@ Troubleshooting: The patch uses the `ip6_addr_net_eq` function, which is a recent API change on upstream LwIP. The previous version of this function is `ip6_addr_netcmp`, so this function call may need to be replaced on older forks. +### ND6 LLADDR fix + +This patch fixes a bug where the RA processing fails if the RA includes an LLADDR +option with a hw address that is not the max length. This happens for thread devices. + +- patch file: nd6_lladdr_fix.patch + ## Important upstream patches ### Malformed neighbor solicitation packet fix diff --git a/src/lwip/patches/nd6_lladdr_fix.patch b/src/lwip/patches/nd6_lladdr_fix.patch new file mode 100644 index 00000000000000..7f5d77cacead27 --- /dev/null +++ b/src/lwip/patches/nd6_lladdr_fix.patch @@ -0,0 +1,25 @@ +diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c +index 55b5774f..7ab0d270 100644 +--- a/src/core/ipv6/nd6.c ++++ b/src/core/ipv6/nd6.c +@@ -686,14 +686,15 @@ nd6_input(struct pbuf *p, struct netif *inp) + switch (option_type) { + case ND6_OPTION_TYPE_SOURCE_LLADDR: + { +- struct lladdr_option *lladdr_opt; +- if (option_len < (ND6_LLADDR_OPTION_MIN_LENGTH + inp->hwaddr_len)) { ++ const u8_t option_type_and_length_size = 1 + 1; ++ const u8_t *addr_cursor; ++ if (option_len < (option_type_and_length_size + inp->hwaddr_len)) { + goto lenerr_drop_free_return; + } +- lladdr_opt = (struct lladdr_option *)buffer; ++ addr_cursor = buffer + option_type_and_length_size; + if ((default_router_list[i].neighbor_entry != NULL) && +- (default_router_list[i].neighbor_entry->state == ND6_INCOMPLETE)) { +- SMEMCPY(default_router_list[i].neighbor_entry->lladdr, lladdr_opt->addr, inp->hwaddr_len); ++ (default_router_list[i].neighbor_entry->state == ND6_INCOMPLETE)) { ++ SMEMCPY(default_router_list[i].neighbor_entry->lladdr, addr_cursor, inp->hwaddr_len); + default_router_list[i].neighbor_entry->state = ND6_REACHABLE; + default_router_list[i].neighbor_entry->counter.reachable_time = reachable_time; + } From 9054a02a8598c931df9a233d316f3f0ad98e03aa Mon Sep 17 00:00:00 2001 From: cecille Date: Tue, 10 Oct 2023 15:25:11 -0400 Subject: [PATCH 2/4] Fix weird spacing issue in patch. --- src/lwip/patches/nd6_lladdr_fix.patch | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lwip/patches/nd6_lladdr_fix.patch b/src/lwip/patches/nd6_lladdr_fix.patch index 7f5d77cacead27..8ce931e01d1712 100644 --- a/src/lwip/patches/nd6_lladdr_fix.patch +++ b/src/lwip/patches/nd6_lladdr_fix.patch @@ -1,5 +1,5 @@ diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c -index 55b5774f..7ab0d270 100644 +index 55b5774f..8559d69b 100644 --- a/src/core/ipv6/nd6.c +++ b/src/core/ipv6/nd6.c @@ -686,14 +686,15 @@ nd6_input(struct pbuf *p, struct netif *inp) @@ -16,9 +16,8 @@ index 55b5774f..7ab0d270 100644 - lladdr_opt = (struct lladdr_option *)buffer; + addr_cursor = buffer + option_type_and_length_size; if ((default_router_list[i].neighbor_entry != NULL) && -- (default_router_list[i].neighbor_entry->state == ND6_INCOMPLETE)) { + (default_router_list[i].neighbor_entry->state == ND6_INCOMPLETE)) { - SMEMCPY(default_router_list[i].neighbor_entry->lladdr, lladdr_opt->addr, inp->hwaddr_len); -+ (default_router_list[i].neighbor_entry->state == ND6_INCOMPLETE)) { + SMEMCPY(default_router_list[i].neighbor_entry->lladdr, addr_cursor, inp->hwaddr_len); default_router_list[i].neighbor_entry->state = ND6_REACHABLE; default_router_list[i].neighbor_entry->counter.reachable_time = reachable_time; From cd1c74b5495eca4e74769cb4ba384a5b139dee59 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 5 Oct 2023 16:29:21 +0000 Subject: [PATCH 3/4] Restyled by prettier-markdown --- src/lwip/patches/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lwip/patches/README.md b/src/lwip/patches/README.md index f64f26a22b6de1..cb56e7a22e5d0d 100644 --- a/src/lwip/patches/README.md +++ b/src/lwip/patches/README.md @@ -21,8 +21,9 @@ recent API change on upstream LwIP. The previous version of this function is ### ND6 LLADDR fix -This patch fixes a bug where the RA processing fails if the RA includes an LLADDR -option with a hw address that is not the max length. This happens for thread devices. +This patch fixes a bug where the RA processing fails if the RA includes an +LLADDR option with a hw address that is not the max length. This happens for +thread devices. - patch file: nd6_lladdr_fix.patch From 60af2edc5de65ba71d02ae3264e7bbeef02dd5b0 Mon Sep 17 00:00:00 2001 From: cecille Date: Fri, 13 Oct 2023 17:45:42 -0400 Subject: [PATCH 4/4] Add lladdr to wordlist --- .github/.wordlist.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 67a6d1d8fac3e4..5d4b0462193f66 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -789,6 +789,8 @@ LightingApp LightingColor LightingState LinkSoftwareAndDocumentationPack +lladdr +LLADDR LocalConfigDisabled localedef localhost