-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Ipv6 support for cyw43/rp2 #9108
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
Conversation
77e329b
to
797bdde
Compare
I noticed that the CI build for "esp8266" uses a strange (out-of-tree) path for choosing its lwip which looks quite outdated. Can this be updated or do we need to adjust for that older lwip version by using more preprocessing macros? |
Code size report:
|
bd65cf6
to
acf591a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #9108 +/- ##
=======================================
Coverage 98.36% 98.36%
=======================================
Files 159 159
Lines 21069 21069
=======================================
Hits 20724 20724
Misses 345 345 ☔ View full report in Codecov by Sentry. |
I've rebased the changes to depend on the recently included changes from the cyw43-driver. Regarding the lwip < v2.0 for esp8266: As I haven't heard anything back for #9108 (comment) I don't assume upgrading lwip for esp8266 is an option. So I've did some preprocessor definitions to make the code use the different, incompatible types for lwip < 2.0, in order to make it work on both versions now. @dpgeorge could you take a look at the changes, give some feedback and hopefully merge them? |
Situation with lwip on esp8266 is a PITA. Some closed parts of SDK depend on lwip 1.x. There exists esp82xx-nonos-linklayer project (used in Arduino) that acts as a bridge between those closed parts and lwip 2.x, but micropython is not currently using it. Actually, the whole esp8266 toolchain that micropython currently uses is very old and abandoned. Ideally, it should be replaced with https://github.com/earlephilhower/esp-quick-toolchain that is maintained and used by Arduino. UPD: Possibly the easier route is to use https://github.com/someburner/esp-open-sdk that is very much similar to current sdk that is used for esp8266, but bundles |
Hi @jimmo would you mind giving this a quick look? The changes are pretty simple. I (and from the reactions 3 others), would like to see this merged, with or without enabling it per default for the picoW board. |
I, too, would love to see this merged. Would be great to at least have an easy, straightforward way to enable IPv6 for custom builds. |
7a45cb6
to
61c2c46
Compare
I've rebased the changes @dpgeorge, would you mind commenting, reviewing and/or merging this? |
@dpgeorge what's needed to get this over the line? I appreciate that some ISPs are laggards in terms of adopting IPv6 -- if you're struggling to test this with your ISP then please shout as I'm sure we can find a solution. |
This looks good! But I think IPv6 should be disabled by default on rp2 because:
That said, I'm happy to merge the changes here, as long as it's not enabled by default on rp2. |
Thank you for your feedback.
I believe as-is this change can not make Pico Ws behave strangely in any broken network, because dns will use the ipv4 address instead. So the behavior is:
Changing the dns default however will change the 4th case. So leaving this as-is for default will not make the device behave different.
Good point, feel free to drop 507128e while merging this and we can enable ipv6 a bit later.
I already have some code for that locally. I will polish that and submit it as PR in the next days. |
With these changes IPv6 works on the rp2 port (and possibly others that use the lwIP socket implementation). Things that have been tested and work: - Neighbour solicitation for v6 link local address. - Ping of v6 link-local address. - Receiving a SLAAC address via router advertisement. - Ping a v6 address allocated via SLAAC. - Perform an outgoing connection to a routed v6-address (via default gateway). - Create a listening IPv6 wildcard socked bound to ::, and trying to access it via link-local, SLAAC, and IPv4 (to ensure the dual-stack binding works). Things that could be improved: - socket.socket().getaddrinfo only returns the v4 address. It could also return v6 addresses (getaddrinfo is actively programmed to only return a single address, and this is the v4-address by default, with fallback to the v6 address if both are enabled). Signed-off-by: Felix Dörre <[email protected]>
Signed-off-by: Felix Dörre <[email protected]>
OK, I've merged this PR without the commit that enables IPv6 on rp2. That can come later. |
Sounds good, thanks! |
Merge micropython#9107 to main: adafruit_sht4x_trinkey_m0 pin fix
Are there any news about the commit that enables IPv6? I have the latest release of the firmware and get only ipv4 address |
There was a PR that added I think, when #14140 is merged, we could enable IPv6 by default. To use IPv6 right now, you need to enable |
With these changes ipv6 on rp2 works perfectly for me.
Things I've tested:
::
, and trying to access it via link-local, slaac, and ipv4 (to ensure the dual-stack binding works)Things that could be improved:
socket.socket().getaddrinfo
only returns the v4 address. It could also return v6 addresses.getaddrinfo
now: It is actively programmed to only return a single address. And this is the v4-address by default: https://github.com/lwip-tcpip/lwip/blob/089697bb1cadf2d208ed43f936a9e4e4bd9b0b3b/src/core/dns.c#L1552 So dns only returns the v4 address and falls back to the v6 address if both are enabled, which seems fine for most cases, though I personally might prefer v6 over v4, but I guess the default is fine as-is.If you don't want to enable ipv6 in rpi2 by default at all, I think the changes are still a valuable contribution.