]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
cmdmon: add good responses to ntpdata report
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 18 Aug 2022 09:59:40 +0000 (11:59 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 18 Aug 2022 09:59:40 +0000 (11:59 +0200)
candm.h
client.c
cmdmon.c
doc/chronyc.adoc
ntp_core.c
reports.h
test/simulation/110-chronyc
test/system/007-cmdmon

diff --git a/candm.h b/candm.h
index a0e14b41067f476694201e36e25c82104a343623..30718282f3e443bc8647926397ff25c3258509e5 100644 (file)
--- a/candm.h
+++ b/candm.h
@@ -734,7 +734,8 @@ typedef struct {
   uint32_t total_tx_count;
   uint32_t total_rx_count;
   uint32_t total_valid_count;
-  uint32_t reserved[4];
+  uint32_t total_good_count;
+  uint32_t reserved[3];
   int32_t EOR;
 } RPY_NTPData;
 
index 60819c295eb2dd7c2fe0dbabe830b43d92020b7d..d4f78743e978d6875458cbdcd01880c41afdb193 100644 (file)
--- a/client.c
+++ b/client.c
@@ -2346,7 +2346,8 @@ process_cmd_ntpdata(char *line)
                  "RX timestamping : %N\n"
                  "Total TX        : %U\n"
                  "Total RX        : %U\n"
-                 "Total valid RX  : %U\n",
+                 "Total valid RX  : %U\n"
+                 "Total good RX   : %U\n",
                  UTI_IPToString(&remote_addr), (unsigned long)UTI_IPToRefid(&remote_addr),
                  ntohs(reply.data.ntp_data.remote_port),
                  UTI_IPToString(&local_addr), (unsigned long)UTI_IPToRefid(&local_addr),
@@ -2374,6 +2375,7 @@ process_cmd_ntpdata(char *line)
                  (unsigned long)ntohl(reply.data.ntp_data.total_tx_count),
                  (unsigned long)ntohl(reply.data.ntp_data.total_rx_count),
                  (unsigned long)ntohl(reply.data.ntp_data.total_valid_count),
+                 (unsigned long)ntohl(reply.data.ntp_data.total_good_count),
                  REPORT_END);
   }
 
index ec0c71f5240072413d3d831a950b8b6afb44154c..e48a2fc167c3851545d326e7c4388f979373a4ce 100644 (file)
--- a/cmdmon.c
+++ b/cmdmon.c
@@ -1224,6 +1224,7 @@ handle_ntp_data(CMD_Request *rx_message, CMD_Reply *tx_message)
   tx_message->data.ntp_data.total_tx_count = htonl(report.total_tx_count);
   tx_message->data.ntp_data.total_rx_count = htonl(report.total_rx_count);
   tx_message->data.ntp_data.total_valid_count = htonl(report.total_valid_count);
+  tx_message->data.ntp_data.total_good_count = htonl(report.total_good_count);
   memset(tx_message->data.ntp_data.reserved, 0xff, sizeof (tx_message->data.ntp_data.reserved));
 }
 
index fd393a4674f8d43c8af7d80fc2baaff73e0d273e..1eaf21f62f9b508eaf16c4d2ecc06a4a10b66a94 100644 (file)
@@ -662,6 +662,7 @@ RX timestamping : Kernel
 Total TX        : 24
 Total RX        : 24
 Total valid RX  : 24
+Total good RX   : 22
 ----
 +
 The fields are explained as follows:
@@ -715,7 +716,10 @@ The number of packets sent to the source.
 *Total RX*:::
 The number of all packets received from the source.
 *Total valid RX*:::
-The number of valid packets received from the source.
+The number of packets which passed the first two groups of NTP tests.
+*Total good RX*:::
+The number of packets which passed all three groups of NTP tests, i.e. the NTP
+measurement was accepted.
 
 [[add_peer]]*add peer* _name_ [_option_]...::
 The *add peer* command allows a new NTP peer to be added whilst
index ed06ba743209bbed0f2ee8b567385bf2bcf6788e..b37f579e8316f4d6980b9e78c55ef7d3aa230363 100644 (file)
@@ -2216,6 +2216,8 @@ process_response(NCR_Instance inst, NTP_Local_Address *local_addr,
     inst->report.rx_tss_char = tss_chars[local_receive.source];
 
     inst->report.total_valid_count++;
+    if (good_packet)
+      inst->report.total_good_count++;
   }
 
   /* Do measurement logging */
index c403c2395bee2adfe937785ab80b408a53b406a2..6674dd9143f614bf09ff076114afe3c5e587451e 100644 (file)
--- a/reports.h
+++ b/reports.h
@@ -174,6 +174,7 @@ typedef struct {
   uint32_t total_tx_count;
   uint32_t total_rx_count;
   uint32_t total_valid_count;
+  uint32_t total_good_count;
 } RPT_NTPReport;
 
 typedef struct {
index 9ddf95e38d13c14b7918c1195cb136104c45b40c..b78f0d84561dddafbb5ee84e7d769983a5e50a3e 100755 (executable)
@@ -231,6 +231,7 @@ RX timestamping : Kernel
 Total TX        : 1
 Total RX        : 1
 Total valid RX  : 1
+Total good RX   : 0
 S Name/IP Address        Auth COpts EOpts Last Score     Interval  Leap
 =======================================================================
 M node1\.net1\.clk            N ----- -----    0   1\.0    \+0ns    \+0ns  N
index a5931d6357703c8472669fe795b781e275dbf486..04d14c2dcee9b30abf6b06d08f2c551c65ce5d45 100755 (executable)
@@ -95,7 +95,8 @@ TX timestamping : (Daemon|Kernel)
 RX timestamping : (Daemon|Kernel)
 Total TX        : [0-9]+
 Total RX        : [0-9]+
-Total valid RX  : [0-9]+$" || test_fail
+Total valid RX  : [0-9]+
+Total good RX   : [0-9]+$" || test_fail
 
 run_chronyc "selectdata" || test_fail
 check_chronyc_output "^S Name/IP Address        Auth COpts EOpts Last Score     Interval  Leap