[Git][NTPsec/ntpsec][ntpq-flag-changes] 13 commits: move gpstolfp.c back into libparse
Ian Bruene
gitlab at mg.gitlab.com
Fri Jun 9 20:40:46 UTC 2017
Ian Bruene pushed to branch ntpq-flag-changes at NTPsec / ntpsec
Commits:
3d610723 by Trevor N at 2017-06-07T21:56:04-04:00
move gpstolfp.c back into libparse
related to issue #320 and mailing list comment https://lists.ntpsec.org/pipermail/devel/2017-May/004519.html
this patch makes the Trimble refclock depend on libparse
- - - - -
1776bf69 by Gary E. Miller at 2017-06-08T15:52:00-07:00
SHM: change implicit casts to explicit: (enum segstat_t)
- - - - -
f86603f6 by Gary E. Miller at 2017-06-08T16:03:03-07:00
Sandbox: comment on odd Apple behavior.
For some odd reason initgroups() tkes an int, instead of git_t, for
the second argument. Even though the 2nd argument is clearly a gid.
Apple makes this work by making gid_t a unit32_t and so an int can
hold it.
- - - - -
9e940cf1 by Trevor N at 2017-06-08T17:10:59-07:00
Merge branch 'trv-n/ntpsec-master', MR477, Issue #320
Sorry for the delay, this should fix issue #320
Signed-off-by: Gary E. Miller <gem at rellim.com>
- - - - -
5ea2eb15 by Gary E. Miller at 2017-06-08T17:40:12-07:00
Change netof() to netof6(). IPv6 only.
netof() never did anything useful with IPv4, and was never used
on IPv6. Not really useful on IPv6, it just masks an IPv6 to /64.
- - - - -
1f40056d by Gary E. Miller at 2017-06-08T19:42:02-07:00
restrict: Ignore CIDR in restrict address.
One small step to accepting CIDR notation.
This is now accepted: restrict 10.169.0.0/16
But is is the same as: restrict 10.169.0.0 mask 255.255.255.255
- - - - -
0430e6a7 by Matt Selsky at 2017-06-08T23:42:39-04:00
Replace "uint" with "unsigned int"
The former is a SysV compatibility typedef on many systems and we need to set
fewer magic defines per standards(5) on Solaris if we just do a global search
and replace.
- - - - -
7695105a by Matt Selsky at 2017-06-09T03:49:25+00:00
Typo
- - - - -
a00f7ee8 by Matt Selsky at 2017-06-09T00:54:42-04:00
Properly set compatibility defines for Solaris
struct msghdr has all of the members specified by POSIX, if you set the defines
correctly.
Fixes Gitlab issue #342
- - - - -
ba2972b5 by Matt Selsky at 2017-06-09T01:02:39-04:00
Update capitalization of macOS to use new official style
- - - - -
687f7cb7 by Hal Murray at 2017-06-09T01:43:35-07:00
Update devel/TODO
- - - - -
e40d60d5 by Hal Murray at 2017-06-09T13:24:35-07:00
Add waf quirks to devel/TODO
- - - - -
7be3903a by Ian Bruene at 2017-06-09T20:39:31+00:00
ntpq interactive switch shot by firing squad for redundancy
Either receives a command through -c or -p and won't have a prompt,
or it does not and will have a prompt. The -i switch can't do anything.
- - - - -
26 changed files:
- INSTALL
- attic/sht.c
- buildprep
- devel/TODO
- docs/includes/ntpq-body.txt
- include/ntp_stdlib.h
- libntp/clocktime.c
- libntp/netof.c
- libntp/wscript
- libntp/gpstolfp.c → libparse/gpstolfp.c
- libparse/wscript
- ntpclients/ntpq
- ntpd/ntp_config.c
- ntpd/ntp_io.c
- ntpd/ntp_packetstamp.c
- ntpd/ntp_proto.c
- ntpd/ntp_sandbox.c
- ntpd/refclock_neoclock.c
- ntpd/refclock_shm.c
- tests/common/tests_main.c
- tests/libntp/macencrypt.c
- tests/libntp/netof.c
- tests/libparse/binio.c
- tests/libntp/gpstolfp.c → tests/libparse/gpstolfp.c
- tests/wscript
- wscript
Changes:
=====================================
INSTALL
=====================================
--- a/INSTALL
+++ b/INSTALL
@@ -29,7 +29,7 @@ truth about package requirements, much information about
installable-package names that used to live in this file has moved to
that script.
-If you are using other distributions or OSes, such as MacOS, Solaris,
+If you are using other distributions or OSes, such as macOS, Solaris,
or *BSD, you will have to install the build prerequisites by hand on
your system. Read the buildprep script to get an idea what packages
are required.
@@ -105,16 +105,16 @@ The OS X build has been tested in this environment:
Xcode Version : 7.1
Xcode Command Line Tools : 7.2-beta
-The MacOS build has been tested in this environment:
+The macOS build has been tested in this environment:
- MacOS Version : 16.3.0
+ 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.
-On MacOS you can use this command to turn off the Apple version of NTP:
+On macOS you can use this command to turn off the Apple version of NTP:
----
sudo launchctl unload /System/Library/LaunchDaemons/org.ntp.ntpd.plist
=====================================
attic/sht.c
=====================================
--- a/attic/sht.c
+++ b/attic/sht.c
@@ -150,7 +150,7 @@ again:
* certain jitter!)
*/
time_t clk_sec, rcv_sec;
- uint clk_frc, rcv_frc;
+ unsigned int clk_frc, rcv_frc;
/* Here we have a high-resolution system clock, and
* we're not afraid to use it!
@@ -158,16 +158,16 @@ again:
struct timespec tmptime;
if (0 == clock_gettime(CLOCK_REALTIME, &tmptime)) {
rcv_sec = tmptime.tv_sec;
- rcv_frc = (uint)tmptime.tv_nsec;
+ rcv_frc = (unsigned int)tmptime.tv_nsec;
}
else
{
time(&rcv_sec);
- rcv_frc = (uint)ntp_random() % 1000000000u;
+ rcv_frc = (unsigned int)ntp_random() % 1000000000u;
}
/* add a wobble of ~3.5msec to the clock time */
clk_sec = rcv_sec;
- clk_frc = rcv_frc + (uint)(ntp_random()%7094713 - 3547356);
+ clk_frc = rcv_frc + (unsigned int)(ntp_random()%7094713 - 3547356);
/* normalise result -- the SHM driver is picky! */
while ((int)clk_frc < 0) {
clk_frc += 1000000000;
=====================================
buildprep
=====================================
--- a/buildprep
+++ b/buildprep
@@ -51,7 +51,7 @@ cat <<EOF
# Preparing your system for ntpsec source build...
# This script presently knows about:
# CentOS, Debian, Fedora, Gentoo, SLES and Ubuntu
-# If you are running something else, such as MacOS or Solaris, please
+# If you are running something else, such as macOS or Solaris, please
# read the source for this buildprep script to get an idea of what packages
# are required.
#
=====================================
devel/TODO
=====================================
--- a/devel/TODO
+++ b/devel/TODO
@@ -6,12 +6,20 @@
* Add .tar.xz tarball.
+* Fix ntpq retransmissions.
+ Too many cases don't work.
+
+* Fix waf quirks:
+ waf build doesn't build everything
+ it takes a second pass (or check) to build pylib/control.pyc and friends.
+ waf should have an option to not build or run check
+
=== Testing ===
* We need to live-test various refclocks. It would be nice
to test the full matrix of refclock x platform, but that's too
much work. We should probably test as many refclocks as we can
- on at least one platform and test the NMEA, Atom, and SHM drivers
+ on at least one platform and test the NMEA, PPS, and SHM drivers
on most platforms.
== After 1.0 release ==
@@ -82,6 +90,68 @@ of the current startup logic gets discussed.
read-only and solid. Maybe write a support package that does all the
work if you call it with the date/time.
+Solaris maintenance mode
+ There is code in ntp_proto.c that drops into Solaris maintenance mode
+ if the clock offset exceeds the panic threshold. We should either
+ drop that code or move it to where it can be used on all fatal errors.
+ (Search for HAVE_LIBSCF_H)
+
+Logging cleanup:
+ Most OSes/distros have a cron job that scans log files and mails
+ a summary to the sysadmin. They look in /var/log/messages or similar
+ rather than in ntpd's private log files. We should teach ntpd to
+ log "interesting" messages to syslog as well as its log file.
+ We should review the log messages that those utilities can
+ process and update them to process any new messages we consider
+ to be important.
+
+Remove clock fuzzing:
+ ntpd has code to fuzz the clocks. It's scattered all over the place.
+ That made sense when clocks were updated in big steps on a scheduler
+ interrupt. But most modern OSes use something like Intel's TSC to
+ implement fine grained clocks. We should review this area to verify
+ that fuzzing is still useful.
+
+Cleanup use of HAVE_SYS_SOCKIO_H
+ ntpd/ntp_packetstamp.c has:
+#ifdef HAVE_SYS_SOCKIO_H /* UXPV: SIOC* #defines (Frank Vance <fvance at waii.com>) */
+# include <sys/sockio.h>
+#endif
+ They are not referenced in ntpd/ntp_packetstamp.c but are referenced
+ in ntpd/ntp_io.c and libntp/isc_interfaceiter.c
+
+SIGHUP should do more:
+ reload keys file (easy, it already reloads the leap file)
+ reload ntp.conf (hard, needed to add new keys,
+ we could kludge a partial reload to add/delete servers)
+
+Endian:
+ Investigate using endian.h rather than libntp/ntp_endian.c
+
+Waf detect need configure:
+ There are problems with people forgetting to run configure or clean
+ after a git pull. (From email on 23 May 2017)
+
+Version string cleanup:
+ This is tangled up with EPOCH
+ configure has --build-version-tag=
+ configure sets up NTPSEC_VERSION_STRING
+ ntptime is the only useage.
+ The version string should change if I make an edit and rebuild
+ currently it only changes when something in git changes
+ We need to be sure not to break the stable checksum feature.
+
+Pivot cleanup:
+ Currently, ntpd does a pivot deep in step_systime in libntp/systime.c
+ That handles the problem of 32 bits of seconds wraping in 2038.
+ Posix is shifting to a 64 bit time_t, but we only have 32 bits
+ of seconds in l_fp. We can clean up a lot of code if l_fp is
+ only used for offsets except when used in packets. That requires
+ pushing the pivot logic down close to the packet processing.
+
+ There may be interactions with ntpq.
+
+
[quote, Hal]
__________
I think there is some interaction between when the ACTS driver calls and the
=====================================
docs/includes/ntpq-body.txt
=====================================
--- a/docs/includes/ntpq-body.txt
+++ b/docs/includes/ntpq-body.txt
@@ -72,9 +72,6 @@ attempt to read interactive format commands from the standard input.
The debug level is set to the following integer argument.
+-h+, +--help+::
Print a usage message summarizing options end exit.
-+-i+, +--interactive+::
- Force +ntpq+ to operate in interactive mode. Prompts will be written
- to the standard output and commands read from the standard input.
+-n+, +--numeric+::
Output all host addresses in numeric format rather than
converting to the canonical host names.
=====================================
include/ntp_stdlib.h
=====================================
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -120,7 +120,7 @@ extern const char * res_access_flags(unsigned short);
extern const char * k_st_flags (uint32_t);
#endif
extern char * statustoa (int, int);
-extern sockaddr_u * netof (sockaddr_u *);
+extern sockaddr_u * netof6 (sockaddr_u *);
extern char * numtoa (uint32_t);
extern const char * socktoa (const sockaddr_u *);
extern const char * sockporttoa(const sockaddr_u *);
=====================================
libntp/clocktime.c
=====================================
--- a/libntp/clocktime.c
+++ b/libntp/clocktime.c
@@ -80,7 +80,7 @@ clocktime(
*/
if (*yearstart) {
/* -- get time stamp of potential solution */
- test[0] = (uint32_t)(*yearstart) + (uint)tmp;
+ test[0] = (uint32_t)(*yearstart) + (unsigned int)tmp;
/* -- calc absolute difference to receive time */
diff[0] = test[0] - rec_ui;
if (diff[0] >= 0x80000000u)
@@ -102,12 +102,12 @@ clocktime(
* around the guess and select the entry with the minimum
* absolute difference to the receive time stamp.
*/
- y = ntp_to_year(rec_ui - (uint)tmp);
+ y = ntp_to_year(rec_ui - (unsigned int)tmp);
for (idx = 0; idx < 3; idx++) {
/* -- get year start of potential solution */
ystt[idx] = year_to_ntp(y + idx - 1);
/* -- get time stamp of potential solution */
- test[idx] = ystt[idx] + (uint)tmp;
+ test[idx] = ystt[idx] + (unsigned int)tmp;
/* -- calc absolute difference to receive time */
diff[idx] = test[idx] - rec_ui;
if (diff[idx] >= 0x80000000u)
=====================================
libntp/netof.c
=====================================
--- a/libntp/netof.c
+++ b/libntp/netof.c
@@ -1,6 +1,12 @@
/*
- * netof - return the net address part of an ip address in a sockaddr_storage structure
- * (zero out host part)
+ * netof6 - return the net address part of an IPv6 address
+ * in a sockaddr_storage structure (zero out host part)
+ *
+ * except it does not really do that, it ASSumes /64
+ *
+ * returns points to a 8 position static array. Each
+ * position used in turn.
+ *
*/
#include "config.h"
#include <stdio.h>
@@ -11,13 +17,12 @@
#include "ntp.h"
sockaddr_u *
-netof(
+netof6(
sockaddr_u *hostaddr
)
{
static sockaddr_u netofbuf[8];
static int next_netofbuf;
- uint32_t netnum;
sockaddr_u * netaddr;
netaddr = &netofbuf[next_netofbuf];
@@ -25,27 +30,12 @@ netof(
memcpy(netaddr, hostaddr, sizeof(*netaddr));
- if (IS_IPV4(netaddr)) {
- netnum = SRCADR(netaddr);
-
- /*
- * We live in a modern CIDR world where the basement nets, which
- * used to be class A, are now probably associated with each
- * host address. So, for class-A nets, all bits are significant.
- */
- if (IN_CLASSC(netnum))
- netnum &= IN_CLASSC_NET;
- else if (IN_CLASSB(netnum))
- netnum &= IN_CLASSB_NET;
-
- SET_ADDR4(netaddr, netnum);
-
- } else if (IS_IPV6(netaddr))
+ if (IS_IPV6(netaddr))
/* assume the typical /64 subnet size */
zero_mem(&NSRCADR6(netaddr)[8], 8);
#ifdef DEBUG
else {
- msyslog(LOG_ERR, "netof unknown AF %d", AF(netaddr));
+ msyslog(LOG_ERR, "Not IPv6, AF %d", AF(netaddr));
exit(1);
}
#endif
=====================================
libntp/wscript
=====================================
--- a/libntp/wscript
+++ b/libntp/wscript
@@ -8,7 +8,6 @@ def build(ctx):
"decodenetnum.c",
"dolfptoa.c",
"getopt.c",
- "gpstolfp.c",
"initnetwork.c",
"isc_error.c",
"isc_interfaceiter.c",
=====================================
libntp/gpstolfp.c → libparse/gpstolfp.c
=====================================
=====================================
libparse/wscript
=====================================
--- a/libparse/wscript
+++ b/libparse/wscript
@@ -14,6 +14,7 @@ def build(ctx):
"clk_varitext.c",
"clk_wharton.c",
"data_mbg.c",
+ "gpstolfp.c",
"ieee754io.c",
"info_trimble.c",
"parse.c",
=====================================
ntpclients/ntpq
=====================================
--- a/ntpclients/ntpq
+++ b/ntpclients/ntpq
@@ -1580,10 +1580,6 @@ USAGE: ntpq [-46dphinOV] [-c str] [-D lvl] [host ...]
-h no help Print a usage message.
-p no peers Print a list of the peers
- prohibits the option 'interactive'
- -i no interactive Force ntpq to operate in interactive mode
- - prohibits these options:
- command
- peers
-n no numeric Numeric host addresses
-k Str keyfile Specify a keyfile. ntpq will look in this file
for the key specified with -a
@@ -1599,12 +1595,11 @@ if __name__ == '__main__':
try:
(options, arguments) = getopt.getopt(
sys.argv[1:],
- "46a:c:dD:hk:inpVwW:u",
+ "46a:c:dD:hk:npVwW:u",
["ipv4", "ipv6", "authentication=",
"command=", "debug", "set-debug-level=",
- "help", "keyfile", "interactive",
- "numeric", "peers", "version",
- "wide", "width=", "units"])
+ "help", "keyfile", "numeric", "peers",
+ "version", "wide", "width=", "units"])
except getopt.GetoptError as e:
sys.stderr.write("%s\n" % e)
sys.stderr.write(usage)
@@ -1639,8 +1634,6 @@ if __name__ == '__main__':
elif switch in ("-h", "--help"):
print(usage)
raise SystemExit(0)
- elif switch in ("-i", "--interactive"):
- interpreter.interactive = True
elif switch in ("-n", "--numeric"):
interpreter.showhostnames = False
elif switch in ("-p", "--peers"):
@@ -1670,10 +1663,6 @@ if __name__ == '__main__':
if keyid is not None: # Have an -a
session.keyid = keyid
- if interpreter.interactive and len(interpreter.ccmds) > 0:
- interpreter.warn("%s: invalid option combination.\n" % progname)
- raise SystemExit(1)
-
for token in arguments:
if token.startswith("-"):
if '4' == token[-1]:
=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -1716,8 +1716,16 @@ config_access(
continue;
}
} else {
+ char *mp;
+
/* Resolve the specified address */
AF(&addr) = (u_short)my_node->addr->type;
+ /* CIDR notation? */
+ mp = strrchr(my_node->addr->address, '/');
+ if (mp) {
+ *mp++ = '\0'; /* get rid of the '/' */
+ /* someday convert CIDR to mask */
+ }
if (getnetnum(my_node->addr->address,
&addr) != 1) {
=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -2326,8 +2326,7 @@ read_network_packet(
msghdr.msg_namelen = fromlen;
msghdr.msg_iov = &iovec;
msghdr.msg_iovlen = 1;
- /* msghdr.msg_flags = 0; Not all msghdr have msg_flags: Solaris */
- /* Solaris does not have the next two */
+ msghdr.msg_flags = 0;
msghdr.msg_control = (void *)&control;
msghdr.msg_controllen = sizeof(control);
buflen = recvmsg(fd, &msghdr, 0);
@@ -3002,7 +3001,7 @@ findbcastinter(
if (SOCK_EQ(&iface->bcast, addr))
break;
- if (SOCK_EQ(netof(&iface->sin), netof(addr)))
+ if (SOCK_EQ(netof6(&iface->sin), netof6(addr)))
break;
}
}
=====================================
ntpd/ntp_packetstamp.c
=====================================
--- a/ntpd/ntp_packetstamp.c
+++ b/ntpd/ntp_packetstamp.c
@@ -22,7 +22,8 @@
* bintime documentation is at
* http://phk.freebsd.dk/pubs/timecounter.pdf
* SO_TIMESTAMPNS/SCM_TIMESTAMPNS Linux
- * SO_TIMESTAMP/SCM_TIMESTAMP FreeBSD, NetBSD, OpenBSD, Linux, macOS
+ * SO_TIMESTAMP/SCM_TIMESTAMP FreeBSD, NetBSD, OpenBSD, Linux, macOS,
+ * Solaris
*
* Linux supports both SO_TIMESTAMP and SO_TIMESTAMPNS so it's
* important to check for SO_TIMESTAMPNS first to get the better accuracy.
=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -1606,9 +1606,9 @@ clock_select(void)
nlist = 1;
for (peer = peer_list; peer != NULL; peer = peer->p_link)
nlist++;
- endpoint_size = ALIGNED_SIZE((uint)nlist * 2 * sizeof(*endpoint));
- peers_size = ALIGNED_SIZE((uint)nlist * sizeof(*peers));
- indx_size = ALIGNED_SIZE((uint)nlist * 2 * sizeof(*indx));
+ endpoint_size = ALIGNED_SIZE((unsigned int)nlist * 2 * sizeof(*endpoint));
+ peers_size = ALIGNED_SIZE((unsigned int)nlist * sizeof(*peers));
+ indx_size = ALIGNED_SIZE((unsigned int)nlist * 2 * sizeof(*indx));
octets = endpoint_size + peers_size + indx_size;
endpoint = erealloc(endpoint, octets);
peers = INC_ALIGNED_PTR(endpoint, endpoint_size);
=====================================
ntpd/ntp_sandbox.c
=====================================
--- a/ntpd/ntp_sandbox.c
+++ b/ntpd/ntp_sandbox.c
@@ -171,6 +171,7 @@ getgroup:
exit(-1);
}
# endif /* HAVE_SOLARIS_PRIVS */
+ /* FIXME? Apple takes an int as 2nd argument */
if (user && initgroups(user, (gid_t)sw_gid)) {
msyslog(LOG_ERR, "Cannot initgroups() to user `%s': %m", user);
exit (-1);
=====================================
ntpd/refclock_neoclock.c
=====================================
--- a/ntpd/refclock_neoclock.c
+++ b/ntpd/refclock_neoclock.c
@@ -784,10 +784,10 @@ neol_mktime(int year,
}
return (((
(unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) +
- (uint)year*365 - 719499
- )*24 + (uint)hour /* now have hours */
- )*60 + (uint)min /* now have minutes */
- )*60 + (uint)sec; /* finally seconds */
+ (unsigned int)year*365 - 719499
+ )*24 + (unsigned int)hour /* now have hours */
+ )*60 + (unsigned int)min /* now have minutes */
+ )*60 + (unsigned int)sec; /* finally seconds */
}
static void
=====================================
ntpd/refclock_shm.c
=====================================
--- a/ntpd/refclock_shm.c
+++ b/ntpd/refclock_shm.c
@@ -363,7 +363,7 @@ static enum segstat_t shm_query(volatile struct shmTime *shm_in, struct shm_stat
*/
if (shmcopy.mode > 0 && cnt != shm->count) {
shm_stat->status = CLASH;
- return shm_stat->status;
+ return (enum segstat_t)shm_stat->status;
}
shm_stat->status = OK;
@@ -437,7 +437,7 @@ static enum segstat_t shm_query(volatile struct shmTime *shm_in, struct shm_stat
shm_stat->leap = shmcopy.leap;
shm_stat->precision = shmcopy.precision;
- return shm_stat->status;
+ return (enum segstat_t)shm_stat->status;
}
/*
=====================================
tests/common/tests_main.c
=====================================
--- a/tests/common/tests_main.c
+++ b/tests/common/tests_main.c
@@ -43,14 +43,13 @@ static void RunAllTests(void)
RUN_TEST_GROUP(calendar);
RUN_TEST_GROUP(clocktime);
RUN_TEST_GROUP(decodenetnum);
- RUN_TEST_GROUP(gpstolfp);
RUN_TEST_GROUP(hextolfp);
RUN_TEST_GROUP(humandate);
RUN_TEST_GROUP(lfpfunc);
RUN_TEST_GROUP(lfptostr);
RUN_TEST_GROUP(macencrypt);
RUN_TEST_GROUP(msyslog);
- RUN_TEST_GROUP(netof);
+ RUN_TEST_GROUP(netof6);
RUN_TEST_GROUP(numtoa);
RUN_TEST_GROUP(prettydate);
RUN_TEST_GROUP(recvbuff);
@@ -65,6 +64,7 @@ static void RunAllTests(void)
#ifdef TEST_LIBPARSE
RUN_TEST_GROUP(binio);
+ RUN_TEST_GROUP(gpstolfp);
RUN_TEST_GROUP(ieee754io);
#endif
=====================================
tests/libntp/macencrypt.c
=====================================
--- a/tests/libntp/macencrypt.c
+++ b/tests/libntp/macencrypt.c
@@ -83,7 +83,7 @@ TEST(macencrypt, IPv6AddressToRefId) {
SET_AF(&addr, AF_INET6);
SET_SOCK_ADDR6(&addr, address);
- const uint expected = htonl(0x52fdcf75);
+ const unsigned int expected = htonl(0x52fdcf75);
TEST_ASSERT_EQUAL(expected, addr2refid(&addr));
}
=====================================
tests/libntp/netof.c
=====================================
--- a/tests/libntp/netof.c
+++ b/tests/libntp/netof.c
@@ -4,50 +4,19 @@
#include "unity.h"
#include "unity_fixture.h"
-TEST_GROUP(netof);
+TEST_GROUP(netof6);
-TEST_SETUP(netof) {}
+TEST_SETUP(netof6) {}
-TEST_TEAR_DOWN(netof) {}
+TEST_TEAR_DOWN(netof6) {}
#include "sockaddrtest.h"
-TEST(netof, ClassBAddress) {
- sockaddr_u input = CreateSockaddr4("172.16.2.1", NTP_PORT);
- sockaddr_u expected = CreateSockaddr4("172.16.0.0", NTP_PORT);
-
- sockaddr_u* actual = netof(&input);
-
- TEST_ASSERT_NOT_NULL(actual);
- TEST_ASSERT_TRUE(IsEqualS(&expected, actual));
-}
-
-TEST(netof, ClassCAddress) {
- sockaddr_u input = CreateSockaddr4("192.0.2.255", NTP_PORT);
- sockaddr_u expected = CreateSockaddr4("192.0.2.0", NTP_PORT);
-
- sockaddr_u* actual = netof(&input);
-
- TEST_ASSERT_NOT_NULL(actual);
- TEST_ASSERT_TRUE(IsEqualS(&expected, actual));
-}
-
-TEST(netof, ClassAAddress) {
- /* Class A addresses are assumed to be classless,
- * thus the same address should be returned.
- */
- sockaddr_u input = CreateSockaddr4("10.20.30.40", NTP_PORT);
- sockaddr_u expected = CreateSockaddr4("10.20.30.40", NTP_PORT);
-
- sockaddr_u* actual = netof(&input);
-
- TEST_ASSERT_NOT_NULL(actual);
- TEST_ASSERT_TRUE(IsEqualS(&expected, actual));
-}
-
-TEST(netof, IPv6Address) {
- /* IPv6 addresses are assumed to have 64-bit host- and 64-bit network parts. */
+TEST(netof6, IPv6Address) {
+ /* IPv6 addresses are assumed to have 64-bit host
+ * and 64-bit network parts.
+ */
const struct in6_addr input_address = {{{
0x20, 0x01, 0x0d, 0xb8,
0x85, 0xa3, 0x08, 0xd3,
@@ -72,15 +41,12 @@ TEST(netof, IPv6Address) {
SET_SOCK_ADDR6(&expected, expected_address);
SET_PORT(&expected, 3000);
- sockaddr_u* actual = netof(&input);
+ sockaddr_u* actual = netof6(&input);
TEST_ASSERT_NOT_NULL(actual);
TEST_ASSERT_TRUE(IsEqualS(&expected, actual));
}
-TEST_GROUP_RUNNER(netof) {
- RUN_TEST_CASE(netof, ClassBAddress);
- RUN_TEST_CASE(netof, ClassCAddress);
- RUN_TEST_CASE(netof, ClassAAddress);
- RUN_TEST_CASE(netof, IPv6Address);
+TEST_GROUP_RUNNER(netof6) {
+ RUN_TEST_CASE(netof6, IPv6Address);
}
=====================================
tests/libparse/binio.c
=====================================
--- a/tests/libparse/binio.c
+++ b/tests/libparse/binio.c
@@ -176,7 +176,7 @@ TEST(binio, put_lsb_uint164) {
}
-/* LSB uint tests */
+/* LSB unsigned int tests */
TEST(binio, get_lsb_uint160) {
long ret;
@@ -445,7 +445,7 @@ TEST_GROUP_RUNNER(binio) {
RUN_TEST_CASE(binio, put_lsb_uint163);
RUN_TEST_CASE(binio, put_lsb_uint164);
- /* LSB uint tests */
+ /* LSB unsigned int tests */
RUN_TEST_CASE(binio, get_lsb_uint160);
RUN_TEST_CASE(binio, get_lsb_uint161);
RUN_TEST_CASE(binio, get_lsb_uint162);
=====================================
tests/libntp/gpstolfp.c → tests/libparse/gpstolfp.c
=====================================
--- a/tests/libntp/gpstolfp.c
+++ b/tests/libparse/gpstolfp.c
@@ -50,4 +50,4 @@ TEST(gpstolfp, check) {
TEST_GROUP_RUNNER(gpstolfp) {
RUN_TEST_CASE(gpstolfp, check);
-}
\ No newline at end of file
+}
=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -30,7 +30,6 @@ def build(ctx):
"libntp/calendar.c",
"libntp/clocktime.c",
"libntp/decodenetnum.c",
- "libntp/gpstolfp.c",
"libntp/hextolfp.c",
"libntp/humandate.c",
"libntp/lfpfunc.c",
@@ -64,12 +63,13 @@ def build(ctx):
source=libntp_source,
)
- if ctx.env.REFCLOCK_GENERIC:
- # libparse only available/required wth generic refclock
+ if ctx.env.REFCLOCK_GENERIC or ctx.env.REFCLOCK_TRIMBLE:
+ # libparse available/required wth generic and Trimble refclocks
# libparse/
libparse_source = [
"libparse/binio.c",
+ "libparse/gpstolfp.c",
"libparse/ieee754io.c",
] + common_source
=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -534,8 +534,10 @@ int main(int argc, char **argv) {
ctx.define("__APPLE_USE_RFC_3542", 1,
comment="Needed for IPv6 support")
elif ctx.env.DEST_OS == "sunos":
- ctx.define("_POSIX_PTHREAD_SEMANTICS", "1", quote=False,
- comment="Needed for POSIX function definitions on Solaris")
+ # Declare compatibility with the POSIX.1-2001 standard, and any
+ # headers/interfaces not in conflict with that standard
+ ctx.define("_POSIX_C_SOURCE", "200112L", quote=False)
+ ctx.define("__EXTENSIONS__", "1", quote=False)
# XXX: needed for ntp_worker, for now
if ctx.env.DEST_OS == "openbsd":
@@ -1049,8 +1051,8 @@ def build(ctx):
ctx.recurse("ntpd")
return
- if ctx.env.REFCLOCK_GENERIC:
- # Only required by the generic refclock
+ if ctx.env.REFCLOCK_GENERIC or ctx.env.REFCLOCK_TRIMBLE:
+ # required by the generic and Trimble refclocks
ctx.recurse("libparse")
ctx.recurse("libntp")
ctx.recurse("ntpd")
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/3b7e44d84dca67d5b841d9a5f6bfb803ec460675...7be3903ac943f08e5d42e67c895f280472393a9d
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/3b7e44d84dca67d5b841d9a5f6bfb803ec460675...7be3903ac943f08e5d42e67c895f280472393a9d
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/20170609/ed74bf12/attachment.html>
More information about the vc
mailing list