Extend fix #17619 to non-IPv6 (#17621)

This commit is contained in:
s-hadinger 2023-01-06 19:03:07 +01:00 committed by GitHub
parent edc7cd5bc3
commit 5e89578403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -756,7 +756,6 @@ String IPForUrl(const IPAddress & ip)
// IPv4 has always priority
// Copy the value of the IP if pointer provided (optional)
bool WifiGetIP(IPAddress *ip) {
#ifdef USE_IPV6
if ((uint32_t)WiFi.localIP() != 0) {
if (ip != nullptr) { *ip = WiFi.localIP(); }
return true;
@ -765,18 +764,15 @@ bool WifiGetIP(IPAddress *ip) {
if (ip != nullptr) { *ip = WiFi.softAPIP(); }
return true;
}
#ifdef USE_IPV6
IPAddress lip;
if (WifiGetIPv6(&lip)) {
if (ip != nullptr) { *ip = lip; }
return true;
}
if (ip != nullptr) { *ip = IPAddress(); }
return false;
#else
// IPv4 only
if (ip != nullptr) { *ip = WiFi.localIP(); }
return (uint32_t)WiFi.localIP() != 0;
#endif // USE_IPV6
return false;
}
bool WifiHasIP(void) {