IOS: Use first available IPv4 nameserver
This commit is contained in:
parent
57750f3d8f
commit
a2530e3b93
|
@ -868,9 +868,22 @@ IPCReply NetIPTopDevice::HandleGetInterfaceOptRequest(const IOCtlVRequest& reque
|
|||
if (!Core::WantsDeterminism())
|
||||
{
|
||||
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
|
||||
{
|
||||
WARN_LOG_FMT(IOS_NET, "Call to res_init failed");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (address == 0)
|
||||
|
|
Loading…
Reference in New Issue