]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: don't check for synchronization loop in special reference modes
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 12 May 2016 13:43:42 +0000 (15:43 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 13 May 2016 11:47:12 +0000 (13:47 +0200)
If a special reference mode is enabled, always pass the test for
synchronization loop. This allows chronyd using the initstepslew
directive (or the -q/-Q option) to accept time from its own clients
after restart as is documented in the chrony.conf man page.

This was broken since update to NTPv4.

ntp_core.c

index 3d3a61236ed0cb592d17971ac4ffbbdc3976239b..79426937d405cfa796fc523da9966d4f5378f54f 100644 (file)
@@ -1348,7 +1348,8 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
 
     /* Test D requires that the remote peer is not synchronised to us to
        prevent a synchronisation loop */
-    testD = message->stratum <= 1 || pkt_refid != UTI_IPToRefid(&local_addr->ip_addr);
+    testD = message->stratum <= 1 || REF_GetMode() != REF_ModeNormal ||
+            pkt_refid != UTI_IPToRefid(&local_addr->ip_addr);
   } else {
     offset = delay = dispersion = 0.0;
     sample_time = *now;