Skip to content

Commit da7ffda

Browse files
authored
add 1 more IPAddress constructor for IPv6 (#5551)
1 parent 8049543 commit da7ffda

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

Diff for: cores/esp8266/IPAddress.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ const IPAddress INADDR_NONE(255,255,255,255);
187187

188188
#if LWIP_IPV6
189189

190+
IPAddress::IPAddress(const ip_addr_t* from)
191+
{
192+
ip_addr_copy(_ip, *from);
193+
}
194+
190195
bool IPAddress::fromString6(const char *address) {
191196
// TODO: test test test
192197

Diff for: cores/esp8266/IPAddress.h

+2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ class IPAddress: public Printable {
163163

164164
#if LWIP_IPV6
165165

166+
IPAddress(const ip_addr_t* from);
167+
166168
uint16_t* raw6()
167169
{
168170
setV6();

Diff for: libraries/ESP8266WiFi/examples/IPv6/IPv6.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ void setup() {
9898
Serial.println();
9999
Serial.println(ESP.getFullVersion());
100100

101-
Serial.printf("IPV6 is%s enabled\n", LWIP_IPV6 ? emptyString.c_str() : " NOT");
101+
#if LWIP_IPV6
102+
Serial.printf("IPV6 is enabled\n");
103+
#else
104+
Serial.printf("IPV6 is not enabled\n");
105+
#endif
102106

103107
WiFi.mode(WIFI_STA);
104108
WiFi.begin(STASSID, STAPSK);

0 commit comments

Comments
 (0)