mirror of
https://frontier.innolan.net/rainlance/c-ares.git
synced 2025-10-05 23:49:38 +00:00
Fixing slow DNS lookup issue
This patch is fixing the dns lookup issue due to dummy dns information of a disconnected adapter(in my case is a bluetooth adapter). I changed the dns lookup policy to try GetNetworkParams first because the GetNetworkParams provides the most reliable dns information (lots of checks were done by system). I also filter out inoperable adapter in DNS_AdaptersAddresses in case GetNetworkParams fail.
This commit is contained in:
17
ares_init.c
17
ares_init.c
@ -983,6 +983,9 @@ static int get_DNS_AdaptersAddresses(char **outptr)
|
||||
|
||||
for (ipaaEntry = ipaa; ipaaEntry; ipaaEntry = ipaaEntry->Next)
|
||||
{
|
||||
if(ipaaEntry->OperStatus != IfOperStatusUp)
|
||||
continue;
|
||||
|
||||
for (ipaDNSAddr = ipaaEntry->FirstDnsServerAddress;
|
||||
ipaDNSAddr;
|
||||
ipaDNSAddr = ipaDNSAddr->Next)
|
||||
@ -1043,14 +1046,20 @@ done:
|
||||
*/
|
||||
static int get_DNS_Windows(char **outptr)
|
||||
{
|
||||
/* Try using IP helper API GetAdaptersAddresses() */
|
||||
if (get_DNS_AdaptersAddresses(outptr))
|
||||
return 1;
|
||||
|
||||
/*
|
||||
Use GetNetworkParams First in case of
|
||||
multiple adapter is enabled on this machine.
|
||||
GetAdaptersAddresses will retrive dummy dns servers.
|
||||
That will slowing DNS lookup.
|
||||
*/
|
||||
/* Try using IP helper API GetNetworkParams() */
|
||||
if (get_DNS_NetworkParams(outptr))
|
||||
return 1;
|
||||
|
||||
/* Try using IP helper API GetAdaptersAddresses() */
|
||||
if (get_DNS_AdaptersAddresses(outptr))
|
||||
return 1;
|
||||
|
||||
/* Fall-back to registry information */
|
||||
return get_DNS_Registry(outptr);
|
||||
}
|
||||
|
Reference in New Issue
Block a user