[Git][NTPsec/ntpsec][unit-rewrite] 23 commits: Fix typos in buildprep

Ian Bruene gitlab at mg.gitlab.com
Tue Apr 11 00:34:22 UTC 2017


Ian Bruene pushed to branch unit-rewrite at NTPsec / ntpsec


Commits:
3af6ab6d by Hal Murray at 2017-04-10T02:53:32-07:00
Fix typos in buildprep

- - - - -
2f3e38ba by Hal Murray at 2017-04-10T02:58:51-07:00
Remove force_synchronous_dns and code it enables - never set

- - - - -
ed768b4c by Ian Bruene at 2017-04-10T19:33:03-05:00
Added scalestring() and tests.

scalestring() takes a number in string format and scales it like the
old scaleforunit(). By working with strings it sidesteps the entire
floating point inaccuracy problem.

- - - - -
93fd15c2 by Ian Bruene at 2017-04-10T19:33:03-05:00
Added docstring for scalestring, comment tweak.

- - - - -
44006ab3 by Ian Bruene at 2017-04-10T19:33:03-05:00
Added rescalestring() and tests.

rescalestring() scales a string value by a specified number of units, similar
to the former rescaleunit()

- - - - -
3f397afe by Ian Bruene at 2017-04-10T19:33:03-05:00
Added rescalestring() docstring.

- - - - -
51a72a4a by Ian Bruene at 2017-04-10T19:33:03-05:00
Added breaknumberstring() and tests.

breaknumberstring() breaks a number string into it's above and below decimal
parts, returning both and a bool for whether the number is negative

- - - - -
9df58cd6 by Ian Bruene at 2017-04-10T19:33:03-05:00
Added gluenumberstring(), tests.

gluenumberstring() is the inverse of breaknumberstring.

- - - - -
2c2cae93 by Ian Bruene at 2017-04-10T19:33:03-05:00
Replaced duplicated code in scalestring() and rescalestring() with calls
to breaknumberstring() and gluenumberstring()

- - - - -
29e76f9c by Ian Bruene at 2017-04-10T19:33:03-05:00
Added fitinfield() and tests.

fitinfield() attempts to fit a value in a given field size, padding if there
is extra room, cropping if there is not enough room. fitinfield() will never
crop above the decimal point.

- - - - -
c5f0524c by Ian Bruene at 2017-04-10T19:33:03-05:00
Added scalestring() and tests.

scalestring() takes a number in string format and scales it like the
old scaleforunit(). By working with strings it sidesteps the entire
floating point inaccuracy problem.

- - - - -
e3bcf4e5 by Ian Bruene at 2017-04-10T19:33:03-05:00
Added docstring for scalestring, comment tweak.

- - - - -
92cec3be by Ian Bruene at 2017-04-10T19:33:03-05:00
Added rescalestring() and tests.

rescalestring() scales a string value by a specified number of units, similar
to the former rescaleunit()

- - - - -
806df80b by Ian Bruene at 2017-04-10T19:33:03-05:00
Added rescalestring() docstring.

- - - - -
79e60c8c by Ian Bruene at 2017-04-10T19:33:03-05:00
Added breaknumberstring() and tests.

breaknumberstring() breaks a number string into it's above and below decimal
parts, returning both and a bool for whether the number is negative

- - - - -
dd29a15d by Ian Bruene at 2017-04-10T19:33:04-05:00
Added gluenumberstring(), tests.

gluenumberstring() is the inverse of breaknumberstring.

- - - - -
32d62fb4 by Ian Bruene at 2017-04-10T19:33:04-05:00
Replaced duplicated code in scalestring() and rescalestring() with calls
to breaknumberstring() and gluenumberstring()

- - - - -
8d109bd7 by Ian Bruene at 2017-04-10T19:33:04-05:00
Added fitinfield() and tests.

fitinfield() attempts to fit a value in a given field size, padding if there
is extra room, cropping if there is not enough room. fitinfield() will never
crop above the decimal point.

- - - - -
284132d9 by Ian Bruene at 2017-04-10T19:33:04-05:00
Forced commit because rebase needed

- - - - -
9869445a by Ian Bruene at 2017-04-10T19:33:04-05:00
Added unitify() and several helper functions with tests.

unitify() is the string replaement for unitformatter()

- - - - -
1bb60c6c by Ian Bruene at 2017-04-10T19:33:04-05:00
Fixed unitify strip bug, added neglected tests.

- - - - -
d9950e22 by Ian Bruene at 2017-04-10T19:33:04-05:00
Added stringfiltcooker() and tests. Related bugfix for rescalestring().

- - - - -
af276390 by Ian Bruene at 2017-04-10T19:33:24-05:00
Merge branch 'unit-rewrite' of gitlab.com:NTPsec/ntpsec into unit-rewrite

Rebase merge

- - - - -


3 changed files:

- buildprep
- include/ntp_config.h
- ntpd/ntp_config.c


Changes:

=====================================
buildprep
=====================================
--- a/buildprep
+++ b/buildprep
@@ -209,8 +209,8 @@ doc () {
 		$install app-text/asciidoc
 		;;
 	 yum|dnf)
-                echo "# Please check that you asciidoc is at least 8.6.0"
-		echo "# You may nee to enable EPEL repositories"
+		echo "# Please check that your asciidoc is at least 8.6.0"
+		echo "# You may need to enable EPEL repositories"
 		$install asciidoc
 		;;
 	 yast|zypper)


=====================================
include/ntp_config.h
=====================================
--- a/include/ntp_config.h
+++ b/include/ntp_config.h
@@ -33,7 +33,6 @@
 /* list of servers from command line for config_peers() */
 extern	int	cmdline_server_count;
 extern	char **	cmdline_servers;
-extern	bool	force_synchronous_dns;
 
 typedef struct int_range_tag {
 	int	first;


=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -77,12 +77,9 @@
 #define REFCLOCKUNIT(srcadr)	(SRCADR(srcadr) & 0xff)
 
 
-static bool getaddrinfo_now(char *, sockaddr_u *);
-
 /* list of servers from command line for config_peers() */
 int	cmdline_server_count = 0;
 char **	cmdline_servers;
-bool	force_synchronous_dns = false;
 
 /*
  * FIXME: ugly globals, only created to avoid wiring in option-parsing cruft.
@@ -1459,40 +1456,6 @@ free_config_monitor(
 	FREE_FILEGEN_FIFO(ptree->filegen_opts);
 }
 
-static
-bool getaddrinfo_now(char *hname, sockaddr_u *peeraddrp)
-{
-	int a_info;
-	size_t octets;
-	struct addrinfo		hints, *res;
-	ZERO(hints);
-	hints.ai_family = AF_UNSPEC;
-	hints.ai_socktype = SOCK_DGRAM;
-	hints.ai_protocol = IPPROTO_UDP;
-	a_info = getaddrinfo(hname, "ntp", &hints, &res);
-	if (a_info == EAI_NONAME
-#ifdef EAI_NODATA
-	    || a_info == EAI_NODATA
-#endif
-	    ) {
-	    hints.ai_flags = AI_CANONNAME;
-	    hints.ai_flags |= AI_ADDRCONFIG;
-	    a_info = getaddrinfo(hname, "ntp", &hints, &res);
-	}
-	if (a_info != 0) {
-	    msyslog(LOG_ERR,
-		    "hostname %s can not be used (%s), please use IP address.",
-		    hname, gai_strerror(a_info));
-	    return false;
-	} else {
-	    INSIST(res != NULL);
-	    memset(peeraddrp, '\0', sizeof(*peeraddrp));
-	    octets = min(sizeof(*peeraddrp), res->ai_addrlen);
-	    memcpy(peeraddrp, res->ai_addr, octets);
-	    freeaddrinfo(res);
-	    return true;
-	}
-}
 
 static void
 config_access(
@@ -2703,15 +2666,6 @@ config_peers(
 				NULL,
 				MODE_CLIENT,
 				&client_ctl);
-	    } else if (force_synchronous_dns) {
-		if (getaddrinfo_now(*cmdline_servers, &peeraddr)) {
-			peer_config(
-				&peeraddr,
-				NULL,
-				NULL,
-				MODE_CLIENT,
-				&client_ctl);
-		}
 	    } else {
 		/* we have a hostname to resolve */
 # ifdef USE_WORKER
@@ -2834,15 +2788,6 @@ config_peers(
 	/*
 	 * synchronous lookup may be forced.
 	 */
-	} else if (force_synchronous_dns) {
-		if (getaddrinfo_now(curr_peer->addr->address, &peeraddr)) {
-			peer_config(
-				&peeraddr,
-				NULL,
-				NULL,
-				hmode,
-				&curr_peer->ctl);
-		}
 	} else {
 	    /* hand the hostname off to the blocking child */
 # ifdef USE_WORKER



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/cc311f04af5fe88c208f0136e0201a488ba61bf6...af276390cbf11afaf1716136b32d28c708ce06df
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170411/c774c7ff/attachment.html>


More information about the vc mailing list