[Git][NTPsec/ntpsec][master] Restore newversion/oldversion counters in ntpd for ntpq sysstats

Hal Murray gitlab at mg.gitlab.com
Sat Dec 24 10:48:20 UTC 2016


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
59f4f192 by Hal Murray at 2016-12-24T02:47:20-08:00
Restore newversion/oldversion counters in ntpd for ntpq sysstats

- - - - -


1 changed file:

- ntpd/ntp_proto.c


Changes:

=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -749,6 +749,23 @@ receive(
 		goto done;
 	}
 
+	/*
+	 * Version check must be after the query packets, since they
+	 * intentionally use an early version.
+	 */
+	{
+	uint8_t hisversion = PKT_VERSION(rbufp->recv_pkt.li_vn_mode);
+	if (hisversion == NTP_VERSION) {
+		sys_newversion++;		/* new version */
+	} else if (!(restrict_mask & RES_VERSION) && hisversion >=
+	    NTP_OLDVERSION) {
+		sys_oldversion++;		/* previous version */
+	} else {
+		sys_badlength++;
+		goto done;			/* old version */
+	}
+	}
+
 	pkt = parse_packet(rbufp);
 	if(pkt == NULL) {
 		sys_badlength++;



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/59f4f1924b3a9a7200d90ad0d68cadf0d4d02cc4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20161224/7a93cf02/attachment.html>


More information about the vc mailing list