diff --git a/cores/esp8266/LwipIntfDev.h b/cores/esp8266/LwipIntfDev.h index 389376c976..bf650f273d 100644 --- a/cores/esp8266/LwipIntfDev.h +++ b/cores/esp8266/LwipIntfDev.h @@ -74,6 +74,13 @@ class LwipIntfDev: public LwipIntf, public RawDev return &_netif; } + uint8_t* macAddress(uint8_t* mac) { // WiFi lib way + memcpy(mac, &_netif.hwaddr, 6); + return mac; + } + void MACAddress(uint8_t* mac) { // Ethernet lib way + macAddress(mac); + } IPAddress localIP() const { return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.ip_addr))); @@ -86,6 +93,29 @@ class LwipIntfDev: public LwipIntf, public RawDev { return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.gw))); } + IPAddress dnsIP(int n) const // WiFi lib way + { + return IPAddress(dns_getserver(n)); + } + IPAddress dnsServerIP() const // Ethernet lib way + { + return dnsIP(0); + } + void setDNS(IPAddress dns1, IPAddress dns2 = (uint32_t)0x00000000) // WiFi lib way + { + if (dns1.isSet()) + { + dns_setserver(0, dns1); + } + if (dns2.isSet()) + { + dns_setserver(1, dns2); + } + } + void setDnsServerIP(const IPAddress dnsIP) // Ethernet lib way + { + setDNS(dnsIP); + } // 1. Currently when no default is set, esp8266-Arduino uses the first // DHCP client interface receiving a valid address and gateway to