diff --git a/libraries/WiFi/src/ETH.cpp b/libraries/WiFi/src/ETH.cpp index 2ffea758ded..d3ee9a670e4 100644 --- a/libraries/WiFi/src/ETH.cpp +++ b/libraries/WiFi/src/ETH.cpp @@ -193,8 +193,8 @@ IPAddress ETHClass::gatewayIP() IPAddress ETHClass::dnsIP(uint8_t dns_no) { - ip_addr_t dns_ip = dns_getserver(dns_no); - return IPAddress(dns_ip.u_addr.ip4.addr); + const ip_addr_t* dns_ip = dns_getserver(dns_no); + return IPAddress(dns_ip->u_addr.ip4.addr); } IPAddress ETHClass::broadcastIP() diff --git a/libraries/WiFi/src/WiFiSTA.cpp b/libraries/WiFi/src/WiFiSTA.cpp index 45e55ce21de..a1da8a874a9 100644 --- a/libraries/WiFi/src/WiFiSTA.cpp +++ b/libraries/WiFi/src/WiFiSTA.cpp @@ -488,8 +488,8 @@ IPAddress WiFiSTAClass::dnsIP(uint8_t dns_no) if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ return IPAddress(); } - ip_addr_t dns_ip = dns_getserver(dns_no); - return IPAddress(dns_ip.u_addr.ip4.addr); + const ip_addr_t* dns_ip = dns_getserver(dns_no); + return IPAddress(dns_ip->u_addr.ip4.addr); } /**