Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lwip: Add patch to fix RA LLADDR processing #29600

Merged
merged 4 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,8 @@ LightingApp
LightingColor
LightingState
LinkSoftwareAndDocumentationPack
lladdr
LLADDR
LocalConfigDisabled
localedef
localhost
Expand Down
8 changes: 8 additions & 0 deletions src/lwip/patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ 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
Expand Down
24 changes: 24 additions & 0 deletions src/lwip/patches/nd6_lladdr_fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c
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)
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);
+ 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;
}
Loading