Fix IPv4 DNS resolution when IPv6 is enabled

This commit is contained in:
Stephan Hadinger 2022-12-11 16:24:14 +01:00
parent 958c41a9f6
commit 1bdb542e50
1 changed files with 3 additions and 0 deletions

View File

@ -893,6 +893,9 @@ bool WifiHostByName(const char* aHostname, IPAddress& aResult) {
}
#else
// DnsClient can't do one-shot mDNS queries so use WiFi.hostByName() for *.local
#ifdef USE_IPV6
aResult.setV4(); // force IPv4 result for now, until DNS is updated to IPv6
#endif
size_t hostname_len = strlen(aHostname);
if (strstr_P(aHostname, PSTR(".local")) == &aHostname[hostname_len] - 6) {
if (WiFi.hostByName(aHostname, aResult)) {