Subject: DNS servers on windows

DNS servers on windows

From: Patrick Valsecchi <pvalsecc_at_cisco.com>
Date: Fri, 19 Apr 2013 14:40:23 +0200

Hi,

I have a lot of trouble using c-ares on one of my windows boxes.

The machine has two interfaces:
   1) configured with a static IP address and it has DNS in automatic
mode, but doesn't find any.
   2) configured by DHCP and it receives a valid DNS interface

My problem is that windows (at least 7), in all it's glory, invents DNS
addesses for my first interface with 3 addresses taken from an outdated
draft RFC [1]. And for some reasons, it shows them multiple times when
GetAdaptersAddresses is called.

So I end up with 13 DNS server addresses:

  * fec0:0:0:ffff::1
  * fec0:0:0:ffff::2
  * fec0:0:0:ffff::3
  * 10.104.48.2 <- my actual server
  * fec0:0:0:ffff::1
  * fec0:0:0:ffff::2
  * fec0:0:0:ffff::3
  * 10.104.48.2
  * fec0:0:0:ffff::1
  * fec0:0:0:ffff::2
  * fec0:0:0:ffff::3

c-ares doesn't behave very well with such setup. At each query, it will
start over with the first server, wait for a timeout of 5 seconds and
then try the second one, ... . So I have to wait 15s for each query to
complete.

My first suggestion would be to apply this patch in order to remember
the last good server and start from this one afterwards:
diff --git a/c-ares/ares_process.c b/c-ares/ares_process.c
--- a/c-ares/ares_process.c
+++ b/c-ares/ares_process.c
@@ -622,6 +622,8 @@
          }
      }

+ if (channel->rotate != 1)
+ channel->last_server = whichserver;
    end_query(channel, query, ARES_SUCCESS, abuf, alen);
  }

Then I'd suggest to sort the servers in the ares_channel and put the
fec0:: ones at the end.

What do you think?

[1] http://tools.ietf.org/id/draft-ietf-ipngwg-dns-discovery-03.txt
Received on 2013-04-19