[Git][NTPsec/ntpsec][ntpmon-dmode-hide-bug] 7 commits: Clean up debug-only error in ntp_proto

Eric S. Raymond gitlab at mg.gitlab.com
Sat Apr 15 11:00:55 UTC 2017


Eric S. Raymond pushed to branch ntpmon-dmode-hide-bug at NTPsec / ntpsec


Commits:
d99f76e6 by Hal Murray at 2017-04-14T23:22:35-07:00
Clean up debug-only error in ntp_proto

- - - - -
87ce9e62 by Hal Murray at 2017-04-14T23:22:35-07:00
Allow exit if no DNS ntp_seccomp

- - - - -
75beca8e by Eric S. Raymond at 2017-04-15T06:04:14-04:00
Attempt to address Gitlab issue #257: Warnings with clang 8...

...on macOS Sierra.  Untested.

- - - - -
2fb1b6c8 by Eric S. Raymond at 2017-04-15T06:14:41-04:00
Add sodium installation to buildprep where needed.

- - - - -
079516d1 by Eric S. Raymond at 2017-04-15T06:34:06-04:00
Improvements for systemd support from Tomáš Chvátal.

- - - - -
06199150 by Eric S. Raymond at 2017-04-15T06:48:46-04:00
Add instructions for setting up boot-time startup to INSTALLL...

...and systemd setup/teardown productioons to wscript. Analogous
productions for other init systems  need to be written.

- - - - -
e656368a by Ian Bruene at 2017-04-15T11:00:06+00:00
Fixed ntpmon detail / peers bug

ntpmon will crash if detail mode is active and peers are hidden, added
guards so that attempting to toggle either switch will correct the other one.

- - - - -


9 changed files:

- INSTALL
- buildprep
- + etc/ntp-wait.service
- etc/ntpd.service
- libntp/pymodule.c
- ntpclients/ntpmon
- ntpd/ntp_proto.c
- ntpd/ntp_sandbox.c
- wscript


Changes:

=====================================
INSTALL
=====================================
--- a/INSTALL
+++ b/INSTALL
@@ -141,10 +141,14 @@ Under Unix, the simplest way to compile this package is:
 
   6. You can uninstall cleanly by invoking `./waf uninstall' as root.
 
-  7. You can remove the program binaries and object files from the
+  7. Look under "Boot script setup" in wscript for how to set up
+     boot time startup of ntpd; this will vary according to your
+     init system.
+
+  8. You can remove the program binaries and object files from the
      source code directory by typing `./waf clean'.
 
-  8. To also remove the files that `./waf configure' created (so you can
+  9. To also remove the files that `./waf configure' created (so you can
      configure and compile the package for a different kind of
      computer), type `./waf distclean'.
 


=====================================
buildprep
=====================================
--- a/buildprep
+++ b/buildprep
@@ -118,17 +118,17 @@ daemon () {
     # Prerequisites to build the daemon: bison, pps-tools, service libraries
     case $installer in
 	apt)
-	    $install bison libssl-dev			# build
+	    $install bison libssl-dev libsodium-dev	# build
 	    $install libcap-dev libseccomp-dev		# build
 	    $install libavahi-compat-libdnssd-dev	# optional build
 	    $install libssl1.0.0 libcap2 pps-tools
 	    ;;
 	emerge)
-	    $install sys-libs/libcap sys-libs/libseccomp
+	    $install sys-libs/libcap sys-libs/libseccomp dev-libs/libsodium
 	    $install sys-devel/bison net-misc/pps-tools
 	    ;;
 	yum|dnf)
-	    $install bison openssl-devel 		# build
+	    $install bison openssl-devel sodium-devel	# build
 	    $install libcap-devel libseccomp-devel	# build
 	    $install pps-tools-devel			# build
 	    $install avahi-compat-libdns_sd-devel	# optional build
@@ -136,7 +136,7 @@ daemon () {
 	    ;;
 	yast)
 	    echo "# SLES versions 12 and earlier do not have pps-tools"
-	    $install basis-devel 			# build
+	    $install basis-devel			# build
 	    $install libcap-devel libseccomp-devel 	# build
 	    $install openssl-devel			# build
 	    $install libcap2 openssl-libs


=====================================
etc/ntp-wait.service
=====================================
--- /dev/null
+++ b/etc/ntp-wait.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Wait for ntpd to synchronize system clock
+Requires=ntpd.service
+After=ntpd.service
+Conflicts=systemd-timesyncd.service
+Wants=time-sync.target
+Before=time-sync.target
+ConditionVirtualization=!container
+ConditionCapability=CAP_SYS_TIME
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/ntpwait -s 1 -n 30000
+RemainAfterExit=yes
+StandardOutput=null
+
+[Install]
+WantedBy=multi-user.target


=====================================
etc/ntpd.service
=====================================
--- a/etc/ntpd.service
+++ b/etc/ntpd.service
@@ -1,5 +1,9 @@
 [Unit]
 Description=Network Time Service
+Documentation=man:ntpd(1)
+Wants=network.target
+ConditionVirtualization=!container
+ConditionCapability=CAP_SYS_TIME
 After=network.target nss-lookup.target
 Conflicts=systemd-timesyncd.service
 


=====================================
libntp/pymodule.c
=====================================
--- a/libntp/pymodule.c
+++ b/libntp/pymodule.c
@@ -165,8 +165,9 @@ PyDoc_STRVAR(module_doc,
 "Python wrapper for selected libntp C library routines.\n\
 ");
 
-/* banishes a pointless compiler warning */
+/* banishes pointless compiler warnings on verious Python versions */
 extern PyMODINIT_FUNC initntpc(void);
+extern PyMODINIT_FUNC PyInit_ntpc(void);
 
 // cppcheck-suppress unusedFunction
 NTPSEC_PY_MODULE_INIT(ntpc)


=====================================
ntpclients/ntpmon
=====================================
--- a/ntpclients/ntpmon
+++ b/ntpclients/ntpmon
@@ -338,8 +338,10 @@ if __name__ == '__main__':
                             selected = 0
                         selectmode = not selectmode
                         detailmode = not detailmode
+                        showpeers = True  # detail + hide peers == crash
                     elif key == 'm':
                         showpeers = not showpeers
+                        detailmode = False  # detail + hide peers == crash
                     elif key == 'n':
                         peer_report.showhostnames = \
                             not peer_report.showhostnames


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -2446,13 +2446,6 @@ if (NULL == server->dstadr)
 		peer_update_hash(server);
 		peer_xmit(server);
 
-#ifdef HAL_FIXED
-		DPRINTF(1, ("transmit: at %lu %s->%s pool\n",
-		    current_time, latoa(lcladr), socktoa(rmtadr)));
-#else
-		DPRINTF(1, ("transmit: at %lu ->%s pool\n",
-		    current_time, socktoa(rmtadr)));
-#endif
 		msyslog(LOG_INFO, "Setup server %s", socktoa(rmtadr));
 		return;
 	};


=====================================
ntpd/ntp_sandbox.c
=====================================
--- a/ntpd/ntp_sandbox.c
+++ b/ntpd/ntp_sandbox.c
@@ -297,6 +297,7 @@ int scmp_sc[] = {
 	SCMP_SYS(clock_settime),
 	SCMP_SYS(close),
 	SCMP_SYS(connect),
+	SCMP_SYS(exit),
 	SCMP_SYS(exit_group),
 	SCMP_SYS(fcntl),
 	SCMP_SYS(fstat),
@@ -354,8 +355,7 @@ int scmp_sc[] = {
 
 #ifdef ENABLE_DNS_LOOKUP
 	SCMP_SYS(clone),	/* threads */
-	SCMP_SYS(exit),
-	SCMP_SYS(futex),	/* sem_xxx */
+	SCMP_SYS(futex),	/* sem_xxx, used by threads */
 	SCMP_SYS(kill),		/* generate signal */
 	SCMP_SYS(madvise),
 	SCMP_SYS(mprotect),


=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -244,6 +244,18 @@ def build(ctx):
                   "loading the Python ntp library may be troublesome ---")
 
 #
+# Boot script setup
+#
+
+def systemdenable(ctx):
+    "Enable boot time start with systemd. Must run as root."
+    ctx.exec_command("cp etc/ntpd.service etc/ntp-wait.service /usr/lib/systemd/system/")
+
+def systemddisable(ctx):
+    "Disable boot time start with systemd. Must run as root."
+    ctx.exec_command("rm -f /usr/lib/systemd/system/ntpd.service /usr/lib/systemd/system/ntp-wait.service")
+
+#
 # Miscellaneous utility productions
 #
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/75755c9c01ec43bc855086dc419dddbe594f833f...e656368a3d4ac6429cb78c6ed6645764751d6857

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/75755c9c01ec43bc855086dc419dddbe594f833f...e656368a3d4ac6429cb78c6ed6645764751d6857
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/20170415/51fa25a8/attachment.html>


More information about the vc mailing list