1
0
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:
Lei Shi
2014-05-22 13:43:53 +08:00
committed by David Drysdale
parent fe34a70d6a
commit 52ecef76df

View File

@ -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);
}