Le primidi 11 fructidor, an CCXII, Cord Beermann a écrit :
> After restarting i see in 'ntpq -p' three times the same server from
> that DNS-RR.
> 
> If that should be reliable i'd expect that i'll get three different
> Servers from that DNS-RR.

The following trivial patch forces ntpd to add some randomness to its choice
of the remote IP address:

--- ntpd/ntp_config.c.orig      2005-12-22 01:12:06.575611744 +0100
+++ ntpd/ntp_config.c   2005-12-22 01:12:41.252340080 +0100
@@ -2101,6 +2101,17 @@
                return 0;
        }
 
+       {
+               struct addrinfo *p;
+               int n = 0;
+               for(p = ptr; p != NULL; p = p->ai_next)
+                       n++;
+               if(n > 0) {
+                       for(n = rand() % n; n > 0; n--)
+                               ptr = ptr->ai_next;
+               }
+
+       }
        memcpy(addr, ptr->ai_addr, ptr->ai_addrlen);
 #ifdef DEBUG
        if (debug > 1)


It is probably not suitable for inclusion as is, because it does not address
the real problem, but it can be useful to someone.

Note: there is a recommanded workaround:

server 0.XX.pool.ntp.org
server 1.XX.pool.ntp.org
server 2.XX.pool.ntp.org

Unfortunately, the three of them happen to be krishna.via.ecp.fr as first
result more often than reasonable. Thus the patch.

Attachment: signature.asc
Description: Digital signature

Reply via email to