Merge pull request #17351 from s-hadinger/fix_dns_ipv4

Fix IPv4 DNS resolution when IPv6 is enabled
This commit is contained in:
s-hadinger 2022-12-11 19:54:42 +01:00 committed by GitHub
commit d83119897e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -893,6 +893,7 @@ bool WifiHostByName(const char* aHostname, IPAddress& aResult) {
}
#else
// DnsClient can't do one-shot mDNS queries so use WiFi.hostByName() for *.local
aResult = (uint32_t) 0x00000000L; // indirectly force to be IPv4, since the client touches the binary format later
size_t hostname_len = strlen(aHostname);
if (strstr_P(aHostname, PSTR(".local")) == &aHostname[hostname_len] - 6) {
if (WiFi.hostByName(aHostname, aResult)) {