[pkg-ntp-maintainers] Bug#483174: ntpdate does not seem to prefer AAAA over A records when resolving host names

Jochen Antesberger jochen-debianbugs at ozark.de
Tue Jun 24 17:09:09 UTC 2008


Peter Eisentraut wrote:
> Jochen Antesberger wrote:
>> I noticed that ntpdate somewhat randomly connects to my ntpd by either
>> IPv6 or V4, instead of prefering IPv6 when availabe. I guess it just
>> gets the DNS records in random order and/or selects one randomly. That
>> is probably desired within one address family (RR records) but it
>> should keep AAAA and A apart and do the random selection from each
>> group. IPv6 should be preferred of course to facilitate the
>> transition, just as it is done by most IPv6 aware applications.
> 
> Which IP address is returned from name resolution is decided somewhere between 
> your C library and the DNS server.  You should probably start debugging this 
> elsewhere.  I doubt ntpdate is at fault, especially so since the results are 
> random rather than only of one kind.

AFAIK if the result of the query has many IP addresses the name server
will return them in random order. It's up to the application to decide
if a specific one should be picked. I probably didn't express myself
clearly. If there are AAAA records amongst the results they should be
prefered. 

Anyway, I was looking at the source of ntpdate and I think my reasoning
doesn't apply here. I'm not a programmer, I have only basic C knowledge,
so my analysis here might be wrong:
I originally thought ntpdate will just randomly pick one IP from the
hostname(s) given to it and then retrieve the time. Well, kind of but
not quite. It resolves every hostname given and adds the IPs to a list
of servers. One hostname can result in many IPs, e.g. pool.ntp.org. It
then contacts all of them to determine which one is the best choice
(latency, stratum, etc) and then does its business. 

In my case the hostname represents one single host, but returns one A
and one AAAA record which ntpdate treats like two servers and then picks
one of them. I guess varying latency while testing both addresses then
leads to picking either v4 or v6 (transatlantic VPN connection). 

Due to how ntpdate is working I think the general rule to prefer AAAA
does not apply here and I recommend to close this bug. Sorry for the noise. 

Jochen





More information about the pkg-ntp-maintainers mailing list