[Git][NTPsec/ntpsec][master] 2 commits: Added comments describing purpose of single-char variables in peer drop code.

Ian Bruene gitlab at mg.gitlab.com
Thu Jan 25 17:29:34 UTC 2018


Ian Bruene pushed to branch master at NTPsec / ntpsec


Commits:
f0de362d by Ian Bruene at 2018-01-25T08:44:44-06:00
Added comments describing purpose of single-char variables in peer drop code.

- - - - -
e218d922 by Ian Bruene at 2018-01-25T11:28:42-06:00
Implemented timeResolution in MIB.

- - - - -


2 changed files:

- ntpclients/ntpsnmpd.py
- ntpd/ntp_proto.c


Changes:

=====================================
ntpclients/ntpsnmpd.py
=====================================
--- a/ntpclients/ntpsnmpd.py
+++ b/ntpclients/ntpsnmpd.py
@@ -369,9 +369,18 @@ class DataSource:  # This will be broken up in future to be less NTP-specific
         vb = ax.Varbind(ax.VALUE_OCTET_STR, oid, data)
         return vb
 
-    def cbr_timeResolution(self, oid):  # DUMMY
+    def cbr_timeResolution(self, oid):
         # Uinteger32
-        return ax.Varbind(ax.VALUE_GAUGE32, oid, 42)
+        # Arrives in fractional milliseconds
+        fuzz = self.safeReadvar(0, ["fuzz"])
+        if fuzz is None:
+            return None
+        fuzz = fuzz["fuzz"]
+        # We want to emit fractions of seconds
+        # Yes we are flooring instead of rounding: don't want to emit a
+        # resolution value higher than ntpd actually produces.
+        fuzz = int(1 / fuzz)
+        return ax.Varbind(ax.VALUE_GAUGE32, oid, fuzz)
 
     def cbr_timePrecision(self, oid):
         return self.readCallbackSkeletonSimple(oid, "precision",
@@ -379,6 +388,10 @@ class DataSource:  # This will be broken up in future to be less NTP-specific
 
     def cbr_timeDistance(self, oid):  # DUMMY
         # Displaystring
+        # From docs/select.txt:
+        # The selection metric, called the _root distance,_, is one-half the
+        # roundtrip root delay plus the root dispersion plus minor error
+        # contributions not considered here.
         return ax.Varbind(ax.VALUE_OCTET_STR, oid, "foo")
 
     # Blank: ntpEntStatus


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -1899,10 +1899,10 @@ clock_select(void)
 	 * peer, who of course have the immunity idol.
 	 */
 	while (1) {
-		d = 1e9;
-		e = -1e9;
-		g = 0;
-		k = 0;
+		d = 1e9; // Minimum peer jitter
+		e = -1e9; // Worst peer select jitter * synch
+		g = 0; // Worst peer select jitter
+		k = 0; // Index of the worst peer
 		for (i = 0; i < nlist; i++) {
 			if (peers[i].error < d)
 				d = peers[i].error;



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/c2b0b13200b8fdde0180e6604dcea9c5d4be0321...e218d9228bce8531446a7bb3e19e1bfe007f0fb1

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/c2b0b13200b8fdde0180e6604dcea9c5d4be0321...e218d9228bce8531446a7bb3e19e1bfe007f0fb1
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/20180125/5aa3c40e/attachment.html>


More information about the vc mailing list