[Git][NTPsec/ntpsec][master] 13 commits: ntp_io: don't duplicate latoa(pif) & localaddrtoa(pif)

Gary E. Miller gitlab at mg.gitlab.com
Tue May 23 23:04:02 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
e555664a by Gary E. Miller at 2017-05-23T14:20:51-07:00
ntp_io: don't duplicate latoa(pif) & localaddrtoa(pif)

- - - - -
746c4d8e by Gary E. Miller at 2017-05-23T14:23:48-07:00
ntpd.h: remove unused sys_clocktime

- - - - -
375b4a5f by Gary E. Miller at 2017-05-23T14:49:35-07:00
ntp_peer: make peer_reset() static

- - - - -
96709f57 by Gary E. Miller at 2017-05-23T14:58:02-07:00
ntpd.h: remove unused extern process_packet()

- - - - -
ec74b2b2 by Gary E. Miller at 2017-05-23T15:06:21-07:00
ntp_proto: make clock_select() and leapsec static. Remove leapdif.

leapdif was unused.

- - - - -
9f531514 by Gary E. Miller at 2017-05-23T15:12:02-07:00
ntp_proto: make sys_maxdist static, remove unused extern clear()

- - - - -
7615c98e by Gary E. Miller at 2017-05-23T15:18:14-07:00
ntp_control: make auth_timereset static, move reset_auth_stats()

- - - - -
c4b686aa by Gary E. Miller at 2017-05-23T15:26:45-07:00
ntpd.h: remove unused extern record_crypto_stats()

- - - - -
e0570c9d by Gary E. Miller at 2017-05-23T15:31:46-07:00
ntp_config: make cfg_tree_history static.

- - - - -
5a43bd07 by Gary E. Miller at 2017-05-23T15:34:50-07:00
ntp_control: make a bunch of counters static.

- - - - -
7e92b591 by Gary E. Miller at 2017-05-23T15:43:51-07:00
ntp_loopfilter: make clock_minstep, clock_panic, and pll_status static.

- - - - -
7bf0eaab by Gary E. Miller at 2017-05-23T15:50:06-07:00
ntp_loopfilter: make state and ext_enable static.

- - - - -
9acc9589 by Gary E. Miller at 2017-05-23T15:53:24-07:00
ntpd.h: remove unused extern last_time

- - - - -


7 changed files:

- include/ntpd.h
- ntpd/ntp_config.c
- ntpd/ntp_control.c
- ntpd/ntp_io.c
- ntpd/ntp_loopfilter.c
- ntpd/ntp_peer.c
- ntpd/ntp_proto.c


Changes:

=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -123,8 +123,7 @@ extern	void	sendpkt 	(sockaddr_u *, endpt *, void *, int);
 #ifdef ENABLE_DEBUG_TIMING
 extern	void	collect_timing  (struct recvbuf *, const char *, int, l_fp);
 #endif
-#define		latoa(pif)	localaddrtoa(pif)
-extern const char * localaddrtoa(endpt *);
+extern const char * latoa(endpt *);
 
 /* ntp_loopfilter.c */
 extern	void	init_loopfilter(void);
@@ -133,7 +132,6 @@ extern	void	adj_host_clock(void);
 extern	void	loop_config(int, double);
 extern	void	select_loop(int);
 extern	void	huffpuff(void);
-extern	u_long	sys_clocktime;
 extern	u_int	sys_tai;
 extern 	int	freq_cnt;
 
@@ -162,7 +160,6 @@ extern	struct peer *newpeer	(sockaddr_u *, const char *,
 extern	void	peer_update_hash (struct peer *);
 extern	void	peer_all_reset	(void);
 extern	void	peer_clr_stats	(void);
-extern	void	peer_reset	(struct peer *);
 extern	void	refresh_all_peerinterfaces(void);
 extern	void	unpeer		(struct peer *);
 extern	void	clear_all	(void);
@@ -174,29 +171,20 @@ extern	void	peer_cleanup	(void);
 extern	void	transmit	(struct peer *);
 extern	void	receive 	(struct recvbuf *);
 extern	void	peer_clear	(struct peer *, const char *, const bool);
-extern	void 	process_packet	(struct peer *, struct pkt *, u_int);
-extern	void	clock_select	(void);
 extern	void	set_sys_leap	(uint8_t);
 
-extern	u_long	leapsec;	/* seconds to next leap (proximity class) */
-extern  int     leapdif;        /* TAI difference step at next leap second*/
 extern	int	sys_orphan;
 extern	double	sys_mindisp;
-extern	double	sys_maxdist;
 extern	double	sys_maxdisp;
 
 extern	void	poll_update	(struct peer *, uint8_t);
 
-extern	void	clear		(struct peer *);
 extern	void	clock_filter	(struct peer *, double, double, double);
 extern	void	init_proto	(const bool);
 extern	void	set_sys_tick_precision(double);
 extern	void	proto_config	(int, u_long, double);
 extern	void	proto_clr_stats (void);
 
-/* ntp_request.c */
-extern	void	reset_auth_stats(void);
-extern u_long	auth_timereset;
 
 
 /* ntp_restrict.c */
@@ -227,7 +215,6 @@ extern	int	mprintf_clock_stats(struct peer *, const char *, ...)
 			NTP_PRINTF(2, 3);
 extern	void	record_raw_stats (sockaddr_u *srcadr, sockaddr_u *dstadr, l_fp *t1, l_fp *t2, l_fp *t3, l_fp *t4, int leap, int version, int mode, int stratum, int ppoll, int precision, double root_delay, double root_dispersion, uint32_t refid, u_int outcount);
 extern	void	check_leap_file	(bool is_daily_check, time_t systime);
-extern	void	record_crypto_stats (sockaddr_u *, const char *);
 #ifdef ENABLE_DEBUG_TIMING
 extern	void	record_timing_stats (const char *);
 #endif
@@ -256,29 +243,10 @@ extern l_fp	fetch_packetstamp(struct recvbuf *, struct msghdr *, l_fp);
 extern const char *progname;
 extern char	*sys_phone[];		/* ACTS phone numbers */
 extern char *ntp_signd_socket;
-extern struct config_tree_tag *cfg_tree_history;
 
 /* ntp_control.c */
 extern keyid_t	ctl_auth_keyid;		/* keyid used for authenticating write requests */
-
-/*
- * Statistic counters to keep track of requests and responses.
- */
-extern u_long	ctltimereset;		/* time stats reset */
-extern u_long	numctlreq;		/* number of requests we've received */
-extern u_long	numctlbadpkts;		/* number of bad control packets */
-extern u_long	numctlresponses; 	/* number of resp packets sent with data */
-extern u_long	numctlfrags; 		/* number of fragments sent */
-extern u_long	numctlerrors;		/* number of error responses sent */
-extern u_long	numctltooshort;		/* number of too short input packets */
-extern u_long	numctlinputresp; 	/* number of responses on input */
-extern u_long	numctlinputfrag; 	/* number of fragments on input */
-extern u_long	numctlinputerr;		/* number of input pkts with err bit set */
-extern u_long	numctlbadoffset; 	/* number of input pkts with nonzero offset */
-extern u_long	numctlbadversion;	/* number of input pkts with unknown version */
-extern u_long	numctldatatooshort;	/* data too short for count */
-extern u_long	numctlbadop; 		/* bad op code found in packet */
-extern u_long	numasyncmsgs;		/* number of async messages we've sent */
+extern	void	reset_auth_stats(void);
 
 /*
  * Other statistics of possible interest
@@ -306,12 +274,7 @@ extern double	drift_comp;		/* clock frequency (s/s) */
 extern double	clock_stability;	/* clock stability (s/s) */
 extern double	clock_max_back;		/* max backward offset before step (s) */
 extern double	clock_max_fwd;		/* max forward offset before step (s) */
-extern double	clock_panic;		/* max offset before panic (s) */
 extern double	clock_phi;		/* dispersion rate (s/s) */
-extern double	clock_minstep;		/* step timeout (s) */
-#ifdef HAVE_KERNEL_PLL
-extern int	pll_status;		/* status bits for kernel pll */
-#endif /* HAVE_KERNEL_PLL */
 
 /*
  * Clock state machine control flags
@@ -320,7 +283,6 @@ extern bool	ntp_enable;		/* clock discipline enabled */
 extern bool	pll_control;		/* kernel support available */
 extern bool	kern_enable;		/* kernel support enabled */
 extern bool	hardpps_enable;		/* kernel PPS discipline enabled */
-extern bool	ext_enable;		/* external clock enabled */
 extern bool	cal_enable;		/* refclock calibrate enable */
 extern bool	allow_panic;		/* allow panic correction (-g) */
 extern bool	force_step_once;	/* always step time once at startup (-G) */
@@ -331,9 +293,7 @@ extern int	peer_ntpdate;		/* count of ntpdate peers */
  * Clock state machine variables
  */
 extern uint8_t	sys_poll;		/* system poll interval (log2 s) */
-extern int	state;			/* clock discipline state */
 extern int	tc_counter;		/* poll-adjust counter */
-extern u_long	last_time;		/* time of last clock update (s) */
 extern double	last_offset;		/* last clock offset (s) */
 extern uint8_t	allan_xpt;		/* Allan intercept (log2 s) */
 extern double	clock_jitter;		/* clock jitter (s) */


=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -155,7 +155,7 @@ static struct masks logcfg_class_items[] = {
  * Definitions of things either imported from or exported to outside
  */
 config_tree cfgt;			/* Parser output stored here */
-struct config_tree_tag *cfg_tree_history;	/* History of configs */
+static struct config_tree_tag *cfg_tree_history;    /* History of configs */
 char	*sys_phone[MAXPHONE] = {NULL};	/* ACTS phone numbers */
 
 static char default_ntp_signd_socket[] =


=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -600,6 +600,13 @@ static struct utsname utsnamebuf;
 keyid_t ctl_auth_keyid;
 
 /*
+ *  * A hack.  To keep the authentication module clear of ntp-ism's, we
+ *   * include a time reset variable for its stats here.
+ *    */
+static u_long auth_timereset;
+
+
+/*
  * We keep track of the last error reported by the system internally
  */
 static	uint8_t ctl_sys_last_event;
@@ -609,21 +616,21 @@ static	uint8_t ctl_sys_num_events;
 /*
  * Statistic counters to keep track of requests and responses.
  */
-u_long ctltimereset;		/* time stats reset */
-u_long numctlreq;		/* number of requests we've received */
-u_long numctlbadpkts;		/* number of bad control packets */
-u_long numctlresponses;		/* number of resp packets sent with data */
-u_long numctlfrags;		/* number of fragments sent */
-u_long numctlerrors;		/* number of error responses sent */
-u_long numctltooshort;		/* number of too short input packets */
-u_long numctlinputresp;		/* number of responses on input */
-u_long numctlinputfrag;		/* number of fragments on input */
-u_long numctlinputerr;		/* number of input pkts with err bit set */
-u_long numctlbadoffset;		/* number of input pkts with nonzero offset */
-u_long numctlbadversion;	/* number of input pkts with unknown version */
-u_long numctldatatooshort;	/* data too short for count */
-u_long numctlbadop;		/* bad op code found in packet */
-u_long numasyncmsgs;		/* number of async messages we've sent */
+static u_long ctltimereset;	/* time stats reset */
+static u_long numctlreq;	/* number of requests we've received */
+static u_long numctlbadpkts;	/* number of bad control packets */
+static u_long numctlresponses;	/* number of resp packets sent with data */
+static u_long numctlfrags;	/* number of fragments sent */
+static u_long numctlerrors;	/* number of error responses sent */
+static u_long numctltooshort;	/* number of too short input packets */
+static u_long numctlinputresp;	/* number of responses on input */
+static u_long numctlinputfrag;	/* number of fragments on input */
+static u_long numctlinputerr;	/* number of input pkts with err bit set */
+static u_long numctlbadoffset;	/* number of input pkts with nonzero offset */
+static u_long numctlbadversion;	/* number of input pkts with unknown version */
+static u_long numctldatatooshort;    /* data too short for count */
+static u_long numctlbadop;	/* bad op code found in packet */
+static u_long numasyncmsgs;	/* number of async messages we've sent */
 
 /*
  * Response packet used by these routines. Also some state information
@@ -4421,12 +4428,6 @@ free_varlist(
 /* from ntp_request.c when ntpdc was nuked */
 
 /*
- *  * A hack.  To keep the authentication module clear of ntp-ism's, we
- *   * include a time reset variable for its stats here.
- *    */
-u_long auth_timereset;
-
-/*
  *  * reset_auth_stats - reset the authentication stat counters.  Done here
  *   *                    to keep ntp-isms out of the authentication module
  *    */


=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -3173,7 +3173,7 @@ find_addr_in_list(
 }
 
 const char *
-localaddrtoa(
+latoa(
 	endpt *la
 	)
 {


=====================================
ntpd/ntp_loopfilter.c
=====================================
--- a/ntpd/ntp_loopfilter.c
+++ b/ntpd/ntp_loopfilter.c
@@ -106,8 +106,8 @@
  */
 double	clock_max_back = CLOCK_MAX;	/* step threshold */
 double	clock_max_fwd =  CLOCK_MAX;	/* step threshold */
-double	clock_minstep = CLOCK_MINSTEP; /* stepout threshold */
-double	clock_panic = CLOCK_PANIC; /* panic threshold */
+static double	clock_minstep = CLOCK_MINSTEP; /* stepout threshold */
+static double	clock_panic = CLOCK_PANIC; /* panic threshold */
 double	clock_phi = CLOCK_PHI;	/* dispersion rate (s/s) */
 uint8_t	allan_xpt = CLOCK_ALLAN; /* Allan intercept (log2 s) */
 
@@ -140,7 +140,7 @@ static char relative_path[PATH_MAX + 1]; /* relative path per recursive make */
 static char *this_file = NULL;
 
 static struct timex ntv;	/* ntp_adjtime() parameters */
-int	pll_status;		/* last kernel status bits */
+static int	pll_status;	/* last kernel status bits */
 #ifndef ENABLE_LOCKCLOCK
 #if defined(STA_NANO) && NTP_API == 4
 static u_int loop_tai;		/* last TAI offset */
@@ -157,7 +157,7 @@ bool	ntp_enable = true;	/* clock discipline enabled */
 bool	pll_control = false;	/* kernel support available */
 bool	kern_enable = true;	/* kernel support enabled */
 bool	hardpps_enable;		/* kernel PPS discipline enabled */
-bool	ext_enable;		/* external clock enabled */
+static bool	ext_enable;	/* external clock enabled */
 bool	allow_panic = false;	/* allow panic correction (-g) */
 bool	force_step_once = false; /* always step time once at startup (-G) */
 bool	mode_ntpdate = false;	/* exit on first clock set (-q) */
@@ -167,7 +167,7 @@ static int freq_set;		/* initial set frequency switch */
 /*
  * Clock state machine variables
  */
-int	state = 0;		/* clock discipline state */
+static int	state = 0;	/* clock discipline state */
 uint8_t	sys_poll;		/* time constant/poll (log2 s) */
 int	tc_counter;		/* jiggle counter */
 double	last_offset;		/* last offset (s) */


=====================================
ntpd/ntp_peer.c
=====================================
--- a/ntpd/ntp_peer.c
+++ b/ntpd/ntp_peer.c
@@ -115,6 +115,7 @@ static struct peer *	findexistingpeer_addr(sockaddr_u *,
 					      struct peer *, int);
 static void		free_peer(struct peer *, int);
 static void		getmorepeermem(void);
+static	void		peer_reset	(struct peer *);
 static int		score(struct peer *);
 
 
@@ -793,7 +794,7 @@ peer_clr_stats(void)
 /*
  * peer_reset - reset statistics counters
  */
-void
+static void
 peer_reset(
 	struct peer *peer
 	)


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -112,13 +112,14 @@ bool leap_sec_in_progress;
 l_fp	sys_authdelay;		/* authentication delay */
 double	sys_offset;	/* current local clock offset */
 double	sys_mindisp = MINDISPERSE; /* minimum distance (s) */
-double	sys_maxdist = MAXDISTANCE; /* selection threshold */
+static double	sys_maxdist = MAXDISTANCE; /* selection threshold */
 double	sys_maxdisp = MAXDISPERSE; /* maximum dispersion */
 double	sys_jitter;		/* system jitter */
 u_long	sys_epoch;		/* last clock update time */
 static	double sys_clockhop;	/* clockhop threshold */
 static int leap_vote_ins;	/* leap consensus for insert */
 static int leap_vote_del;	/* leap consensus for delete */
+static	u_long	leapsec;	/* seconds to next leap (proximity class) */
 keyid_t	sys_private;		/* private value for session seed */
 int	sys_manycastserver;	/* respond to manycast client pkts */
 int	peer_ntpdate;		/* active peers in ntpdate mode */
@@ -153,15 +154,16 @@ u_long	use_stattime;		/* elapsed time since reset */
 
 double	measured_tick;		/* non-overridable sys_tick (s) */
 
-static	double	root_distance	(struct peer *);
 static	void	clock_combine	(peer_select *, int, int);
-static	void	peer_xmit	(struct peer *);
-static	void	fast_xmit	(struct recvbuf *, int, keyid_t, int);
+static	void	clock_select	(void);
 static	void	clock_update	(struct peer *);
+static	void	fast_xmit	(struct recvbuf *, int, keyid_t, int);
+static	int	local_refid	(struct peer *);
 static	void	measure_precision(const bool);
 static	double	measure_tick_fuzz(void);
-static	int	local_refid	(struct peer *);
+static	void	peer_xmit	(struct peer *);
 static	int	peer_unfit	(struct peer *);
+static	double	root_distance	(struct peer *);
 
 
 void



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/31ff7bdacdd02d50a0c946a848e7d15fae460232...9acc95896fd435fd5136283f8a0d99c47b15aae9

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/31ff7bdacdd02d50a0c946a848e7d15fae460232...9acc95896fd435fd5136283f8a0d99c47b15aae9
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/20170523/efaf002c/attachment.html>


More information about the vc mailing list