From da7ffdaa282d3e8de27073c86e2b2c4b9fbf8e2f Mon Sep 17 00:00:00 2001 From: david gauchard Date: Wed, 26 Dec 2018 15:01:48 +0100 Subject: [PATCH] add 1 more IPAddress constructor for IPv6 (#5551) --- cores/esp8266/IPAddress.cpp | 5 +++++ cores/esp8266/IPAddress.h | 2 ++ libraries/ESP8266WiFi/examples/IPv6/IPv6.ino | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cores/esp8266/IPAddress.cpp b/cores/esp8266/IPAddress.cpp index d121ba6e53..7163517c50 100644 --- a/cores/esp8266/IPAddress.cpp +++ b/cores/esp8266/IPAddress.cpp @@ -187,6 +187,11 @@ const IPAddress INADDR_NONE(255,255,255,255); #if LWIP_IPV6 +IPAddress::IPAddress(const ip_addr_t* from) +{ + ip_addr_copy(_ip, *from); +} + bool IPAddress::fromString6(const char *address) { // TODO: test test test diff --git a/cores/esp8266/IPAddress.h b/cores/esp8266/IPAddress.h index cad12c970e..74c6cd3756 100644 --- a/cores/esp8266/IPAddress.h +++ b/cores/esp8266/IPAddress.h @@ -163,6 +163,8 @@ class IPAddress: public Printable { #if LWIP_IPV6 + IPAddress(const ip_addr_t* from); + uint16_t* raw6() { setV6(); diff --git a/libraries/ESP8266WiFi/examples/IPv6/IPv6.ino b/libraries/ESP8266WiFi/examples/IPv6/IPv6.ino index eccb30ad1d..be9a3a28ed 100644 --- a/libraries/ESP8266WiFi/examples/IPv6/IPv6.ino +++ b/libraries/ESP8266WiFi/examples/IPv6/IPv6.ino @@ -98,7 +98,11 @@ void setup() { Serial.println(); Serial.println(ESP.getFullVersion()); - Serial.printf("IPV6 is%s enabled\n", LWIP_IPV6 ? emptyString.c_str() : " NOT"); +#if LWIP_IPV6 + Serial.printf("IPV6 is enabled\n"); +#else + Serial.printf("IPV6 is not enabled\n"); +#endif WiFi.mode(WIFI_STA); WiFi.begin(STASSID, STAPSK);