Fix WiFi STA config IP to INADDR_NONE results in 255.255.255.255
Fixes: https://github.com/espressif/arduino-esp32/issues/4732
This commit is contained in:
parent
4b385690bc
commit
5de03a3918
@ -283,8 +283,9 @@ bool WiFiSTAClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subne
|
||||
}
|
||||
|
||||
tcpip_adapter_ip_info_t info;
|
||||
log_d("STA IP uint32_t: %u.%u.%u.%u\n", local_ip[0], local_ip[1], local_ip[2], local_ip[3]);
|
||||
|
||||
if(local_ip != (uint32_t)0x00000000){
|
||||
if(local_ip != (uint32_t)0x00000000 && local_ip != INADDR_NONE){
|
||||
info.ip.addr = static_cast<uint32_t>(local_ip);
|
||||
info.gw.addr = static_cast<uint32_t>(gateway);
|
||||
info.netmask.addr = static_cast<uint32_t>(subnet);
|
||||
@ -320,13 +321,13 @@ bool WiFiSTAClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subne
|
||||
ip_addr_t d;
|
||||
d.type = IPADDR_TYPE_V4;
|
||||
|
||||
if(dns1 != (uint32_t)0x00000000) {
|
||||
if(dns1 != (uint32_t)0x00000000 && dns1 != INADDR_NONE) {
|
||||
// Set DNS1-Server
|
||||
d.u_addr.ip4.addr = static_cast<uint32_t>(dns1);
|
||||
dns_setserver(0, &d);
|
||||
}
|
||||
|
||||
if(dns2 != (uint32_t)0x00000000) {
|
||||
if(dns2 != (uint32_t)0x00000000 && dns2 != INADDR_NONE) {
|
||||
// Set DNS2-Server
|
||||
d.u_addr.ip4.addr = static_cast<uint32_t>(dns2);
|
||||
dns_setserver(1, &d);
|
||||
|
Loading…
Reference in New Issue
Block a user