]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: fix authenticated requests in serverstats
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 8 Jan 2024 10:35:56 +0000 (11:35 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 8 Jan 2024 10:46:32 +0000 (11:46 +0100)
Fix the CLG_UpdateNtpStats() call to count requests passing the
authentication check instead of requests triggering a KoD response
(i.e. NTS NAK).

ntp_core.c
test/system/010-nts

index 023e60b24c2185efec08a99801fae2ecf207b3c9..35801744a1e543fd6baf7011931c29e61935be10 100644 (file)
@@ -2736,7 +2736,7 @@ NCR_ProcessRxUnknown(NTP_Remote_Address *remote_addr, NTP_Local_Address *local_a
       CLG_DisableNtpTimestamps(&ntp_rx);
   }
 
-  CLG_UpdateNtpStats(kod != 0 && info.auth.mode != NTP_AUTH_NONE &&
+  CLG_UpdateNtpStats(kod == 0 && info.auth.mode != NTP_AUTH_NONE &&
                      info.auth.mode != NTP_AUTH_MSSNTP,
                      rx_ts->source, interleaved ? tx_ts->source : NTP_TS_DAEMON);
 
index 8d92bbc8495aba759b768ba9f1bb663d16026b7d..b215efa38df7ffd6a525ea81ff5ebbfb74da4092 100755 (executable)
@@ -45,6 +45,11 @@ check_chronyc_output "^Name/IP address             Mode KeyID Type KLen Last Atm
 =========================================================================
 127\.0\.0\.1                    NTS     1   (30|15)  (128|256)    [0-9]    0    0    [78]  ( 64|100)$" || test_fail
 
+run_chronyc "serverstats" || test_fail
+check_chronyc_output "NTS-KE connections accepted: 1
+NTS-KE connections dropped : 0
+Authenticated NTP packets  : [1-9][0-9]*" || test_fail
+
 stop_chronyd || test_fail
 check_chronyd_messages || test_fail
 check_chronyd_files || test_fail