[Git][NTPsec/ntpsec][master] New syntax: unpeer clock <type> [unit <number>]

Eric S. Raymond gitlab at mg.gitlab.com
Sat Nov 4 20:28:10 UTC 2017


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


Commits:
79531887 by Eric S. Raymond at 2017-11-04T16:27:46-04:00
New syntax: unpeer clock <type> [unit <number>]

- - - - -


6 changed files:

- NEWS
- devel/TODO
- docs/includes/assoc-commands.txt
- docs/ntpsec.txt
- ntpd/keyword-gen.c
- ntpd/ntp_parser.y


Changes:

=====================================
NEWS
=====================================
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ on user-visible changes.
 
 == Repository head ==
 
+It is now possible to unpeer refclocks using a type/unit specification
+rather than a magic IP address.  This was the last obligatory use of
+magic IP addresses in the configuration grammar.
+
 == 2017-10-10: 1.0.0 ==
 
 This is the 1.0 release.


=====================================
devel/TODO
=====================================
--- a/devel/TODO
+++ b/devel/TODO
@@ -42,10 +42,6 @@ of the current startup logic gets discussed.
 
 * A clock driver or auxiliary daemon for PTP.
 
-* Invent a syntax for type/unit pairs: use it in the refclock and unpeer
-  directives. Presently it's only possible to unpeer using the deprecated
-  magic address of the driver.
-
 * Hal says "We need a way to inspect/debug bits on the wire. `ntpdate
   -du' is the traditional approach."  Hal's straw man is a new program
   rather than trying to make ntpdig do this.  Eric's proposed answer:


=====================================
docs/includes/assoc-commands.txt
=====================================
--- a/docs/includes/assoc-commands.txt
+++ b/docs/includes/assoc-commands.txt
@@ -15,10 +15,13 @@ link-local IPV6 address with an interface specified in
 
 +broadcast+ _address_ [+key+ _key_] [+version+ _version_] [+prefer+] [+minpoll+ _minpoll_] [+ttl+ _ttl_]
 
-+unpeer+ ['address' | 'associd']::
-  These six commands specify the time server name or address to be used
-  and the mode in which to operate. The _address_ can be either a DNS
-  name or an IP address in dotted-quad notation.
++unpeer+ ['address' | 'associd' | +clock+ 'clocktype' [ +unit+ 'unitnum']]::
+  These six commands specify the time server name or address to be
+  used and the mode in which to operate. The _address_ can be either a
+  DNS name or an IP address in dotted-quad notation.  If it is a
+  refclock, it can be +clock+ followed by a type-unit pair as in the
+  +refclock+ directive; a missing unit clause is interpreted as unit
+  0.
 
 [[pool]]
 +pool+::


=====================================
docs/ntpsec.txt
=====================================
--- a/docs/ntpsec.txt
+++ b/docs/ntpsec.txt
@@ -222,6 +222,9 @@ codebase has been outright removed, with less than 5% new code added.
   each refclock page.  One major feature of the new syntax is that
   refclock drivers are referred to by names, not numbers.
 
+* The unpeer command now takes a type-unit specofication when
+  unpeering a clock.
+
 * For the generic (parse) driver only: Using the new refclock syntax,
   the maximum number of units that can be set up changes from 4
   (numbers 0-3) to unlimited.  However, the old magic-address syntax


=====================================
ntpd/keyword-gen.c
=====================================
--- a/ntpd/keyword-gen.c
+++ b/ntpd/keyword-gen.c
@@ -27,6 +27,7 @@ struct key_tok ntp_keywords[] = {
 { "bias",		T_Bias,			FOLLBY_TOKEN },
 { "broadcast",		T_Broadcast,		FOLLBY_STRING },
 { "baud",		T_Baud,			FOLLBY_TOKEN },
+{ "clock",		T_Clock,		FOLLBY_STRING },
 { "ctl",		T_Ctl,			FOLLBY_TOKEN },
 { "disable",		T_Disable,		FOLLBY_TOKEN },
 { "driftfile",		T_Driftfile,		FOLLBY_STRING },


=====================================
ntpd/ntp_parser.y
=====================================
--- a/ntpd/ntp_parser.y
+++ b/ntpd/ntp_parser.y
@@ -62,6 +62,7 @@
 %token	<Integer>	T_Burst
 %token	<Integer>	T_Calibrate
 %token	<Integer>	T_Ceiling
+%token	<Integer>	T_Clock
 %token	<Integer>	T_Clockstats
 %token	<Integer>	T_Cohort
 %token	<Integer>	T_ControlKey
@@ -481,11 +482,19 @@ unpeer_command
 	:	unpeer_keyword address
 		{
 			unpeer_node *my_node;
-			
+
 			my_node = create_unpeer_node($2);
 			if (my_node)
 				APPEND_G_FIFO(cfgt.unpeers, my_node);
 		}
+	|	unpeer_keyword T_Clock T_String optional_unit
+		{
+			unpeer_node *my_node;
+
+			my_node = create_unpeer_node(addr_from_typeunit($3, $4));
+			if (my_node)
+				APPEND_G_FIFO(cfgt.unpeers, my_node);
+		}
 	;	
 unpeer_keyword	
 	:	T_Unconfig



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

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/795318878486391eed8605930b275f191fe105a2
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/20171104/162bc1ac/attachment.html>


More information about the vc mailing list