-
Notifications
You must be signed in to change notification settings - Fork 7.6k
IPv6 readiness and support "by default" #6242
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
It's possible to do it calling I usually use it in |
@nuclearcat Any updates? |
is this still valid? |
Yes might work on it at free time, probably this week |
thanks @nuclearcat! |
To use IPv6 we need proper SLAAC support which is not possible without this option. Compile tested on esp32, esp32s2, esp32s3, esp32c3 Functionality tested in esp32 BasicHttpClient with some minor patches, IPv6 start to work. No significant sketch size increase (probably within rounding bounds): Before: Wrote 875328 bytes (558896 compressed) at 0x00010000 in 9.0 seconds (effective 779.4 kbit/s)... After: Wrote 875328 bytes (558942 compressed) at 0x00010000 in 9.0 seconds (effective 779.8 kbit/s)... This patch part of the efforts mentioned in espressif/arduino-esp32#6242 Proper IPv6 support also was requested in: espressif/arduino-esp32#6626 espressif/arduino-esp32#6590 espressif/arduino-esp32#6283 espressif/arduino-esp32#6703 espressif/arduino-esp32#5624 espressif/arduino-esp32#1261 And many others. Signed-off-by: Denys Fedoryshchenko <[email protected]>
This patch partially depends on: espressif/esp32-arduino-lib-builder#67 Without this patch we will get only Link local IPv6 (still useful for MDNS and etc). With patch we will get also global IPv6 address by SLAAC. Tested on BasicHttpClient by adding: wifiMulti.IPv6(true); before: wifiMulti.addAP() call Enabling Core Debug Level: verbose If IP6 obtained, in logs will be visible: [ 8028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 0, Zone: 2, fe80:0000:0000:0000:xxxx:xxxx:xxxx:xxxx [ 8028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 [ 11028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 1, Zone: 0, 2a0d:yyyy:0000:4000:yyyy:yyyy:yyyy:yyyy [ 11028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 This is linked to: espressif#6242 Signed-off-by: Denys Fedoryshchenko <[email protected]>
This patch partially depends on: espressif/esp32-arduino-lib-builder#67 Without this patch we will get only Link local IPv6 (still useful for MDNS and etc). With patch we will get also global IPv6 address by SLAAC. Tested on BasicHttpClient by adding: wifiMulti.IPv6(true); before: wifiMulti.addAP() call Enabling Core Debug Level: verbose If IP6 obtained, in logs will be visible: [ 8028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 0, Zone: 2, fe80:0000:0000:0000:xxxx:xxxx:xxxx:xxxx [ 8028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 [ 11028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 1, Zone: 0, 2a0d:yyyy:0000:4000:yyyy:yyyy:yyyy:yyyy [ 11028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 This is linked to: espressif#6242 Signed-off-by: Denys Fedoryshchenko <[email protected]>
This patch partially depends on: espressif/esp32-arduino-lib-builder#67 Without this patch we will get only Link local IPv6 (still useful for MDNS and etc). With patch we will get also global IPv6 address by SLAAC. By default IPv6 disabled, until it is properly tested. Tested on BasicHttpClient by adding: wifiMulti.IPv6(true); before: wifiMulti.addAP() call Enabling Core Debug Level: verbose If IP6 obtained, in logs will be visible: [ 8028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 0, Zone: 2, fe80:0000:0000:0000:xxxx:xxxx:xxxx:xxxx [ 8028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 [ 11028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 1, Zone: 0, 2a0d:yyyy:0000:4000:yyyy:yyyy:yyyy:yyyy [ 11028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 This is linked to: espressif#6242 Signed-off-by: Denys Fedoryshchenko <[email protected]>
I added series of patches in PR, that provide necessary support for IPv6, but it needs serious testing, especially as i dont have yet devboards on s2, s3 and c3. |
To use IPv6 we need proper SLAAC support which is not possible without this option. Compile tested on esp32, esp32s2, esp32s3, esp32c3 Functionality tested in esp32 BasicHttpClient with some minor patches, IPv6 start to work. No significant sketch size increase (probably within rounding bounds): Before: Wrote 875328 bytes (558896 compressed) at 0x00010000 in 9.0 seconds (effective 779.4 kbit/s)... After: Wrote 875328 bytes (558942 compressed) at 0x00010000 in 9.0 seconds (effective 779.8 kbit/s)... This patch part of the efforts mentioned in espressif/arduino-esp32#6242 Proper IPv6 support also was requested in: espressif/arduino-esp32#6626 espressif/arduino-esp32#6590 espressif/arduino-esp32#6283 espressif/arduino-esp32#6703 espressif/arduino-esp32#5624 espressif/arduino-esp32#1261 And many others. Signed-off-by: Denys Fedoryshchenko <[email protected]>
Any feedback? :) |
To use IPv6 we need proper SLAAC support which is not possible without this option. Compile tested on esp32, esp32s2, esp32s3, esp32c3 Functionality tested in esp32 BasicHttpClient with some minor patches, IPv6 start to work. No significant sketch size increase (probably within rounding bounds): Before: Wrote 875328 bytes (558896 compressed) at 0x00010000 in 9.0 seconds (effective 779.4 kbit/s)... After: Wrote 875328 bytes (558942 compressed) at 0x00010000 in 9.0 seconds (effective 779.8 kbit/s)... This patch part of the efforts mentioned in espressif/arduino-esp32#6242 Proper IPv6 support also was requested in: espressif/arduino-esp32#6626 espressif/arduino-esp32#6590 espressif/arduino-esp32#6283 espressif/arduino-esp32#6703 espressif/arduino-esp32#5624 espressif/arduino-esp32#1261 And many others. Signed-off-by: Denys Fedoryshchenko <[email protected]>
To use IPv6 we need proper SLAAC support which is not possible without this option. Compile tested on esp32, esp32s2, esp32s3, esp32c3 Functionality tested in esp32 BasicHttpClient with some minor patches, IPv6 start to work. No significant sketch size increase (probably within rounding bounds): Before: Wrote 875328 bytes (558896 compressed) at 0x00010000 in 9.0 seconds (effective 779.4 kbit/s)... After: Wrote 875328 bytes (558942 compressed) at 0x00010000 in 9.0 seconds (effective 779.8 kbit/s)... This patch part of the efforts mentioned in espressif/arduino-esp32#6242 Proper IPv6 support also was requested in: espressif/arduino-esp32#6626 espressif/arduino-esp32#6590 espressif/arduino-esp32#6283 espressif/arduino-esp32#6703 espressif/arduino-esp32#5624 espressif/arduino-esp32#1261 And many others. Signed-off-by: Denys Fedoryshchenko <[email protected]>
This patch partially depends on: espressif/esp32-arduino-lib-builder#67 Without this patch we will get only Link local IPv6 (still useful for MDNS and etc). With patch we will get also global IPv6 address by SLAAC. By default IPv6 disabled, until it is properly tested. Tested on BasicHttpClient by adding: wifiMulti.IPv6(true); before: wifiMulti.addAP() call Enabling Core Debug Level: verbose If IP6 obtained, in logs will be visible: [ 8028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 0, Zone: 2, fe80:0000:0000:0000:xxxx:xxxx:xxxx:xxxx [ 8028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 [ 11028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 1, Zone: 0, 2a0d:yyyy:0000:4000:yyyy:yyyy:yyyy:yyyy [ 11028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 This is linked to: espressif#6242 Signed-off-by: Denys Fedoryshchenko <[email protected]>
This patch partially depends on: espressif/esp32-arduino-lib-builder#67 Without this patch we will get only Link local IPv6 (still useful for MDNS and etc). With patch we will get also global IPv6 address by SLAAC. By default IPv6 disabled, until it is properly tested. Tested on BasicHttpClient by adding: wifiMulti.IPv6(true); before: wifiMulti.addAP() call Enabling Core Debug Level: verbose If IP6 obtained, in logs will be visible: [ 8028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 0, Zone: 2, fe80:0000:0000:0000:xxxx:xxxx:xxxx:xxxx [ 8028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 [ 11028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 1, Zone: 0, 2a0d:yyyy:0000:4000:yyyy:yyyy:yyyy:yyyy [ 11028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 This is linked to: espressif#6242 Signed-off-by: Denys Fedoryshchenko <[email protected]>
* Update header * Update IPAddress implementation to support V6 * Fix cut and paste error * Explicit not equals * Explicitly reference StreamString * Remove != test (it is causing a conflict) * IPv6 support: Add proper link-local and SLAAC in STA and WifiMulti This patch partially depends on: espressif/esp32-arduino-lib-builder#67 Without this patch we will get only Link local IPv6 (still useful for MDNS and etc). With patch we will get also global IPv6 address by SLAAC. By default IPv6 disabled, until it is properly tested. Tested on BasicHttpClient by adding: wifiMulti.IPv6(true); before: wifiMulti.addAP() call Enabling Core Debug Level: verbose If IP6 obtained, in logs will be visible: [ 8028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 0, Zone: 2, fe80:0000:0000:0000:xxxx:xxxx:xxxx:xxxx [ 8028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 [ 11028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 1, Zone: 0, 2a0d:yyyy:0000:4000:yyyy:yyyy:yyyy:yyyy [ 11028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 This is linked to: espressif#6242 Signed-off-by: Denys Fedoryshchenko <[email protected]> * Add IPv6 support to WiFiServer One of most useful features of IPv6 to have arduino accessible from internet, without any port forward and etc. Change is fairly trivial and backward compatible with old code, tested with WiFiTelnetToSerial and AsyncUDPServer. Signed-off-by: Denys Fedoryshchenko <[email protected]> * WiFiClient::remoteIP and remoteIP6 IPv6 support For RemoteIP and AF_INET6 socket i added support ip6 to ip4 mapping, so .remoteIP will return IPv4 address on dual stack socket, if available. Scenarios tested: WiFiTelnetToSerial, wifiMulti.IPv6(true), connect both from IPv4 and IPv6 WiFiTelnetToSerial, wifiMulti.IPv6(true); but set to listen on IPv4 only. WiFiTelnetToSerial, IPv6 disabled, with or without bind to specific IP4. AsyncUDPServer, without IPv6 support. Signed-off-by: Denys Fedoryshchenko <[email protected]> * Add WiFiTelnetToSerialIPv6 example To demonstrate new abilities of dual stack WiFiServer and remoteIP6 we add this example. Signed-off-by: Denys Fedoryshchenko <[email protected]> * Add IPv6 to WifiClient (client) We need to be able to connect to remote servers over IPv6 too, and thats need different approach in DNS queries and connect(). As i'm trying to keep maximum compatibility, i introduce different behaviour if IPv6 is enabled, and backward compatible (as much as possible), if IPv6 is not enabled. IN future when IPv6 functions are tested well enough, it can be simplified. This implementation tested on esp32 in following scenarios using BasicHttpClient: IPv6 true: IPv6 only website (caveat 1) - OK Website with A and AAAA is present (caveat 1) - OK IPv4 only website - OK IPv6 not enabled: IPv6 only website - wont open (expected) Website with A and AAAA is present - OK, opens over IPv4 IPv4 only website - OK caveat 1 - sometimes SLAAC is slower than DHCPv4, so we might have status WL_CONNECTED, but IPv6 global scope is not ready yet. Signed-off-by: Denys Fedoryshchenko <[email protected]> * WiFiTelnetToSerialIPv6.ino: fix obsolete remoteIP6 call to remoteIP Example contained API from previous IPv6 implementation, fixing it. Signed-off-by: Denys Fedoryshchenko <[email protected]> Signed-off-by: Denys Fedoryshchenko <[email protected]> Co-authored-by: Sly Gryphon <[email protected]> Co-authored-by: Denys Fedoryshchenko <[email protected]>
* LEDC - AnalogWrite new API + ledcAttachPin duty fix (espressif#7346) * Add enableScenes API in Rainmaker (espressif#7436) * Added enableScenes API * Added enableScenes API documentation * Added enableScenes API to example Co-authored-by: Jan Procházka <[email protected]> * How to use USBHID classes with ESP32-S2 and ESP32-S3 (espressif#7214) These instructions are based on esp32-arduino-lib-builder's build process, including https://github.com/espressif/esp32-arduino-lib-builder/blob/master/tools/update-components.sh which explains how to clone tinyusb. * Add I2C and SPI pin definitions to wt32-eth01 pins configuration (espressif#7237) * Add I2C and SPI pin definitions to wt32-eth01 pins Added missing pins based on testing using a RTC (I2C) and SD card reader (SPI). * Remove define macros Co-authored-by: Rodrigo Garcia <[email protected]> Co-authored-by: Jan Procházka <[email protected]> * Changed Rainmaker WiFi/Factory reset time. (espressif#7514) * Ipv6 support v2 * Update header * Update IPAddress implementation to support V6 * Fix cut and paste error * Explicit not equals * Explicitly reference StreamString * Remove != test (it is causing a conflict) * IPv6 support: Add proper link-local and SLAAC in STA and WifiMulti This patch partially depends on: espressif/esp32-arduino-lib-builder#67 Without this patch we will get only Link local IPv6 (still useful for MDNS and etc). With patch we will get also global IPv6 address by SLAAC. By default IPv6 disabled, until it is properly tested. Tested on BasicHttpClient by adding: wifiMulti.IPv6(true); before: wifiMulti.addAP() call Enabling Core Debug Level: verbose If IP6 obtained, in logs will be visible: [ 8028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 0, Zone: 2, fe80:0000:0000:0000:xxxx:xxxx:xxxx:xxxx [ 8028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 [ 11028][V][WiFiGeneric.cpp:380] _arduino_event_cb(): IF[0] Got IPv6: IP Index: 1, Zone: 0, 2a0d:yyyy:0000:4000:yyyy:yyyy:yyyy:yyyy [ 11028][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 8 - STA_GOT_IP6 This is linked to: espressif#6242 Signed-off-by: Denys Fedoryshchenko <[email protected]> * Add IPv6 support to WiFiServer One of most useful features of IPv6 to have arduino accessible from internet, without any port forward and etc. Change is fairly trivial and backward compatible with old code, tested with WiFiTelnetToSerial and AsyncUDPServer. Signed-off-by: Denys Fedoryshchenko <[email protected]> * WiFiClient::remoteIP and remoteIP6 IPv6 support For RemoteIP and AF_INET6 socket i added support ip6 to ip4 mapping, so .remoteIP will return IPv4 address on dual stack socket, if available. Scenarios tested: WiFiTelnetToSerial, wifiMulti.IPv6(true), connect both from IPv4 and IPv6 WiFiTelnetToSerial, wifiMulti.IPv6(true); but set to listen on IPv4 only. WiFiTelnetToSerial, IPv6 disabled, with or without bind to specific IP4. AsyncUDPServer, without IPv6 support. Signed-off-by: Denys Fedoryshchenko <[email protected]> * Add WiFiTelnetToSerialIPv6 example To demonstrate new abilities of dual stack WiFiServer and remoteIP6 we add this example. Signed-off-by: Denys Fedoryshchenko <[email protected]> * Add IPv6 to WifiClient (client) We need to be able to connect to remote servers over IPv6 too, and thats need different approach in DNS queries and connect(). As i'm trying to keep maximum compatibility, i introduce different behaviour if IPv6 is enabled, and backward compatible (as much as possible), if IPv6 is not enabled. IN future when IPv6 functions are tested well enough, it can be simplified. This implementation tested on esp32 in following scenarios using BasicHttpClient: IPv6 true: IPv6 only website (caveat 1) - OK Website with A and AAAA is present (caveat 1) - OK IPv4 only website - OK IPv6 not enabled: IPv6 only website - wont open (expected) Website with A and AAAA is present - OK, opens over IPv4 IPv4 only website - OK caveat 1 - sometimes SLAAC is slower than DHCPv4, so we might have status WL_CONNECTED, but IPv6 global scope is not ready yet. Signed-off-by: Denys Fedoryshchenko <[email protected]> * WiFiTelnetToSerialIPv6.ino: fix obsolete remoteIP6 call to remoteIP Example contained API from previous IPv6 implementation, fixing it. Signed-off-by: Denys Fedoryshchenko <[email protected]> Signed-off-by: Denys Fedoryshchenko <[email protected]> Co-authored-by: Sly Gryphon <[email protected]> Co-authored-by: Denys Fedoryshchenko <[email protected]> * Fix toString() for IPv4 * Full support for IPv6 * Full support for IPv6 * Fixed ambiguous definitions * Fix sizeof * Simplify initilization and remove memset * Enable support for IPv6 in UDP * Update PlatformIO build script PR 7579 * Fix IPv6 size Signed-off-by: Denys Fedoryshchenko <[email protected]> Co-authored-by: Jan Procházka <[email protected]> Co-authored-by: Sanket Wadekar <[email protected]> Co-authored-by: RefactorFactory <[email protected]> Co-authored-by: Sebastian Bergner <[email protected]> Co-authored-by: Rodrigo Garcia <[email protected]> Co-authored-by: Sly Gryphon <[email protected]> Co-authored-by: Denys Fedoryshchenko <[email protected]> Co-authored-by: s-hadinger <[email protected]>
So... Another year has passed. Any progress on IPv6 support for ESP32 on Arduino Environment? |
Latest PR is #7722 , it's not mine anymore, but i believe can call myself as co-author and i'm totally happy with it (it is used also in Tasmota). |
What's the status of this PR? I have been trying to get an ipv6 address for my esp32 and it doesn't work. Here's the code: #include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "ssid";
const char* password = "intentionally_removed";
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.enableIpV6();
WiFi.begin(ssid, password);
Serial.println("\nConnecting to WiFi Network...");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(100);
}
Serial.println("\nConnected to the wifi network!");
}
void loop() {
HTTPClient http;
http.begin("http://api64.ipify.org");
int httpCode = http.GET();
if (httpCode > 0) {
String payload = http.getString();
Serial.println(payload);
}
http.end();
delay(1000);
} Am I missing something? http://api64.ipify.org gives you an ipv6 address if you have one, else gives you an ipv4 address reply. When I run this code, I only get the ipv4 address and not the ipv6 one. |
Hello, this should be solved by this PR: #9016 Please give it a try, if needed you can reopen this ticket. |
Related area
tcp/ip stack
Hardware specification
any
Is your feature request related to a problem?
IPv6 support for IoT
Describe the solution you'd like
I want to create issue where i can track esp32 ipv6 readiness, ask questions regarding code and propose patches.
First question i have:
libraries/WiFi/src/WiFiGeneric.cpp
function
esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event)
event ARDUINO_EVENT_WIFI_STA_CONNECTED
any particular reason why this line commented?
esp_netif_create_ip6_linklocal(esp_netifs[ESP_IF_WIFI_STA]);
Having it uncommented brings at least local IPv6 support.
I think if it might bring compatibility issues, i can send PR that will add some flag in wifi struct, which user can set to enable ipv6.
For user it will look something like:
Describe alternatives you've considered
No response
Additional context
No response
I have checked existing list of Feature requests and the Contribution Guide
The text was updated successfully, but these errors were encountered: