8000 Fix WiFi STA config IP to INADDR_NONE results in 255.255.255.255 · slavino/arduino-esp32@5de03a3 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5de03a3

Browse files
committed
Fix WiFi STA config IP to INADDR_NONE results in 255.255.255.255
Fixes: espressif#4732
1 parent 4b38569 commit 5de03a3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libraries/WiFi/src/WiFiSTA.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ bool WiFiSTAClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subne
283283
}
284284

285285
tcpip_adapter_ip_info_t info;
286+
log_d("STA IP uint32_t: %u.%u.%u.%u\n", local_ip[0], local_ip[1], local_ip[2], local_ip[3]);
286287

287-
if(local_ip != (uint32_t)0x00000000){
288+
if(local_ip != (uint32_t)0x00000000 && local_ip != INADDR_NONE){
288289
info.ip.addr = static_cast<uint32_t>(local_ip);
289290
info.gw.addr = static_cast<uint32_t>(gateway);
290291
info.netmask.addr = static_cast<uint32_t>(subnet);
@@ -320,13 +321,13 @@ bool WiFiSTAClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subne
320321
ip_addr_t d;
321322
d.type = IPADDR_TYPE_V4;
322323

323-
if(dns1 != (uint32_t)0x00000000) {
324+
if(dns1 != (uint32_t)0x00000000 && dns1 != INADDR_NONE) {
324325
// Set DNS1-Server
325326
d.u_addr.ip4.addr = static_cast<uint32_t>(dns1);
326327
dns_setserver(0, &d);
327328
}
328329

329-
if(dns2 != (uint32_t)0x00000000) {
330+
if(dns2 != (uint32_t)0x00000000 && dns2 != INADDR_NONE) {
330331
// Set DNS2-Server
331332
d.u_addr.ip4.addr = static_cast<uint32_t>(dns2);
332333
dns_setserver(1, &d);

0 commit comments

Comments
 (0)
0