From: Miroslav Lichvar Date: Mon, 5 Mar 2018 09:15:42 +0000 (+0100) Subject: ntp: check RX and TX timestamp in interleaved client requests X-Git-Tag: 3.3-pre1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6dd74968766587b41b73a3e1f0fed1f70af0449;p=thirdparty%2Fchrony.git ntp: check RX and TX timestamp in interleaved client requests 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. --- diff --git a/ntp_core.c b/ntp_core.c index db8f7b9d..73d3c215 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -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);