IOS: Use first available IPv4 nameserver
This commit is contained in:
parent
57750f3d8f
commit
a2530e3b93
|
@ -868,10 +868,23 @@ IPCReply NetIPTopDevice::HandleGetInterfaceOptRequest(const IOCtlVRequest& reque
|
||||||
if (!Core::WantsDeterminism())
|
if (!Core::WantsDeterminism())
|
||||||
{
|
{
|
||||||
if (res_init() == 0)
|
if (res_init() == 0)
|
||||||
address = ntohl(_res.nsaddr_list[0].sin_addr.s_addr);
|
{
|
||||||
|
for (int i = 0; i < _res.nscount; i++)
|
||||||
|
{
|
||||||
|
// Find the first available IPv4 nameserver.
|
||||||
|
sockaddr_in current = _res.nsaddr_list[i];
|
||||||
|
if (current.sin_family == AF_INET)
|
||||||
|
{
|
||||||
|
address = ntohl(_res.nsaddr_list[i].sin_addr.s_addr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
WARN_LOG_FMT(IOS_NET, "Call to res_init failed");
|
WARN_LOG_FMT(IOS_NET, "Call to res_init failed");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (address == 0)
|
if (address == 0)
|
||||||
address = default_main_dns_resolver;
|
address = default_main_dns_resolver;
|
||||||
|
|
Loading…
Reference in New Issue