[Git][NTPsec/ntpsec][fixinstall] 11 commits: Address Gitlab issue #422: Build warnings for implicit declaration of function

Ian Bruene gitlab at mg.gitlab.com
Tue Dec 5 16:21:33 UTC 2017


Ian Bruene pushed to branch fixinstall at NTPsec / ntpsec


Commits:
5fa4e658 by Eric S. Raymond at 2017-12-03T16:37:55-05:00
Address Gitlab issue #422: Build warnings for implicit declaration of function

Note: this commit forms a unit with "Experimental removal of HAVE_KERNEL_PLL."
If either are referted, both should be.

- - - - -
87223f79 by Hal Murray at 2017-12-04T02:18:31-08:00
Remove isc from various library lists

It was nuked ages ago.

- - - - -
49f49246 by Hal Murray at 2017-12-04T02:18:31-08:00
Remove --disable-kernel-pll from tests/option-tester.sh

It doesn't work after Eric's removal of HAVE_KERNEL_PLL

- - - - -
af86651f by Eric S. Raymond at 2017-12-04T11:42:22-05:00
Address GitLab issue #420: NTPsec gets bad responses from Amazon NTP servers

Fix due to Miroslav Lichvar.

Note: Zeroing this member instead would conform to a draft RFC on data
minimization now in process.  A future direction, but we want to
verify that we've restored expected behavior first.

- - - - -
3c1cc3c8 by Hal Murray at 2017-12-04T20:43:18-08:00
Fix ntpq -c direct -c mrulist to output seconds

Problem was that int/int gives an int on python 2 but float on python 3

- - - - -
31d6e42a by Matt Selsky at 2017-12-05T02:21:17-05:00
Add gitlab-ci builds for latest Debian and Ubuntu releases

Add Debian Stretch/9
Add Ubuntu 14.04 LTS
Add Ubuntu 16.04 LTS
Add Ubuntu 17.10

- - - - -
85b39ec9 by Eric S. Raymond at 2017-12-05T08:54:13-05:00
Formally drop support for systems without ntp_adjtime(2).

However, restore building omnmn Solaris, which doesn't have STA_* symbols
in timex.h. Reporting of the kernel status word will be degraded on these
systems.

- - - - -
992e5163 by Eric S. Raymond at 2017-12-05T09:43:07-05:00
Address GitLab issue #19: Peer stat "time last received" not updated

- - - - -
6b316eee by Eric S. Raymond at 2017-12-05T09:48:07-05:00
Sigh, Mac OS X 10.13 did not implement ntp_adjtime(2).

- - - - -
2052ed6c by Eric S. Raymond at 2017-12-05T10:55:41-05:00
Address GitLab issue #415: Minimal config fails on some hosts

- - - - -
f1f98aaa by Ian Bruene at 2017-12-05T10:21:00-06:00
Build script switches to site-packages on user install if necessary

This fixes the FHS violation in bug #414

- - - - -


18 changed files:

- .gitlab-ci.yml
- INSTALL
- NEWS
- attic/wscript
- devel/tour.txt
- include/ntp_syscall.h
- libntp/clockwork.c
- libntp/statestr.c
- ntpd/ntp_proto.c
- ntpd/ntpd.c
- ntpd/wscript
- ntptime/wscript
- pylib/util.py
- pylib/wscript
- tests/option-tester.sh
- tests/pylib/test_util.py
- tests/wscript
- wscript


Changes:

=====================================
.gitlab-ci.yml
=====================================
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -99,6 +99,70 @@ debian-jessie-refclocks:
   tags:
     - debian-jessie
 
+debian-stretch-basic:
+  <<: *job_definition
+  script:
+    - python ./waf configure build
+    - python -m unittest discover -s build/main/tests/pylib
+  tags:
+    - debian-stretch
+
+debian-stretch-refclocks:
+  <<: *job_definition
+  script:
+    - python ./waf configure --refclock=all build
+    - python -m unittest discover -s build/main/tests/pylib
+  tags:
+    - debian-stretch
+
+ubuntu-1404-lts-basic:
+  <<: *job_definition
+  script:
+    - python ./waf configure build
+    - python -m unittest discover -s build/main/tests/pylib
+  tags:
+    - ubuntu-1404-lts
+
+ubuntu-1404-lts-refclocks:
+  <<: *job_definition
+  script:
+    - python ./waf configure --refclock=all build
+    - python -m unittest discover -s build/main/tests/pylib
+  tags:
+    - ubuntu-1404-lts
+
+ubuntu-1604-lts-basic:
+  <<: *job_definition
+  script:
+    - python ./waf configure build
+    - python -m unittest discover -s build/main/tests/pylib
+  tags:
+    - ubuntu-1604-lts
+
+ubuntu-1604-lts-refclocks:
+  <<: *job_definition
+  script:
+    - python ./waf configure --refclock=all build
+    - python -m unittest discover -s build/main/tests/pylib
+  tags:
+    - ubuntu-1604-lts
+
+ubuntu-1710-basic:
+  <<: *job_definition
+  script:
+    - python ./waf configure build
+    - python -m unittest discover -s build/main/tests/pylib
+  tags:
+    - ubuntu-1710
+
+ubuntu-1710-refclocks:
+  <<: *job_definition
+  script:
+    - python ./waf configure --refclock=all build
+    - python -m unittest discover -s build/main/tests/pylib
+  tags:
+    - ubuntu-1710
+
 gcc-7-basic:
   <<: *job_definition
   image: gcc:7


=====================================
INSTALL
=====================================
--- a/INSTALL
+++ b/INSTALL
@@ -4,10 +4,10 @@
 
 This software should build on any operating system conformant to
 POSIX.1-2001 and ISO/IEC 9899:1999 (C99).  In addition, the operating
-system must have an ntp_adjtime(2) call or the older BSD adjtime(2)
-call. Also, it must support the IPv6 API defined in RFC 2493 and
-RFC 2553. Finally, it must support iterating over active UDP interfaces
-via getifaddrs(3) or some equivalent facility.
+system must have an ntp_adjtime(2) call. Also, it must support the
+IPv6 API defined in RFC 2493 and RFC 2553. Finally, it must support
+iterating over active UDP interfaces via getifaddrs(3) or some
+equivalent facility.
 
 You can browse a summary of differences from legacy NTP here:
 
@@ -123,33 +123,6 @@ Under Unix, the simplest way to compile this package is:
      configure and compile the package for a different kind of
      computer), type `./waf distclean'.
 
-=== Apple ===
-
-Under OS X you can build NTPsec using Xcode command line tools with no
-additions. There is currently no support for using Xcode's builder.
-
-Previous support for OS X 10.11 has been dropped due to multiple
-botches on Apple's part.  Your OS X needs to have POSIX compliant
-clock_gettime(2) and clock_settime(2) functions.
-
-The OS X build has been tested in this environment:
-
- OS X Version             : 10.12
- Xcode Version            : 7.1
- Xcode Command Line Tools : 7.2-beta
-
-The macOS build has been tested in this environment:
-
- macOS Version            : 16.3.0
- Xcode Version            : 8.2.1
-
-All you will require is the Xcode command line tools with no additions.
-There is currently no support for using Xcode's builder. NTPsec's standard
-waf based build system is used.
-
-To disable Apple's NTP, open the Date & Time Preferences and uncheck
-"Set date and time automatically".
-
 === Solaris ===
 
 When building the NTPsec suite using gcc under Solaris, you may see


=====================================
NEWS
=====================================
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,13 @@ It is now possible to unpeer refclocks using a type/unit specification
 rather than a magic IP address.  This was the last obligatory use of
 magic IP addresses in the configuration grammar.
 
+OpenBSD has been removed from the list of supported platforms for
+ntpd. It will be restored if and when its clock API supports drift
+adjustment via ntp_adjtime() or equivalent facility.
+
+Mac OS X support has been dropped pending the implementation of
+ntp_adjtime(2).
+
 == 2017-10-10: 1.0.0 ==
 
 This is the 1.0 release.


=====================================
attic/wscript
=====================================
--- a/attic/wscript
+++ b/attic/wscript
@@ -9,6 +9,6 @@ def build(ctx):
             features="c cprogram bld_include src_include",
             source=[name + ".c"],
             includes=["%s/%s/" % (bldnode, name)],
-            use="ntp isc M SSL CRYPTO RT THR PTHREAD",
+            use="ntp M SSL CRYPTO RT THR PTHREAD",
             install_path=None,
         )


=====================================
devel/tour.txt
=====================================
--- a/devel/tour.txt
+++ b/devel/tour.txt
@@ -196,11 +196,12 @@ quite a while before NTPsec removed it.
 == System call interface and the PLL ==
 
 All of ntpd's clock management is done through four system calls:
-clock_gettime(2), clock_settime(2), and either ntp_adjtime(2) or the
-older BSD adjtime(2) call.  For ntp_adjtime(), ntpd actually uses a
-thin wrapper that hides the difference between systems with
-nanosecond-precision and those with only microsecond precision;
-internally, ntpd does all its calculations with nanosecond precision.
+clock_gettime(2), clock_settime(2), and either ntp_adjtime(2) or (in
+exceptional cases) the older BSD adjtime(2) call.  For ntp_adjtime(),
+ntpd actually uses a thin wrapper that hides the difference between
+systems with nanosecond-precision and those with only microsecond
+precision; internally, ntpd does all its calculations with nanosecond
+precision.
 
 The clock_gettime(2) and clock_settime(2) calls are standardized in
 POSIX; ntp_adjtime(2) is not, exhibiting some variability in
@@ -261,10 +262,12 @@ do its work, using a control technique called a PLL/FLL (phase-locked
 loop/frequency-locked loop) to do it.
 
 The older BSD adjtime(2) can be used for slewing as well, but doesn't
-assume a kernel-level PLL is available.  Some platforms, like OpenBSD
-and Mac OS X, use only this call because they lack ntp_adjtime(2).
-Without the PLL calls, convergence to good time is observably a lot
-slower and tracking will accordingly be less reliable.
+assume a kernel-level PLL is available.  It is used only when
+ntp_adjtime() calls generate a SIGSYS because the system call has not
+been implemented.  Without the PLL calls, convergence to good time is
+observably a lot slower and tracking will accordingly be less
+reliable; support for systems that lack them (notably OpenBSD and
+older Mac OS X versions) has been dropped fom NTPsec.
 
 Deep-in-the weeds details about the kernel PLL from Hal Murray follow.
 If you can follow these you may be qualified to maintain this code...


=====================================
include/ntp_syscall.h
=====================================
--- a/include/ntp_syscall.h
+++ b/include/ntp_syscall.h
@@ -9,23 +9,11 @@
 #ifndef GUARD_NTP_SYSCALL_H
 #define GUARD_NTP_SYSCALL_H
 
-#ifdef HAVE_SYS_TIMEX_H
 # include <sys/time.h>	/* prerequisite on NetBSD */
 # include <sys/timex.h>
 extern int ntp_adjtime_ns(struct timex *);
-#endif
 
-/*
- * The units of the maxerror and esterror fields vary by platform.  If
- * STA_NANO is defined, they're in nanoseconds; otherwise in
- * microseconds. Hide the difference by normalizing everything to
- * float seconds.
- */
-# ifdef STA_NANO
 #define ntp_error_in_seconds(n)	((n)/1.0e9)
-# else
-#define ntp_error_in_seconds(n)	((n)/1.0e6)
-# endif
 
 /* MUSL port shim */
 #if !defined(HAVE_NTP_ADJTIME) && defined(HAVE_ADJTIMEX)


=====================================
libntp/clockwork.c
=====================================
--- a/libntp/clockwork.c
+++ b/libntp/clockwork.c
@@ -6,10 +6,8 @@
 
 #include "config.h"
 
-#ifdef HAVE_SYS_TIMEX_H
 # include <sys/time.h>	/* prerequisite on NetBSD */
 # include <sys/timex.h>
-#endif
 
 #include "ntp.h"
 #include "ntp_machine.h"


=====================================
libntp/statestr.c
=====================================
--- a/libntp/statestr.c
+++ b/libntp/statestr.c
@@ -190,22 +190,54 @@ static const struct codestring res_access_bits[] = {
  * kernel discipline status bits
  */
 static const struct codestring k_st_bits[] = {
+# ifdef STA_PLL
 	{ STA_PLL,			"pll" },
+# endif
+# ifdef STA_PPSFREQ
 	{ STA_PPSFREQ,			"ppsfreq" },
+# endif
+# ifdef STA_PPSTIME
 	{ STA_PPSTIME,			"ppstime" },
+# endif
+# ifdef STA_FLL
 	{ STA_FLL,			"fll" },
+# endif
+# ifdef STA_INS
 	{ STA_INS,			"ins" },
+# endif
+# ifdef STA_DEL
 	{ STA_DEL,			"del" },
+# endif
+# ifdef STA_UNSYNC
 	{ STA_UNSYNC,			"unsync" },
+# endif
+# ifdef STA_FREQHOLD
 	{ STA_FREQHOLD,			"freqhold" },
+# endif
+# ifdef STA_PPSSIGNAL
 	{ STA_PPSSIGNAL,		"ppssignal" },
+# endif
+# ifdef STA_PPSJITTER
 	{ STA_PPSJITTER,		"ppsjitter" },
+# endif
+# ifdef STA_PPSWANDER
 	{ STA_PPSWANDER,		"ppswander" },
+# endif
+# ifdef STA_PPSERROR
 	{ STA_PPSERROR,			"ppserror" },
+# endif
+# ifdef STA_CLOCKERR
 	{ STA_CLOCKERR,			"clockerr" },
+# endif
+# ifdef STA_NANO
 	{ STA_NANO,			"nano" },
+# endif
+# ifdef STA_MODE
 	{ STA_MODE,			"mode=fll" },
+# endif
+# ifdef STA_CLK
 	{ STA_CLK,			"src=B" },
+# endif
 	/* not used with getcode(), no terminating entry needed */
 };
 


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -849,6 +849,11 @@ receive(
 		}
 	}
 
+	if (peer != NULL) {
+	    	peer->received++;
+		peer->timereceived = current_time;
+	}
+
 	switch(match) {
 	    case AM_FXMIT:
             case AM_NEWPASS:
@@ -2188,7 +2193,7 @@ peer_xmit(
 	xpkt.rootdelay = HTONS_FP(DTOUFP(sys_rootdelay));
 	xpkt.rootdisp =	 HTONS_FP(DTOUFP(sys_rootdisp));
 	xpkt.reftime = htonl_fp(sys_reftime);
-	xpkt.org = htonl_fp(peer->rec);
+	xpkt.org = htonl_fp(peer->xmt);
 	xpkt.rec = htonl_fp(peer->dst);
 
 	/*


=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -830,7 +830,9 @@ ntpdmain(
 	if (dumpopts) {
 	    if (explicit_config)
 		fprintf(stdout, "conffile \"%s\";\n", explicit_config);
+#ifdef DEBUG
 	    fprintf(stdout, "#debug = %d\n", debug);
+#endif /* DEBUG */
 	    if (driftfile)
 		fprintf(stdout, "driftfile \"%s\";\n", driftfile);
 	    fprintf(stdout, "#allow_panic = %s\n",


=====================================
ntpd/wscript
=====================================
--- a/ntpd/wscript
+++ b/ntpd/wscript
@@ -129,7 +129,7 @@ def build(ctx):
         install_path='${SBINDIR}',
         source=ntpd_source,
         target="ntpd",
-        use="libntpd_obj isc ntp M parse RT CAP SECCOMP PTHREAD NTPD "
+        use="libntpd_obj ntp M parse RT CAP SECCOMP PTHREAD NTPD "
             "CRYPTO DNS_SD DNS_SD_INCLUDES %s SOCKET NSL SCF" % use_refclock,
     )
 


=====================================
ntptime/wscript
=====================================
--- a/ntptime/wscript
+++ b/ntptime/wscript
@@ -10,7 +10,7 @@ def build(ctx):
             includes=["%s/ntptime/" % bldnode,
                       "%s/ntptime/" % srcnode,
                       ],
-            use="ntp isc M RT",
+            use="ntp M RT",
             install_path='${BINDIR}',
         )
 


=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -1150,9 +1150,7 @@ class MRUSummary:
         else:
             # direct mode doesn't have a reference time
             MJD_1970 = 40587     # MJD for 1 Jan 1970, Unix epoch
-            days = int(last) / 86400
-            seconds = last - days*86400
-            lstint = int(seconds)
+            days, lstint = divmod(int(last), 86400)
             stats = "%5d %5d" % (days + MJD_1970, lstint)
         first = ntp.ntpc.lfptofloat(entry.first)
         active = float(last - first)


=====================================
pylib/wscript
=====================================
--- a/pylib/wscript
+++ b/pylib/wscript
@@ -11,6 +11,14 @@ def configure(conf):
     fixed.load('python')
     fixed.check_python_version((2, 6, 0))
     conf.check_python_headers(features='pyext')  # Extension-only, no embedded
+    # Library directory hack, dist-packages is what python reports.
+    # That is reserved by the FHS, we have to use site-packages for user
+    # installs. Distribution installs can use dist-packages.
+    if "/usr/local/" in conf.env.PYTHONDIR:
+        if "dist-packages" in conf.env.PYTHONDIR:
+            conf.env.PYTHONDIR = conf.env.PYTHONDIR.replace("dist", "site")
+        if "dist-packages" in conf.env.PYTHONARCHDIR:
+            conf.env.PYTHONARCHDIR = conf.env.PYTHONARCHDIR.replace("dist", "site")
 
 
 def build(ctx):


=====================================
tests/option-tester.sh
=====================================
--- a/tests/option-tester.sh
+++ b/tests/option-tester.sh
@@ -55,7 +55,7 @@ doit ()
 }
 
 doit default ""
-doit minimal "--disable-droproot --disable-dns-lookup --disable-kernel-pll --disable-mdns-registration"
+doit minimal "--disable-droproot --disable-dns-lookup --disable-mdns-registration"
 
 # This also tests refclocks without DEBUG
 doit classic "--enable-classic-mode --refclock=all"


=====================================
tests/pylib/test_util.py
=====================================
--- a/tests/pylib/test_util.py
+++ b/tests/pylib/test_util.py
@@ -895,7 +895,7 @@ class TestPylibUtilMethods(unittest.TestCase):
             fakesockmod.gai_returns = [("fam", "type", "proto",
                                         "foo.bar.com", "1.2.3.4")]
             self.assertEqual(cls.summary(ent),
-                             "64730     0      0  400 K 7 2"
+                             "64730 23296      0  400 K 7 2"
                              "      1    42 1.2.3.4")
             # Test summary, second options
             mycache._cache = {}
@@ -909,7 +909,7 @@ class TestPylibUtilMethods(unittest.TestCase):
                                          "foo.bar.com", ("1.2.3.4", 42))]]
             cdns_jig_returns = ["foo.com"]
             self.assertEqual(cls.summary(ent),
-                             "64730     0   4.00   20 L 7 2     65"
+                             "64730 23808   4.00   20 L 7 2     65"
                              "    42 foo.com")
             # Test summary, third options
             mycache._cache = {}
@@ -918,7 +918,7 @@ class TestPylibUtilMethods(unittest.TestCase):
             fakesockmod.gai_error_count = 1
             cdns_jig_returns = ["foobarbaz" * 5]  # 45 chars, will be cropped
             self.assertEqual(cls.summary(ent),
-                             "64730     0    256    0 . 7 2      2    42"
+                             "64730 23808    256    0 . 7 2      2    42"
                              " 1.2.3.4 (foobarbazfoobarbazfoobarbazfoob")
             # Test summary, wide
             mycache._cache = {}
@@ -926,7 +926,7 @@ class TestPylibUtilMethods(unittest.TestCase):
             fakesockmod.gai_error_count = 1
             cdns_jig_returns = ["foobarbaz" * 5]  # 45 chars, will be cropped
             self.assertEqual(cls.summary(ent),
-                             "64730     0    256    0 . 7 2      2"
+                             "64730 23808    256    0 . 7 2      2"
                              "    42 1.2.3.4 "
                              "(foobarbazfoobarbazfoobarbazfoobarbazfoobarbaz)")
         finally:


=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -65,7 +65,7 @@ def build(ctx):
                   "%s/tests/ntpdig/" % srcnode,
                   "%s/tests/common/" % srcnode
                   ] + ctx.env.PLATFORM_INCLUDES,
-        use="unity ntp isc parse M PTHREAD CRYPTO RT SOCKET NSL",
+        use="unity ntp parse M PTHREAD CRYPTO RT SOCKET NSL",
         source=libntp_source,
     )
 
@@ -91,7 +91,7 @@ def build(ctx):
             libpath=["libparse"],
             source=libparse_source,
             target="test_libparse",
-            use="unity ntp isc parse M PTHREAD CRYPTO RT SOCKET NSL",
+            use="unity ntp parse M PTHREAD CRYPTO RT SOCKET NSL",
         )
 
     ntpd_source = [
@@ -111,7 +111,7 @@ def build(ctx):
         install_path=None,
         source=ntpd_source,
         target="test_ntpd",
-        use="ntpd_lib libntpd_obj unity ntp isc "
+        use="ntpd_lib libntpd_obj unity ntp "
             "M PTHREAD CRYPTO RT SOCKET NSL",
     )
 


=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -567,13 +567,13 @@ int main(int argc, char **argv) {
         ctx.define("__EXTENSIONS__", "1", quote=False)
 
     structures = (
-        ("struct if_laddrconf", ["sys/types.h", "net/if6.h"]),
-        ("struct if_laddrreq", ["sys/types.h", "net/if6.h"]),
-        ("struct timex", ["sys/time.h", "sys/timex.h"]),
-        ("struct ntptimeval", ["sys/time.h", "sys/timex.h"]),
+        ("struct if_laddrconf", ["sys/types.h", "net/if6.h"], False),
+        ("struct if_laddrreq", ["sys/types.h", "net/if6.h"], False),
+        ("struct timex", ["sys/time.h", "sys/timex.h"], True),
+        ("struct ntptimeval", ["sys/time.h", "sys/timex.h"], False),
     )
-    for (s, h) in structures:
-        ctx.check_cc(type_name=s, header_name=h, mandatory=False)
+    for (s, h, r) in structures:
+        ctx.check_cc(type_name=s, header_name=h, mandatory=r)
 
     # waf's SNIP_FIELD should likely include this header itself
     # This is needed on some systems to get size_t for following checks



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/5a5fedcafb84d85bdd0b2af29737f95a1e9cca2c...f1f98aaab30bc6d6846d993aeaa4533e7fe63036

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/5a5fedcafb84d85bdd0b2af29737f95a1e9cca2c...f1f98aaab30bc6d6846d993aeaa4533e7fe63036
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/20171205/3b051667/attachment.html>


More information about the vc mailing list