[Git][NTPsec/ntpsec][master] Address GitLab issue #316: "ntpd" dies unexpected unpeering a refclock

Eric S. Raymond gitlab at mg.gitlab.com
Thu May 25 14:28:34 UTC 2017


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
e585caad by Eric S. Raymond at 2017-05-25T10:28:20-04:00
Address GitLab issue #316: "ntpd" dies unexpected unpeering a refclock

The root of this problem is the deprecation of referring to refclocks
by magic addresses.  A user tried unpeering a refclock by driver type name
and fatally confused the peer lookup logic.

No point in trying to fix this, since in the absence of a unit number
the type specification is ambiguous.  So just put in a crash guard and
log in a complaint.

- - - - -


1 changed file:

- ntpd/ntp_config.c


Changes:

=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -2814,7 +2814,7 @@ config_unpeers(
 			msyslog(LOG_ERR, "invalid address in unpeer command");
 			continue;
 		}
-		
+
 		ZERO(peeraddr);
 		AF(&peeraddr) = curr_unpeer->addr->type;
 		name = curr_unpeer->addr->address;
@@ -2833,7 +2833,16 @@ config_unpeers(
 
 			continue;
 		}
-		/* It's not a numeric IP address, it's a hostname. */
+
+		/* It's not a numeric IP address... */
+
+		/* Misguided attempt to unpeer by driver type name? */
+		if (strchr(name, '.') == NULL && strchr(name, ':') == NULL) {
+		    msyslog(LOG_NOTICE, "refclocks cannot be unpeered by type.");
+		    continue;
+		}
+
+		/* It's a hostname. */
 		p = findexistingpeer(NULL, name, NULL, -1);
 		if (p != NULL) {
 			msyslog(LOG_NOTICE, "unpeered %s", name);



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

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/e585caad8ab78b508d202b89f35a05c2cc67624d
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/20170525/ae3246d1/attachment.html>


More information about the vc mailing list