Subject: c-ares patch

c-ares patch

From: David Stuart <dstuart_at_counterpath.com>
Date: Tue, 8 Jan 2013 13:04:32 -0500

Hello,

In the method "get_iphlpapi_dns_info" inside of "ares_init.c", instead
of this:

    /* process the results */
    for( pEntry = pFirstEntry ; pEntry != NULL ; pEntry = pEntry->Next )
    {
      IP_ADAPTER_DNS_SERVER_ADDRESS* pDNSAddr = pEntry->FirstDnsServerAddress;
      for( ; pDNSAddr != NULL ; pDNSAddr = pDNSAddr->Next )
      {
        struct sockaddr *pGenericAddr = pDNSAddr->Address.lpSockaddr;
        int stringlen = 0;

Shouldn't it be:

    /* process the results */
    for( pEntry = pFirstEntry ; pEntry != NULL ; pEntry = pEntry->Next )
    {
      IP_ADAPTER_DNS_SERVER_ADDRESS* pDNSAddr = NULL;
      if( pEntry->OperStatus != IfOperStatusUp )
         continue;

      pDNSAddr = pEntry->FirstDnsServerAddress;
      for( ; pDNSAddr != NULL ; pDNSAddr = pDNSAddr->Next )
      {
        struct sockaddr *pGenericAddr = pDNSAddr->Address.lpSockaddr;
        int stringlen = 0;

We have a customer complaining about enabled (but not connected)
interfaces being used for their DNS configuration, and I suspect this
might be the culprit.

Any comments?

David

-- 
David Stuart, CounterPath
Email: dstuart (at) counterpath (dot) com
Phone: (613) 254-8886 x2234  Web: http://www.counterpath.com/
Address: 310 - 350 Terry Fox Drive, Kanata Ontario, K2K 2P5
Received on 2013-01-08