]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: fix poll interleaving with unsynchronised peers
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 30 Jun 2017 09:32:19 +0000 (11:32 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 30 Jun 2017 15:01:01 +0000 (17:01 +0200)
Update the remote poll and remote stratum even for unsychronised peers,
and handle stratum of 0 as 16, so the peers work with the opposite
differences between their strata and can adjust their polling intervals
in order to interleave the packets.

ntp_core.c

index fc63c68127e430c6a863808343761100d87b6bdb..115864247734bec04c03876170bbcf6a721a968f 100644 (file)
@@ -1575,9 +1575,11 @@ receive_packet(NCR_Instance inst, NTP_Local_Address *local_addr,
             !UTI_CompareTimespecs(&inst->local_rx.ts, &rx_ts->ts));
 
   if (valid_packet) {
+    inst->remote_poll = message->poll;
+    inst->remote_stratum = message->stratum != NTP_INVALID_STRATUM ?
+                           message->stratum : NTP_MAX_STRATUM;
+
     if (synced_packet) {
-      inst->remote_poll = message->poll;
-      inst->remote_stratum = message->stratum;
       inst->tx_count = 0;
       SRC_UpdateReachability(inst->source, 1);
     }