]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: don't capture TX timestamps if clientlog is disabled
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 18 Oct 2021 09:29:58 +0000 (11:29 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 19 Oct 2021 13:15:46 +0000 (15:15 +0200)
When responding to a request, don't waste time with TX timestamping
if the timestamp will not be saved (i.e. clientlog is disabled).

Fixes: 5f4cbaab7e0e ("ntp: optimize detection of clients using interleaved mode")
ntp_core.c

index 0a5cd4470d7c0c5f0c7a49ead0b1eed96ffdacdf..7991299558b5c631ddb81ceb6b18ec97648917d5 100644 (file)
@@ -2125,7 +2125,7 @@ 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 && message->originate_ts.lo & htonl(1) &&
+  if (kod == 0 && log_index >= 0 && 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;