[Git][NTPsec/ntpsec][master] Remove machinery for never-implemented broadcast ttl option.

Eric S. Raymond gitlab at mg.gitlab.com
Sun Jan 22 20:01:26 UTC 2017


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


Commits:
8d3acbe8 by Eric S. Raymond at 2017-01-22T15:00:36-05:00
Remove machinery for never-implemented broadcast ttl option.

- - - - -


12 changed files:

- docs/includes/miscopt.txt
- docs/includes/ntp-conf-body.txt
- docs/miscopt.txt
- docs/ntpsec.txt
- include/ntp_config.h
- include/ntpd.h
- ntpd/ntp_config.c
- ntpd/ntp_control.c
- ntpd/ntp_io.c
- ntpd/ntp_parser.y
- ntpd/ntp_proto.c
- ntpd/ntp_signd.c


Changes:

=====================================
docs/includes/miscopt.txt
=====================================
--- a/docs/includes/miscopt.txt
+++ b/docs/includes/miscopt.txt
@@ -13,6 +13,5 @@
 * link:miscopt.html#tinker[tinker - modify sacred system parameters (dangerous)]
 * link:miscopt.html#rlimit[rlimit - alters certain process storage allocation limits]
 * link:miscopt.html#tos[tos - modify service parameters]
-* link:miscopt.html#ttl[ttl - set time to live]
 * link:comdex.html[Command Index]
 


=====================================
docs/includes/ntp-conf-body.txt
=====================================
--- a/docs/includes/ntp-conf-body.txt
+++ b/docs/includes/ntp-conf-body.txt
@@ -196,11 +196,6 @@ Discovery" page (available as part of the HTML documentation).
     for legacy purposes. However, according to principles of Byzantine
     agreement, _minsane_ should be at least 4 in order to detect and
     discard a single falseticker.
-`ttl` _hop_ `...`::
-  This command specifies a list of TTL values in increasing order, up to
-  8 values can be specified. In manycast mode these values are used in
-  turn in an expanding-ring search. The default is eight multiples of 32
-  starting at 31.
 
 == Reference Clock Support ==
 


=====================================
docs/miscopt.txt
=====================================
--- a/docs/miscopt.txt
+++ b/docs/miscopt.txt
@@ -85,12 +85,6 @@ include::includes/misc-options.txt[]
     and selectable before using backup sources, and avoids transient use
     of the backup sources at startup.
 
-[[ttl]]
-+ttl+ 'hop ...'::
-  This command specifies a list of TTL values in increasing order. up to
-  8 values can be specified. In manycast mode these values are used in
-  turn in an expanding-ring search. The default is eight multiples of 32
-  starting at 31.
 +dscp+ 'dscp'::
   This command specifies the Differentiated Services Code Point (DSCP)
   value that is used in sent NTP packets. The default value is 46 for


=====================================
docs/ntpsec.txt
=====================================
--- a/docs/ntpsec.txt
+++ b/docs/ntpsec.txt
@@ -86,6 +86,9 @@ a build-time switch, not a run-time one).
   has been removed from the NTPsec code as part of
   getting it fully IPv6-ready.
 
+* The ttl-hop option for broadcast mode has been removed from the
+  configuration grammar.  It was never actually implemented.
+
 [[security]]
 == Security Improvements ==
 


=====================================
include/ntp_config.h
=====================================
--- a/include/ntp_config.h
+++ b/include/ntp_config.h
@@ -223,7 +223,6 @@ struct config_tree_tag {
 	attr_val_fifo *	logconfig;
 	string_fifo *	phone;
 	setvar_fifo *	setvar;
-	int_fifo *	ttl;
 	attr_val_fifo *	vars;
 	nic_rule_fifo *	nic_rules;
 	int_fifo *	reset_counters;


=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -114,7 +114,7 @@ extern	void	init_io 	(void);
 extern  SOCKET	open_socket	(sockaddr_u *, bool, bool, endpt *);
 extern	void	io_open_sockets	(void);
 extern	void	io_clr_stats	(void);
-extern	void	sendpkt 	(sockaddr_u *, endpt *, int, void *, int);
+extern	void	sendpkt 	(sockaddr_u *, endpt *, void *, int);
 #ifdef DEBUG
 extern	void	collect_timing  (struct recvbuf *, const char *, int, l_fp *);
 #endif
@@ -408,8 +408,6 @@ extern int	sys_minclock;		/* minimum survivors */
 extern int	sys_minsane;		/* minimum candidates */
 extern int	sys_floor;		/* cluster stratum floor */
 extern int	sys_ceiling;		/* cluster stratum ceiling */
-extern uint8_t	sys_ttl[MAX_TTL];	/* ttl mapping vector */
-extern int	sys_ttlmax;		/* max ttl mapping vector index */
 
 /*
  * Statistics counters


=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -221,7 +221,6 @@ static void free_config_setvar(config_tree *);
 static void free_config_system_opts(config_tree *);
 static void free_config_tinker(config_tree *);
 static void free_config_tos(config_tree *);
-static void free_config_ttl(config_tree *);
 static void free_config_unpeers(config_tree *);
 static void free_config_vars(config_tree *);
 
@@ -288,7 +287,6 @@ static void config_access(config_tree *);
 static void config_mdnstries(config_tree *);
 static void config_phone(config_tree *);
 static void config_setvar(config_tree *);
-static void config_ttl(config_tree *);
 static void config_fudge(config_tree *);
 static void config_peers(config_tree *);
 static void config_unpeers(config_tree *);
@@ -388,7 +386,6 @@ free_config_tree(
 	free_config_logconfig(ptree);
 	free_config_phone(ptree);
 	free_config_setvar(ptree);
-	free_config_ttl(ptree);
 	free_config_fudge(ptree);
 	free_config_vars(ptree);
 	free_config_peers(ptree);
@@ -2349,36 +2346,6 @@ free_config_setvar(
 
 
 static void
-config_ttl(
-	config_tree *ptree
-	)
-{
-	size_t i = 0;
-	int_node *curr_ttl;
-
-	curr_ttl = HEAD_PFIFO(ptree->ttl);
-	for (; curr_ttl != NULL; curr_ttl = curr_ttl->link) {
-		if (i < COUNTOF(sys_ttl))
-			sys_ttl[i++] = (uint8_t)curr_ttl->i;
-		else
-			msyslog(LOG_INFO,
-				"ttl: Number of TTL entries exceeds %zu. Ignoring TTL %d...",
-				COUNTOF(sys_ttl), curr_ttl->i);
-	}
-	sys_ttlmax = i - 1;
-}
-
-
-static void
-free_config_ttl(
-	config_tree *ptree
-	)
-{
-	FREE_INT_FIFO(ptree->ttl);
-}
-
-
-static void
 config_fudge(
 	config_tree *ptree
 	)
@@ -3242,7 +3209,6 @@ config_ntpd(
 	config_phone(ptree);
 	config_mdnstries(ptree);
 	config_setvar(ptree);
-	config_ttl(ptree);
 	config_vars(ptree);
 
 	io_open_sockets();


=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -712,9 +712,9 @@ ctl_error(
 	if (res_authenticate) {
 		maclen = authencrypt(res_keyid, (uint32_t *)&rpkt,
 				     CTL_HEADER_LEN);
-		sendpkt(rmt_addr, lcl_inter, -2, &rpkt,	CTL_HEADER_LEN + maclen);
+		sendpkt(rmt_addr, lcl_inter, &rpkt, CTL_HEADER_LEN + maclen);
 	} else
-		sendpkt(rmt_addr, lcl_inter, -3, &rpkt, CTL_HEADER_LEN);
+		sendpkt(rmt_addr, lcl_inter, &rpkt, CTL_HEADER_LEN);
 }
 
 /*
@@ -995,9 +995,9 @@ ctl_flushpkt(
 		memcpy(datapt, &keyid, sizeof(keyid));
 		maclen = authencrypt(res_keyid,
 				     (uint32_t *)&rpkt, totlen);
-		sendpkt(rmt_addr, lcl_inter, -5, &rpkt, totlen + maclen);
+		sendpkt(rmt_addr, lcl_inter, &rpkt, totlen + maclen);
 	} else {
-		sendpkt(rmt_addr, lcl_inter, -6, &rpkt, sendlen);
+		sendpkt(rmt_addr, lcl_inter, &rpkt, sendlen);
 	}
 	if (more)
 		numctlfrags++;
@@ -2180,9 +2180,6 @@ ctl_putpeer(
 			break;
 		}
 #endif
-		if (p->ttl > 0 && p->ttl < COUNTOF(sys_ttl))
-			ctl_putint(peer_var[id].text,
-				   sys_ttl[p->ttl]);
 		break;
 
 	case CP_UNREACH:


=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -2117,7 +2117,6 @@ open_socket(
 }
 
 
-/* XXX ELIMINATE sendpkt similar in ntpq.c, ntp_io.c, ntptrace.c */
 /*
  * sendpkt - send a packet to the specified destination. Maintain a
  * send error cache so that only the first consecutive error for a
@@ -2127,7 +2126,6 @@ void
 sendpkt(
 	sockaddr_u *		dest,
 	endpt *	ep,
-	int			ttl,
 	void *			pkt,
 	int			len
 	)
@@ -2141,13 +2139,13 @@ sendpkt(
 		 * unbound peer - drop request and wait for better
 		 * network conditions
 		 */
-		DPRINTF(2, ("sendpkt(dst=%s, ttl=%d, len=%d): no interface - IGNORED\n",
-			    socktoa(dest), ttl, len));
+		DPRINTF(2, ("sendpkt(dst=%s, len=%d): no interface - IGNORED\n",
+			    socktoa(dest), len));
 		return;
 	}
 
-	DPRINTF(2, ("sendpkt(%d, dst=%s, src=%s, ttl=%d, len=%d)\n",
-		    src->fd, socktoa(dest), socktoa(&src->sin), ttl, len));
+	DPRINTF(2, ("sendpkt(%d, dst=%s, src=%s, len=%d)\n",
+		    src->fd, socktoa(dest), socktoa(&src->sin), len));
 
 	cc = sendto(src->fd, pkt, (u_int)len, 0,
 		    &dest->sa, SOCKLEN(dest));


=====================================
ntpd/ntp_parser.y
=====================================
--- a/ntpd/ntp_parser.y
+++ b/ntpd/ntp_parser.y
@@ -252,7 +252,6 @@
 %type	<Integer>	fudge_factor_bool_keyword
 %type	<Integer>	fudge_factor_dbl_keyword
 %type	<Attr_val_fifo>	fudge_factor_list
-%type	<Attr_val_fifo>	integer_list
 %type	<Attr_val_fifo>	integer_list_range
 %type	<Attr_val>	integer_list_range_elt
 %type	<Attr_val>	integer_range
@@ -1206,8 +1205,6 @@ miscellaneous_command
 			{ CONCAT_G_FIFOS(cfgt.phone, $2); }
 	|	T_Setvar variable_assign
 			{ APPEND_G_FIFO(cfgt.setvar, $2); }
-	|	T_Ttl integer_list
-			{ CONCAT_G_FIFOS(cfgt.ttl, $2); }
 	;
 
 misc_cmd_dbl_keyword
@@ -1386,19 +1383,6 @@ counter_set_keyword
  * -------------------
  */
 
-integer_list
-	:	integer_list T_Integer
-		{
-			$$ = $1;
-			APPEND_G_FIFO($$, create_int_node($2));
-		}
-	|	T_Integer
-		{
-			$$ = NULL;
-			APPEND_G_FIFO($$, create_int_node($1));
-		}
-	;
-
 integer_list_range
 	:	integer_list_range integer_list_range_elt
 		{


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -99,8 +99,6 @@ int	sys_minclock = NTP_MINCLOCK; /* minimum candidates */
 int	sys_maxclock = NTP_MAXCLOCK; /* maximum candidates */
 int	sys_orphan = STRATUM_UNSPEC + 1; /* orphan stratum */
 int	sys_orphwait = NTP_ORPHWAIT; /* orphan wait */
-int	sys_ttlmax;		/* max ttl mapping vector index */
-uint8_t	sys_ttl[MAX_TTL];	/* ttl mapping vector */
 
 /*
  * Statistics counters - first the good, then the bad
@@ -2153,8 +2151,7 @@ peer_xmit(
 		peer->org = xmt_tx;
 		xpkt.xmt = htonl_fp(xmt_tx);
 		peer->t21_bytes = sendlen;
-		sendpkt(&peer->srcadr, peer->dstadr, sys_ttl[peer->ttl],
-		    &xpkt, sendlen);
+		sendpkt(&peer->srcadr, peer->dstadr, &xpkt, sendlen);
 		peer->sent++;
 		peer->outcount++;
 		peer->throttle += (1 << peer->minpoll) - 2;
@@ -2194,7 +2191,7 @@ peer_xmit(
 		exit(1);
 	}
 	peer->t21_bytes = sendlen;
-	sendpkt(&peer->srcadr, peer->dstadr, sys_ttl[peer->ttl], &xpkt,
+	sendpkt(&peer->srcadr, peer->dstadr, &xpkt,
 	    sendlen);
 	peer->sent++;
         peer->outcount++;
@@ -2344,8 +2341,7 @@ fast_xmit(
 	 */
 	sendlen = LEN_PKT_NOMAC;
 	if (rbufp->recv_length == sendlen) {
-		sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, 0, &xpkt,
-		    sendlen);
+		sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, &xpkt, sendlen);
 #ifdef DEBUG
 		if (debug)
 			printf(
@@ -2364,7 +2360,7 @@ fast_xmit(
 	 */
 	get_systime(&xmt_tx);
 	sendlen += authencrypt(xkeyid, (uint32_t *)&xpkt, sendlen);
-	sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, 0, &xpkt, sendlen);
+	sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, &xpkt, sendlen);
 	get_systime(&xmt_ty);
 	xmt_ty -= xmt_tx;
 	sys_authdelay = xmt_ty;
@@ -2450,7 +2446,7 @@ pool_xmit(
 	get_systime(&xmt_tx);
 	pool->org = xmt_tx;
 	xpkt.xmt = htonl_fp(xmt_tx);
-	sendpkt(rmtadr, lcladr, sys_ttl[pool->ttl], &xpkt, LEN_PKT_NOMAC);
+	sendpkt(rmtadr, lcladr, &xpkt, LEN_PKT_NOMAC);
 	pool->sent++;
 	pool->throttle += (1 << pool->minpoll) - 2;
 #ifdef DEBUG
@@ -2744,7 +2740,6 @@ void
 init_proto(const bool verbose)
 {
 	l_fp	dummy;
-	int	i;
 
 	/*
 	 * Fill in the sys_* stuff.  Default is don't listen to
@@ -2766,10 +2761,6 @@ init_proto(const bool verbose)
 	orphwait = current_time + sys_orphwait;
 	proto_clr_stats();
 	use_stattime = current_time;
-	for (i = 0; i < MAX_TTL; i++) {
-		sys_ttl[i] = (uint8_t)((i * 256) / MAX_TTL);
-		sys_ttlmax = i;
-	}
 	hardpps_enable = false;
 	stats_control = true;
 }


=====================================
ntpd/ntp_signd.c
=====================================
--- a/ntpd/ntp_signd.c
+++ b/ntpd/ntp_signd.c
@@ -209,7 +209,7 @@ send_via_ntp_signd(
 			if (ntohl(samba_reply.op) == 3 && reply_len >  offsetof(struct samba_key_out, pkt)) {
 				sendlen = reply_len - offsetof(struct samba_key_out, pkt);
 				xpkt = &samba_reply.pkt;
-				sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, 0, xpkt, sendlen);
+				sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, xpkt0, sendlen);
 #ifdef DEBUG
 				if (debug)
 					printf(



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/8d3acbe82b69926b71aba90dbc9bd7d27a45c289
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170122/8039762a/attachment.html>


More information about the vc mailing list