mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #3161 from geky/nsapi-dns-version-heuristic
nsapi - Add better heuristic for the default record of DNS queriespull/3184/head
commit
7829b2f9bf
|
@ -33,6 +33,15 @@ int NetworkStack::gethostbyname(const char *name, SocketAddress *address, nsapi_
|
|||
return 0;
|
||||
}
|
||||
|
||||
// if the version is unspecified, try to guess the version from the
|
||||
// ip address of the underlying stack
|
||||
if (version == NSAPI_UNSPEC) {
|
||||
SocketAddress testaddress;
|
||||
if (testaddress.set_ip_address(this->get_ip_address())) {
|
||||
version = testaddress.get_ip_version();
|
||||
}
|
||||
}
|
||||
|
||||
return nsapi_dns_query(this, name, address, version);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue