[Git][NTPsec/ntpsec][master] 3 commits: Finish rationalization of config block copy.

Eric S. Raymond gitlab at mg.gitlab.com
Fri Sep 8 02:14:51 UTC 2017


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


Commits:
4bf169ea by Eric S. Raymond at 2017-09-07T16:55:50-04:00
Finish rationalization of config block copy.

- - - - -
c86d43f6 by Eric S. Raymond at 2017-09-07T22:05:39-04:00
Thinko fix.

- - - - -
81a57678 by Eric S. Raymond at 2017-09-07T22:13:09-04:00
Trial implementation/docs of RFE: Add fudge option to server config

- - - - -


10 changed files:

- docs/clockopt.txt
- docs/includes/assoc-options.txt
- docs/ntpsec.txt
- include/ntp.h
- ntpd/keyword-gen.c
- ntpd/ntp_config.c
- ntpd/ntp_control.c
- ntpd/ntp_parser.y
- ntpd/ntp_peer.c
- ntpd/ntp_proto.c


Changes:

=====================================
docs/clockopt.txt
=====================================
--- a/docs/clockopt.txt
+++ b/docs/clockopt.txt
@@ -14,10 +14,10 @@ include::includes/clockopt.txt[]
 
 '''''
 
-[[addrs]]
-== Reference Clock Addresses ==
+[[types]]
+== Reference Clock Types ==
 
-Unless noted otherwise, further information about these commands is on
+Unless noted otherwise, further information about these types is on
 the link:refclock.html[Reference Clock Support] page.
 
 [[options]]


=====================================
docs/includes/assoc-options.txt
=====================================
--- a/docs/includes/assoc-options.txt
+++ b/docs/includes/assoc-options.txt
@@ -3,6 +3,13 @@
 // Note, some of these options are described with special refclock
 // semantics in includes/clock-options.txt.
 
++bias+::
+  Add the command argument, a floating-point value in seconds, to the
+  time offset (θ) computed for this server.  May be useful if
+  you are a client on a network connection such as an ADSL line where
+  there is a predictable asymmetry between upsteam and downstream
+  flight times.
+
 +burst+::
   when the server is reachable, send a burst of eight packets instead of
   the usual one. The packet spacing is normally 2 s; however, the


=====================================
docs/ntpsec.txt
=====================================
--- a/docs/ntpsec.txt
+++ b/docs/ntpsec.txt
@@ -224,6 +224,11 @@ codebase has been outright removed, with less than 5% new code added.
   generic-driver refclocks.  If the software was compiled with the
   --enable-classic-mode switch, the foregoing is reversed.
 
+* In server entries, its now possible to specify a time offset to be
+  applied to incoming timestamps (analogues to the fudge on certain
+  refclocks). This may be useful for client systems communicating
+  over ADSL lines, which have large but relatively fixed asymmetic delays.
+
 * The _restrict_ statement can now take an address range in CIDR
   notation rather than as an address/mask pair.
 


=====================================
include/ntp.h
=====================================
--- a/include/ntp.h
+++ b/include/ntp.h
@@ -165,6 +165,7 @@ struct peer_ctl {
 	uint8_t		maxpoll;
 	uint32_t	ttl;
 	keyid_t		peerkey;
+	double		bias;
 #ifdef REFCLOCK
 	uint32_t	baud;
 	char		*path;
@@ -284,7 +285,6 @@ struct peer {
 	double	delay;		/* peer roundtrip delay */
 	double	jitter;		/* peer jitter (squares) */
 	double	disp;		/* peer dispersion */
-	double	bias;		/* programmed offset bias */
 
 	/*
 	 * Variables used to correct for packet length and asymmetry.


=====================================
ntpd/keyword-gen.c
=====================================
--- a/ntpd/keyword-gen.c
+++ b/ntpd/keyword-gen.c
@@ -24,6 +24,7 @@ struct key_tok {
 struct key_tok ntp_keywords[] = {
 { "...",		T_Ellipsis,		FOLLBY_TOKEN },
 { "allpeers",		T_Allpeers,		FOLLBY_TOKEN },
+{ "bias",		T_Bias,			FOLLBY_TOKEN },
 { "broadcast",		T_Broadcast,		FOLLBY_STRING },
 { "baud",		T_Baud,			FOLLBY_TOKEN },
 { "ctl",		T_Ctl,			FOLLBY_TOKEN },


=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -591,6 +591,7 @@ create_peer_node(
 	my_node->ctl.minpoll = NTP_MINDPOLL;
         /* can not set maxpoll default yet, it may be NTP_MAXDPOLL or minpoll */
 	my_node->ctl.maxpoll = NTP_MAXPOLL_UNK;
+	my_node->ctl.bias = 0;
 
 	/* Now set the node to the read values */
 	my_node->host_mode = hmode;
@@ -713,6 +714,10 @@ create_peer_node(
 			}
 			break;
 
+		case T_Bias:
+			my_node->ctl.bias = option->value.d;
+			break;
+
 #ifdef REFCLOCK
 		case T_Path:
 			my_node->ctl.path = estrdup(option->value.s);
@@ -2647,12 +2652,13 @@ config_peers(
 	     struct peer_ctl client_ctl;
 	     /* so any new members we introduce will be zeroed */
 	     memset(&client_ctl, '\0', sizeof(struct peer_ctl));
-	     client_ctl.version = NTP_VERSION,
-	     client_ctl.minpoll = NTP_MINDPOLL,
-	     client_ctl.maxpoll = NTP_MAXPOLL_UNK,
-	     client_ctl.flags = FLAG_IBURST,
-	     client_ctl.ttl = 0,
-	     client_ctl.peerkey = 0,
+	     client_ctl.version = NTP_VERSION;
+	     client_ctl.minpoll = NTP_MINDPOLL;
+	     client_ctl.maxpoll = NTP_MAXPOLL_UNK;
+	     client_ctl.flags = FLAG_IBURST;
+	     client_ctl.ttl = 0;
+	     client_ctl.peerkey = 0;
+	     client_ctl.bias = 0;
 
 	    ZERO_SOCK(&peeraddr);
 	    /*


=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -2187,8 +2187,8 @@ ctl_putpeer(
 		break;
 
 	case CP_BIAS:
-		if ( !D_ISZERO_NS(p->bias) )
-			ctl_putdbl(peer_var[id].text, p->bias * MS_PER_S);
+		if ( !D_ISZERO_NS(p->cfg.bias) )
+			ctl_putdbl(peer_var[id].text, p->cfg.bias * MS_PER_S);
 		break;
 
 	case CP_REACH:


=====================================
ntpd/ntp_parser.y
=====================================
--- a/ntpd/ntp_parser.y
+++ b/ntpd/ntp_parser.y
@@ -57,6 +57,7 @@
 %token	<Integer>	T_Auth
 %token	<Integer>	T_Average
 %token	<Integer>	T_Baud
+%token	<Integer>	T_Bias
 %token	<Integer>	T_Broadcast
 %token	<Integer>	T_Burst
 %token	<Integer>	T_Calibrate
@@ -459,7 +460,8 @@ option_string
 	;
 
 option_double_keyword
-	:	T_Time1
+	:	T_Bias
+	|	T_Time1
 	|	T_Time2
 	;
 


=====================================
ntpd/ntp_peer.c
=====================================
--- a/ntpd/ntp_peer.c
+++ b/ntpd/ntp_peer.c
@@ -703,12 +703,7 @@ newpeer(
 	/*
 	 * Copy in the peer configuration block.
 	 */
-	peer->cfg.version = ctl->version;
-	peer->cfg.flags = ctl->flags;
-	peer->cfg.minpoll = ctl->minpoll;
-	peer->cfg.maxpoll = ctl->maxpoll;
-	peer->cfg.ttl = ctl->ttl;
-	peer->cfg.peerkey = ctl->peerkey;
+	memcpy(&peer->cfg, ctl, sizeof(peer->cfg));
 
 	peer->cast_flags = cast_flags;
 	set_peerdstadr(peer, 


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -708,7 +708,7 @@ handle_procpkt(
 	peer->reach |= 1;
 
 	/* Hooray! Pass our new sample off to the clock filter. */
-	clock_filter(peer, theta + peer->bias, delta, epsilon);
+	clock_filter(peer, theta + peer->cfg.bias, delta, epsilon);
 }
 
 static void



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/cf359e7f8dab37a07ad5a3d52b88f3424cc55e6c...81a57678bf5c89c92aeb79a05eadb38530086460

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/cf359e7f8dab37a07ad5a3d52b88f3424cc55e6c...81a57678bf5c89c92aeb79a05eadb38530086460
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/20170908/4bdbbeff/attachment.html>


More information about the vc mailing list