10000 Fix UDP send to IPv6 link local addresses by nomis · Pull Request #6541 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Fix UDP send to IPv6 link local addresses #6541

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

Merged
merged 2 commits into from
Apr 11, 2020
Merged
Changes from 1 commit
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
Next Next commit
Fix UDP send to IPv6 link local addresses
lwIP's tcp/udp_connect() and tcp/udp_bind() functions automatically
set the zone if it is required but missing, but udp_connect() is not
used so this doesn't happen.

Explicitly set the zone to the default network interface if it is
required for the type of address being used. Otherwise there is no
zone set and packets to a link local destination don't go anywhere.
  • Loading branch information
nomis committed Sep 20, 2019
commit 3aeb851ea781645a6c3ee7f34f06892db315dbc6
6 changes: 6 additions & 0 deletions libraries/ESP8266WiFi/src/include/UdpContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ class UdpContext
{
_pcb->remote_ip = addr;
_pcb->remote_port = port;
#if LWIP_IPV6
// Set zone so that link local addresses use the default interface
if (IP_IS_V6(&_pcb->remote_ip) && ip6_addr_lacks_zone(ip_2_ip6(&_pcb->remote_ip), IP6_UNKNOWN)) {
ip6_addr_assign_zone(ip_2_ip6(&_pcb->remote_ip),IP6_UNKNOWN, netif_default);
}
#endif
return true;
}

Expand Down
0