Re: [chrony-users] DNS RR and chrony

[ Thread Index | Date Index | More Archives ]

On Wed, Feb 24, 2016 at 04:18:36PM +0100, Ben Kochie wrote:
> The end result here is that getaddrinfo() always sorts the output of IPv4
> results and chrony will pick the first N in that list.  For example I have
> a DNS record internally that has 8 servers, and I have chrony pick 4.
> Every node has the same identical 4 node list instead of a random sampling
> of the 4.

Do the addresses have the same scope and type? I think getaddrinfo()
is supposed to sort only by that and not the actual addresses. With
glibc the precedence can be configured in gai.conf(5). If the
addresses have the same precedence, the order should be as was
received from the DNS server.

I suspect the problem you see is rather due to the way chronyd starts
polling NTP sources. With the pool directive, all addresses (up to 16)
are added as sources and the first four that respond are kept. But the
order in which they are polled depends on how they are sorted in a
hash table. Even if the sources are added to the hash table in a
random order, they will end up in the same slots (assuming there are
no collisions) and will be polled in the same order.

In order to fix that, I guess we need to either modify the hash
function to include some random variable initialized on start to make
the hashing random, or schedule the first poll of the sources in a
random order.

As a workaround you could try four server directives using the same
hostname instead of one pool. With that, the selection of the servers
should depend on getaddrinfo() and not the hashing.

Miroslav Lichvar

To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.

Mail converted by MHonArc 2.6.19+