-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Better IPv6 handling of AddrAny (which maps to IPv4 if enabled in lwip) #10564
Conversation
…disabled and enabled
IPAddress ANY has only one constant state, however addrTypeconnectedhomeip/src/inet/UDPEndPoint.cpp Lines 138 to 148 in 7814da6
This comment was generated by todo based on a
|
Size increase report for "gn_qpg-example-build" from f2b4dbd
Full report output
|
PR #10564: Size comparison from f2b4dbd to 9baf5d1 20 builds
2 builds
12 builds
|
The sdk seems pretty set on having the single
|
Size increase report for "esp32-example-build" from f2b4dbd
Full report output
|
We explicitly do not have IPv4 only stack support due to matter spec. Ideal goal is to always have an IPv6 only stack and I was debugging that when finding this problem. The issue I have is that when listening for mDNS, it seems I know exactly on what I need to listen (we iterate through all IP addresses and listen on v4/v6 accordingly) and that is important because we have to join the correct multicast group that is also IPv4/v6 specific. I am guessing the 'addrType' parameter seems like a workaround acknowledging that ::Any was insufficient for listening purposes. Any is however used as a "don't care/undefined" for things like source addresses or our internal DNS discovery setting (saying find any address), so it is not easy to remove. Ideally I think we should not be using ::Any as a bitfield of v4 + v6, however if we are moving towards supporting IPv6 only stacks the hassle to fix this may be too much. |
I am just trying to make the case that buildable configurations should actually work. There's nothing mysterious about dual-stack. It's just more work and more code space. In this case, a single socket bound to any address seems like it has a very obvious meaning in a dual-stack build: it should accept both IPv4 and IPv6 traffic. But yes, obviously the sdk must support binding to IP6_ADDR_ANY first and foremost, and so this PR makes sense. |
Problem
IPv6 listening not performed properly when IPv4 is disabled, generally the 'force address type' inside UDP bind handling is hackish:
IP_ADDR_ANY
to the IPv4 constantChange overview
IP6_ADDR_ANY
instead of relying on using the v4 address and changing the type (even if it may be equivalent, it is not as clear to prove).Testing
Manually tested on separate IPv6 validation branch: ESP32 was able to send IPv6 broadcasts at boot with matter mDNS packets and was also able to reply to mDNS queries (sporadically though - I am still debugging this as I suspect some problems with joining or using multicast groups but have yet to determine the side)