diff --git a/candm.h b/candm.h index a0e14b4..3071828 100644 --- 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; diff --git a/client.c b/client.c index 60819c2..d4f7874 100644 --- 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); } diff --git a/cmdmon.c b/cmdmon.c index ec0c71f..e48a2fc 100644 --- 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)); } diff --git a/doc/chronyc.adoc b/doc/chronyc.adoc index fd393a4..1eaf21f 100644 --- a/doc/chronyc.adoc +++ b/doc/chronyc.adoc @@ -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 diff --git a/ntp_core.c b/ntp_core.c index ed06ba7..b37f579 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -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 */ diff --git a/reports.h b/reports.h index c403c23..6674dd9 100644 --- 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 { diff --git a/test/simulation/110-chronyc b/test/simulation/110-chronyc index 9ddf95e..b78f0d8 100755 --- a/test/simulation/110-chronyc +++ b/test/simulation/110-chronyc @@ -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 diff --git a/test/system/007-cmdmon b/test/system/007-cmdmon index a5931d6..04d14c2 100755 --- a/test/system/007-cmdmon +++ b/test/system/007-cmdmon @@ -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