]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: limit interleaved responses to NTPv4
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 22 Nov 2021 15:33:46 +0000 (16:33 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 22 Nov 2021 16:02:49 +0000 (17:02 +0100)
The interleaved modes are being specified for NTPv4 only. As a server,
detect interleaved requests only in NTPv4 packets.

Clients and peers can still send interleaved requests in lower-version
packets if configured with the version option.

ntp_core.c

index fa2d5b25a9f2bdc118a7a7a3ab6c6acec4b3d79c..a0ed65101c06a8764ac752f7b9aee0a74a25d6d1 100644 (file)
@@ -2395,7 +2395,8 @@ NCR_ProcessRxUnknown(NTP_Remote_Address *remote_addr, NTP_Local_Address *local_a
      transmit timestamp (this is verified in transmit_packet()).  For a new
      client starting with a zero origin timestamp, the third response is the
      earliest one that can be interleaved. */
-  if (kod == 0 && log_index >= 0 && message->originate_ts.lo & htonl(1) &&
+  if (kod == 0 && log_index >= 0 && info.version == 4 &&
+      message->originate_ts.lo & htonl(1) &&
       UTI_CompareNtp64(&message->receive_ts, &message->transmit_ts) != 0) {
     ntp_rx = message->originate_ts;
     local_ntp_rx = &ntp_rx;