]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: don't save timestamps if transmit_packet() failed
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 25 Oct 2021 08:23:41 +0000 (10:23 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 27 Oct 2021 14:22:08 +0000 (16:22 +0200)
Don't save server RX and TX timestamp to clientlog if the transmission
or authentication failed (e.g. packet is handled in ntp_signd). They
will not be needed.

ntp_core.c

index 27348e87bf99022b1a421abc89d62b03f1ba6266..40a1f3aded56e4de50ac045c183dbf0a521f06c0 100644 (file)
@@ -2146,10 +2146,11 @@ NCR_ProcessRxUnknown(NTP_Remote_Address *remote_addr, NTP_Local_Address *local_a
   version = info.version;
 
   /* Send a reply */
-  transmit_packet(my_mode, interleaved, poll, version, kod, NULL,
-                  &message->receive_ts, &message->transmit_ts,
-                  rx_ts, tx_ts, local_ntp_rx, NULL, remote_addr, local_addr,
-                  message, &info);
+  if (!transmit_packet(my_mode, interleaved, poll, version, kod, NULL,
+                       &message->receive_ts, &message->transmit_ts,
+                       rx_ts, tx_ts, local_ntp_rx, NULL, remote_addr, local_addr,
+                       message, &info))
+    return;
 
   if (local_ntp_rx)
     CLG_SaveNtpTimestamps(local_ntp_rx, tx_ts ? &tx_ts->ts : NULL);