-
Notifications
You must be signed in to change notification settings - Fork 13.3k
IPv6 UDP send not working. #5744
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
Comments
Thanks for MCVE ! |
#5743 does not touch the underlying issue of I believe initializing
|
Initialize UdpContext `_pcb->local_ip.type` with `IPADDR_TYPE_ANY` in dual-stack mode.
Please see #5745 |
That's what you do in #5745 (your |
I couldn't figure out where lwip2 came from, so this was the closest I got to the issue from my position at the time (easier to fix source code compiled on every upload than precompiled libraries). The We should probably also check if this issue is present in TCP or other protocols where applicable. Which ever way you choose to solve the issue, it would probably be best to get it in for the next release. This is probably how I would've done it if I knew at the time how to get at the lwip2 source code.Not tested, but should do exactly the same as #5745. diff --git a/src/core/udp.c b/src/core/udp.c
index 9d2cb4af..40cdf190 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -1233,6 +1233,12 @@ udp_new(void)
#if LWIP_MULTICAST_TX_OPTIONS
udp_set_multicast_ttl(pcb, UDP_TTL);
#endif /* LWIP_MULTICAST_TX_OPTIONS */
+// Defaults to IPADDR_TYPE_V4 (0)
+#if LWIP_IPV4 && LWIP_IPV6
+ pcb->local_ip.type = IPADDR_TYPE_ANY;
+#elif LWIP_IPV6
+ pcb->local_ip.type = IPADDR_TYPE_V6;
+#endif
}
return pcb;
} |
lwip2 is ours, on my gh pages. To test it, put your above patch in lwip2's |
…her we have IPv4, IPv4+IPv6 or IPv6 networking stack. Fixes esp8266/Arduino#5744 Closes esp8266/Arduino#5745
Right, sneaky submodules.. |
…her we have IPv4, IPv4+IPv6 or IPv6 networking stack. (#28) Fixes esp8266/Arduino#5744 Closes esp8266/Arduino#5745
From: @oddstr13 (d-a-v/esp82xx-nonos-linklayer#28) Initialize pcb->local_ip.type depending on whether we have IPv4, IPv4+IPv6 or IPv6 networking stack. Fixes esp8266#5744 Closes esp8266#5745
From: @oddstr13 (d-a-v/esp82xx-nonos-linklayer#28) Initialize pcb->local_ip.type depending on whether we have IPv4, IPv4+IPv6 or IPv6 networking stack. Fixes esp8266#5744 Closes esp8266#5745
…her we have IPv4, IPv4+IPv6 or IPv6 networking stack. (#28) Fixes esp8266/Arduino#5744 Closes esp8266/Arduino#5745
Basic Infos
Platform
Settings in IDE
Relevant: lwIP variant:
v2 IPv6 Lower memory
Problem Description
IPv6 UDP packets are not sent due to
local_ip
being set to0.0.0.0, IPv4
.This is the underlying issue that prompted my question in regards to multicast IPv6.
For IPv6 multicast, I got it working by hacking
setMulticastInterface
in UdpContext.h:And passing the IPv6 address of the interface to
beginPacketMulticast
;The reason it fails
:ust rc=-6
, is due to!IP_ADDR_PCB_VERSION_MATCH(pcb, dst_ip)
in lwIP'sudp.c
.From
<lwip/ip_addr.h>
:The
local_ip
is neitherIP6_ADDR_ANY
, or of typeIPADDR_TYPE_ANY
, and as such,udp_sendto
fails withERR_VAL(-6)
.IP_ADDR_ANY
is defined asIP4_ADDR_ANY
in<lwip/ip_address.h>
, which is aip_addr_t = {u_addr={0ul, 0ul, 0ul, 0ul}, type=0
.Ideally,
IP_ADDR_ANY
should probably have typeIPADDR_TYPE_ANY(46)
, notIPADDR_TYPE_V4(0)
on dual-stack systems, but this might be an upstream issue?Lastly, this issue might not show up when replying to received packets (I have not tested this).
MCVE Sketch
Traffic watched on router with
tcpdump -i br-lan -n port 18888
Debug Messages
Edit:
Some extra debug output in
<UdpContext.h>
send()
is present;The text was updated successfully, but these errors were encountered: