-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Broaden IPv6 support in MicroPython by default. #17545
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
Draft
andrewleech
wants to merge
8
commits into
micropython:master
Choose a base branch
from
andrewleech:ipv6_support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #17545 +/- ##
=======================================
Coverage 98.56% 98.56%
=======================================
Files 169 169
Lines 21950 21950
=======================================
Hits 21636 21636
Misses 314 314 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code size report:
|
7bc5cb2
to
ee0881d
Compare
Enable IPv6 support by default in the common LWIP configuration: - LWIP_IPV6=1: Enable IPv6 protocol stack - LWIP_IPV6_AUTOCONFIG=1: Enable IPv6 autoconfiguration - LWIP_IPV6_MLD=1: Enable IPv6 Multicast Listener Discovery - LWIP_ND6_NUM_DESTINATIONS=4: Set neighbor discovery cache size - LWIP_ND6_QUEUEING=0: Disable ND6 queueing to reduce RAM usage Also includes atoi declaration and redirect for LWIP compatibility. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
LWIP uses atoi in netif_find and getaddrinfo functions but some MicroPython ports don't provide it. Add lwip_atoi implementation for LWIP's use, redirected via lwipopts_common.h define. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Add IPv6 support by: - Including lwip/ethip6.h header when LWIP_IPV6 is enabled - Setting output_ip6 to ethip6_output for IPv6 packet handling - Adding NETIF_FLAG_MLD6 flag for IPv6 multicast support - Creating IPv6 link-local address after interface initialization - Remove redundant LWIP_IPV6 definition (now in common config) Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Add IPv6 support by: - Including lwip/ethip6.h header when LWIP_IPV6 is enabled - Setting output_ip6 to ethip6_output for IPv6 packet handling - Adding NETIF_FLAG_MLD6 flag for IPv6 multicast support - Creating IPv6 link-local address after interface initialization Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Add IPv6 support by: - Including lwip/ethip6.h header when LWIP_IPV6 is enabled - Setting output_ip6 to ethip6_output for IPv6 packet handling - Adding NETIF_FLAG_MLD6 flag for IPv6 multicast support - Creating IPv6 link-local address after interface initialization Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Remove local LWIP_IPV6 definition to use the common IPv6 configuration from extmod/lwip-include/lwipopts_common.h. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
IPv6 settings are now defined in the common LWIP configuration: - LWIP_IPV6 is enabled by default in lwipopts_common.h - LWIP_ND6_NUM_DESTINATIONS is set to 4 in lwipopts_common.h - LWIP_ND6_QUEUEING is set to 0 in lwipopts_common.h Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
c4e1886
to
ac1d326
Compare
…ion. Enable IPv6 support when ROM level is at least EXTRA and consolidate IPv6 configuration settings in the common LWIP configuration: - LWIP_IPV6=MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA - LWIP_IPV6_AUTOCONFIG=1: Enable IPv6 autoconfiguration - LWIP_IPV6_MLD=1: Enable IPv6 Multicast Listener Discovery - LWIP_ND6_NUM_DESTINATIONS=4: Set neighbor discovery cache size - LWIP_ND6_QUEUEING=0: Disable ND6 queueing to reduce RAM usage Also includes atoi declaration and redirect for LWIP compatibility. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
ac1d326
to
e17730a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR broadens IPv6 support, enabling it by default on supported platforms.
It was originally part of #16459 but I felt it should be tested separately.
This turns on some of the missing pieces to ensure auto detection to work correctly, similar to mdns in ipv4.
Part of this was consolidating changes from #15422 into the common settings for all ports.
With the work on usb-networking I've found ipv6 very helpful for local devices to not need to worry about dhcp configuration and discovery, ipv6 can "just work" without ip address collisions from multiple devices.
Core IPv6 Features
LWIP IPv6 Configuration:
LWIP_IPV6
support by default in common LWIP configurationLWIP_IPV6_AUTOCONFIG
)LWIP_IPV6_MLD
)Ethernet Driver IPv6 Support:
Implementation Pattern:
Each network driver follows a consistent IPv6 integration pattern:
lwip/ethip6.h
whenLWIP_IPV6
is enabledoutput_ip6
toethip6_output
for IPv6 packet handlingNETIF_FLAG_MLD6
flag for IPv6 multicast supportFiles Modified
Core LWIP Configuration:
extmod/lwip-include/lwipopts_common.h
: Enable IPv6 by default with autoconfigNetwork Drivers:
ports/stm32/eth.c
: Add IPv6 support to STM32 ethernet driverports/mimxrt/eth.c
: Add IPv6 support to i.MX RT ethernet driverdrivers/esp-hosted/esp_hosted_netif.c
: Add IPv6 support to ESP-hosted driverPort Configuration Cleanup:
ports/renesas-ra/lwip_inc/lwipopts.h
: Remove port-specific IPv6 disableports/mimxrt/lwip_inc/lwipopts.h
: Remove port-specific IPv6 disableTest Coverage
New IPv6-Specific Tests:
tests/extmod/socket_ipv6_basic.py
: Basic IPv6 socket operations and bindingtests/multi_net/tcp_data_ipv6.py
: IPv6 TCP client-server communicationtests/multi_net/udp_data_ipv6.py
: IPv6 UDP client-server communicationtests/net_inet/getaddrinfo_ipv6.py
: IPv6 DNS resolution and dual-stack supportAll tests include graceful fallback when IPv6 support is not available.
Testing
Unix Port Testing (Completed):
On-Device Testing (Pending):
Test Commands:
Trade-offs and Alternatives
Benefits:
Code Size Impact:
LWIP_IPV6=0
if neededAlternative Approaches Considered:
The implementation provides a solid foundation for IPv6 networking across the MicroPython ecosystem with minimal disruption to existing functionality.