]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: check RX and TX timestamp in interleaved client requests
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 5 Mar 2018 09:15:42 +0000 (10:15 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 6 Mar 2018 12:47:25 +0000 (13:47 +0100)
Clients sending packets in the interleaved mode are supposed to use
a different receive and transmit timestamp in order to reliably detect
the mode of the response. If an interleaved request with the receive
timestamp equal to the transmit timestamp is detected, respond in the
basic mode.

ntp_core.c

index db8f7b9d0a6d007269751f194fc3e0c36e89b860..73d3c21537ad3c80d8b7331ef16ed1ddb065cd4e 100644 (file)
@@ -2129,7 +2129,8 @@ NCR_ProcessRxUnknown(NTP_Remote_Address *remote_addr, NTP_Local_Address *local_a
   if (log_index >= 0) {
     CLG_GetNtpTimestamps(log_index, &local_ntp_rx, &local_ntp_tx);
     interleaved = !UTI_IsZeroNtp64(local_ntp_rx) &&
-                  !UTI_CompareNtp64(&message->originate_ts, local_ntp_rx);
+                  !UTI_CompareNtp64(&message->originate_ts, local_ntp_rx) &&
+                  UTI_CompareNtp64(&message->receive_ts, &message->transmit_ts);
 
     if (interleaved) {
       UTI_Ntp64ToTimespec(local_ntp_tx, &local_tx.ts);