[Git][NTPsec/ntpsec][master] Changes names of packet counter variables to not be redundant.

Matt Selsky gitlab at mg.gitlab.com
Fri Aug 23 05:50:23 UTC 2019



Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
83345b29 by Ian Bruene at 2019-08-23T05:23:50Z
Changes names of packet counter variables to not be redundant.

- - - - -


4 changed files:

- include/ntpd.h
- ntpd/ntp_control.c
- ntpd/ntp_io.c
- ntpd/refclock_generic.c


Changes:

=====================================
include/ntpd.h
=====================================
@@ -244,11 +244,11 @@ extern keyid_t	ctl_auth_keyid;		/* keyid used for authenticating write requests
  * Other statistics of possible interest
  */
 struct packet_counters {
-	uint64_t packets_dropped;	/* # packets dropped on reception */
-	uint64_t packets_ignored;	/* received on wild card interface */
-	uint64_t packets_received;	/* total number of packets received */
-	uint64_t packets_sent;		/* total number of packets sent */
-	uint64_t packets_notsent;	/* total number of packets which couldn't be sent */
+	uint64_t dropped;	/* # packets dropped on reception */
+	uint64_t ignored;	/* received on wild card interface */
+	uint64_t received;	/* total number of packets received */
+	uint64_t sent;		/* total number of packets sent */
+	uint64_t notsent;	/* total number of packets which couldn't be sent */
 	/* There used to be a signal handler for received packets. */
 	/* It's not needed now that the kernel time stamps packets. */
 	uint64_t handler_calls;	/* number of calls to interrupt handler */


=====================================
ntpd/ntp_control.c
=====================================
@@ -1900,23 +1900,23 @@ ctl_putsys(
 		break;
 
 	case CS_IO_DROPPED:
-		ctl_putuint(sys_var[varid].text, pkt_count.packets_dropped);
+		ctl_putuint(sys_var[varid].text, pkt_count.dropped);
 		break;
 
 	case CS_IO_IGNORED:
-		ctl_putuint(sys_var[varid].text, pkt_count.packets_ignored);
+		ctl_putuint(sys_var[varid].text, pkt_count.ignored);
 		break;
 
 	case CS_IO_RECEIVED:
-		ctl_putuint(sys_var[varid].text, pkt_count.packets_received);
+		ctl_putuint(sys_var[varid].text, pkt_count.received);
 		break;
 
 	case CS_IO_SENT:
-		ctl_putuint(sys_var[varid].text, pkt_count.packets_sent);
+		ctl_putuint(sys_var[varid].text, pkt_count.sent);
 		break;
 
 	case CS_IO_SENDFAILED:
-		ctl_putuint(sys_var[varid].text, pkt_count.packets_notsent);
+		ctl_putuint(sys_var[varid].text, pkt_count.notsent);
 		break;
 
 	case CS_IO_WAKEUPS:


=====================================
ntpd/ntp_io.c
=====================================
@@ -2023,10 +2023,10 @@ sendpkt(
 		    &dest->sa, SOCKLEN(dest));
 	if (cc == -1) {
 		src->notsent++;
-		pkt_count.packets_notsent++;
+		pkt_count.notsent++;
 	} else	{
 		src->sent++;
-		pkt_count.packets_sent++;
+		pkt_count.sent++;
 	}
 }
 
@@ -2068,7 +2068,7 @@ read_refclock_packet(
 		char buf[RX_BUFF_SIZE];
 
 		buflen = read(fd, buf, sizeof buf);
-		pkt_count.packets_dropped++;
+		pkt_count.dropped++;
 		return (buflen);
 	}
 
@@ -2101,7 +2101,7 @@ read_refclock_packet(
 	if (!consumed) {
 		rp->recvcount++;
 		// FIXME: should have separate slot for refclock packets
-		pkt_count.packets_received++;
+		pkt_count.received++;
 	}
 
 	return (int)buflen;
@@ -2151,9 +2151,9 @@ read_network_packet(
 			    : "drop",
 			free_recvbuffs(), fd, socktoa(&from)));
 		if (itf->ignore_packets)
-			pkt_count.packets_ignored++;
+			pkt_count.ignored++;
 		else
-			pkt_count.packets_dropped++;
+			pkt_count.dropped++;
 		return (buflen);
 	}
 
@@ -2212,7 +2212,7 @@ read_network_packet(
 		if (   IN6_IS_ADDR_LOOPBACK(PSOCK_ADDR6(&rb->recv_srcadr))
 		    && !IN6_IS_ADDR_LOOPBACK(PSOCK_ADDR6(&itf->sin))
 		   ) {
-			pkt_count.packets_dropped++;
+			pkt_count.dropped++;
 			DPRINT(2, ("DROPPING that packet\n"));
 			freerecvbuf(rb);
 			return buflen;
@@ -2232,7 +2232,7 @@ read_network_packet(
 	freerecvbuf(rb);
 
 	itf->received++;
-	pkt_count.packets_received++;
+	pkt_count.received++;
 	return (buflen);
 }
 
@@ -2733,11 +2733,11 @@ getinterface(
 void
 io_clr_stats(void)
 {
-	pkt_count.packets_dropped = 0;
-	pkt_count.packets_ignored = 0;
-	pkt_count.packets_received = 0;
-	pkt_count.packets_sent = 0;
-	pkt_count.packets_notsent = 0;
+	pkt_count.dropped = 0;
+	pkt_count.ignored = 0;
+	pkt_count.received = 0;
+	pkt_count.sent = 0;
+	pkt_count.notsent = 0;
 
 	pkt_count.handler_calls = 0;
 	pkt_count.handler_pkts = 0;


=====================================
ntpd/refclock_generic.c
=====================================
@@ -1909,7 +1909,7 @@ local_input(
 					buf->fd           = rbufp->fd;
 					buf->recv_peer    = rbufp->recv_peer;
 					parse->generic->io.recvcount++;
-					pkt_count.packets_received++;
+					pkt_count.received++;
 					local_receive(buf);
 					freerecvbuf(buf);
 				}



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/83345b29d4fee71a2ae4b11522aeabd3bf4e32bb

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/83345b29d4fee71a2ae4b11522aeabd3bf4e32bb
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190823/8e4f3e64/attachment-0001.htm>


More information about the vc mailing list