]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
cmdmon: use 32-bit fields in client access report
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 29 Jan 2016 12:46:38 +0000 (13:46 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 29 Jan 2016 16:55:58 +0000 (17:55 +0100)
The clientlog record still uses 16-bit integers to count dropped
packets, but this will avoid an incompatible change in the command
reply if there will be a need to count more than 2^16 drops.

candm.h
client.c
cmdmon.c

diff --git a/candm.h b/candm.h
index af55966ea64b0290f21aee13178b728655e9289f..fa8d14879c9a751f4e76825b73e2ca9ac9694683 100644 (file)
--- a/candm.h
+++ b/candm.h
@@ -553,8 +553,8 @@ typedef struct {
   IPAddr ip;
   uint32_t ntp_hits;
   uint32_t cmd_hits;
-  uint16_t ntp_drops;
-  uint16_t cmd_drops;
+  uint32_t ntp_drops;
+  uint32_t cmd_drops;
   int8_t ntp_interval;
   int8_t cmd_interval;
   int8_t ntp_timeout_interval;
index 969331b21bdbea3717b39c1361ccb7151c31173f..431c238b7b715a5348c23ec8e036194e89224588 100644 (file)
--- a/client.c
+++ b/client.c
@@ -2125,14 +2125,14 @@ process_cmd_clients(char *line)
 
       printf("%-25s", hostname);
       printf("  %6"PRIu32"  %5"PRIu16"  ",
-             ntohl(client->ntp_hits), ntohs(client->ntp_drops));
+             ntohl(client->ntp_hits), ntohl(client->ntp_drops));
       print_clientlog_interval(client->ntp_interval);
       printf("  ");
       print_clientlog_interval(client->ntp_timeout_interval);
       printf("  ");
       print_seconds(ntohl(client->last_ntp_hit_ago));
       printf("  %6"PRIu32"  %5"PRIu16"  ",
-             ntohl(client->cmd_hits), ntohs(client->cmd_drops));
+             ntohl(client->cmd_hits), ntohl(client->cmd_drops));
       print_clientlog_interval(client->cmd_interval);
       printf("  ");
       print_seconds(ntohl(client->last_cmd_hit_ago));
index cd6e31c1e9e29454751453642dd9548eaa5303f3..3662a90301d89825352cae84ccbff2ba2643c09a 100644 (file)
--- a/cmdmon.c
+++ b/cmdmon.c
@@ -1062,8 +1062,8 @@ handle_client_accesses_by_index(CMD_Request *rx_message, CMD_Reply *tx_message)
     UTI_IPHostToNetwork(&report.ip_addr, &client->ip);
     client->ntp_hits = htonl(report.ntp_hits);
     client->cmd_hits = htonl(report.cmd_hits);
-    client->ntp_drops = htons(report.ntp_drops);
-    client->cmd_drops = htons(report.cmd_drops);
+    client->ntp_drops = htonl(report.ntp_drops);
+    client->cmd_drops = htonl(report.cmd_drops);
     client->ntp_interval = report.ntp_interval;
     client->cmd_interval = report.cmd_interval;
     client->ntp_timeout_interval = report.ntp_timeout_interval;