Skip to content

Commit bd41334

Browse files
committed
Fix ETH not enabling DHCP when configured with INADDR_NONE
Fixes: #4778
1 parent 9a0762a commit bd41334

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: libraries/WiFi/src/ETH.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ bool ETHClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, I
118118
esp_err_t err = ESP_OK;
119119
tcpip_adapter_ip_info_t info;
120120

121-
if(local_ip != (uint32_t)0x00000000){
121+
if(local_ip != (uint32_t)0x00000000 && local_ip != INADDR_NONE){
122122
info.ip.addr = static_cast<uint32_t>(local_ip);
123123
info.gw.addr = static_cast<uint32_t>(gateway);
124124
info.netmask.addr = static_cast<uint32_t>(subnet);
@@ -153,13 +153,13 @@ bool ETHClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, I
153153
ip_addr_t d;
154154
d.type = IPADDR_TYPE_V4;
155155

156-
if(dns1 != (uint32_t)0x00000000) {
156+
if(dns1 != (uint32_t)0x00000000 && dns1 != INADDR_NONE) {
157157
// Set DNS1-Server
158158
d.u_addr.ip4.addr = static_cast<uint32_t>(dns1);
159159
dns_setserver(0, &d);
160160
}
161161

162-
if(dns2 != (uint32_t)0x00000000) {
162+
if(dns2 != (uint32_t)0x00000000 && dns2 != INADDR_NONE) {
163163
// Set DNS2-Server
164164
d.u_addr.ip4.addr = static_cast<uint32_t>(dns2);
165165
dns_setserver(1, &d);

0 commit comments

Comments
 (0)