From ee2df5a7d427a47308f31c617288dbfc5e3f9f62 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 17 May 2016 08:04:45 -0500 Subject: [PATCH] update patches - fix FreeBSD build, always write PID if specified --- ...records-on-IPv4-networks-more-libera.patch | 4 +-- ...EAI_NODATA-does-not-exist-everywhere.patch | 4 +-- ...ll-in-sin_len-sin6_len-if-they-exist.patch | 4 +-- ...heck-if-rdomain-support-is-available.patch | 26 ++-------------- ...onf-to-indicate-OS-dependent-options.patch | 4 +-- ...ding-default-user-and-file-locations.patch | 12 +++---- ...07-add-p-option-to-create-a-pid-file.patch | 31 ++++++++++++------- ...initialize-setproctitle-where-needed.patch | 6 ++-- ...-when-constraint-support-is-disabled.patch | 6 ++-- ...-updating-the-realtime-clock-on-sync.patch | 8 ++--- .../0011-Deal-with-missing-SO_TIMESTAMP.patch | 4 +-- ...012-check-result-of-ftello-ftruncate.patch | 10 +++--- 12 files changed, 54 insertions(+), 65 deletions(-) diff --git a/patches/0001-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch b/patches/0001-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch index c3f9390..fb8cacc 100644 --- a/patches/0001-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch +++ b/patches/0001-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch @@ -1,4 +1,4 @@ -From 4756a632e1a4094f74285c3c1138c88b7f26a338 Mon Sep 17 00:00:00 2001 +From 849ba5c1634d7644fe43f3959b9642a0932c60cc Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:10:22 -0600 Subject: [PATCH 01/12] Handle IPv6 DNS records on IPv4 networks more liberally @@ -37,5 +37,5 @@ index a92382b..7ce3b38 100644 if (connect(p->query->fd, sa, SA_LEN(sa)) == -1) { if (errno == ECONNREFUSED || errno == ENETUNREACH || -- -2.7.0 +2.8.1 diff --git a/patches/0002-EAI_NODATA-does-not-exist-everywhere.patch b/patches/0002-EAI_NODATA-does-not-exist-everywhere.patch index ec75a83..fb82b0f 100644 --- a/patches/0002-EAI_NODATA-does-not-exist-everywhere.patch +++ b/patches/0002-EAI_NODATA-does-not-exist-everywhere.patch @@ -1,4 +1,4 @@ -From 8c7c419eee852ecef0c35048d669b9f075d878a2 Mon Sep 17 00:00:00 2001 +From 1d9db54c51e9e857da5e8e4ea137fe56a8776d98 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:04:08 -0600 Subject: [PATCH 02/12] EAI_NODATA does not exist everywhere @@ -36,5 +36,5 @@ index b2f688e..c0a99b1 100644 log_warnx("could not parse \"%s\": %s", s, gai_strerror(error)); -- -2.7.0 +2.8.1 diff --git a/patches/0003-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch b/patches/0003-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch index 09d5fba..f448842 100644 --- a/patches/0003-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch +++ b/patches/0003-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch @@ -1,4 +1,4 @@ -From 4d7e866c45b3dedfc1853fc295dfd937bd20e9b6 Mon Sep 17 00:00:00 2001 +From de7ff570ba05b30305aa8574634fe71942ba56eb Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:02:50 -0600 Subject: [PATCH 03/12] conditionally fill in sin_len/sin6_len if they exist @@ -49,5 +49,5 @@ index c0a99b1..87de17a 100644 res->ai_addr)->sin6_addr, sizeof(struct in6_addr)); } -- -2.7.0 +2.8.1 diff --git a/patches/0004-check-if-rdomain-support-is-available.patch b/patches/0004-check-if-rdomain-support-is-available.patch index 2befd9c..f8b18ab 100644 --- a/patches/0004-check-if-rdomain-support-is-available.patch +++ b/patches/0004-check-if-rdomain-support-is-available.patch @@ -1,33 +1,13 @@ -From cc20e4c83593f1fc5f6616b944a30a51afe94730 Mon Sep 17 00:00:00 2001 +From c123b58020c62535178051e11fd1867d4bb83459 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:05:46 -0600 Subject: [PATCH 04/12] check if rdomain support is available. -Handle FreeBSD's calling rdomain 'FIB'. - - from naddy@openbsd.org --- - src/usr.sbin/ntpd/ntpd.h | 6 ++++++ src/usr.sbin/ntpd/parse.y | 2 ++ src/usr.sbin/ntpd/server.c | 15 ++++++++++++++- - 3 files changed, 22 insertions(+), 1 deletion(-) + 2 files changed, 16 insertions(+), 1 deletion(-) -diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h -index 3089c14..1d46c6c 100644 ---- a/src/usr.sbin/ntpd/ntpd.h -+++ b/src/usr.sbin/ntpd/ntpd.h -@@ -40,6 +40,12 @@ - #define DRIFTFILE "/var/db/ntpd.drift" - #define CTLSOCKET "/var/run/ntpd.sock" - -+#if defined(SO_SETFIB) -+#define SO_RTABLE SO_SETFIB -+#define SIOCGIFRDOMAIN SIOCGIFFIB -+#define ifr_rdomainid ifr_fib -+#endif -+ - #define INTERVAL_QUERY_NORMAL 30 /* sync to peers every n secs */ - #define INTERVAL_QUERY_PATHETIC 60 - #define INTERVAL_QUERY_AGGRESSIVE 5 diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y index 6d50795..33fe13d 100644 --- a/src/usr.sbin/ntpd/parse.y @@ -112,5 +92,5 @@ index fb297d7..2e28b9b 100644 if (bind(la->fd, (struct sockaddr *)&la->sa, SA_LEN((struct sockaddr *)&la->sa)) == -1) { -- -2.7.0 +2.8.1 diff --git a/patches/0005-update-ntpd.conf-to-indicate-OS-dependent-options.patch b/patches/0005-update-ntpd.conf-to-indicate-OS-dependent-options.patch index 7a2588e..a8735c0 100644 --- a/patches/0005-update-ntpd.conf-to-indicate-OS-dependent-options.patch +++ b/patches/0005-update-ntpd.conf-to-indicate-OS-dependent-options.patch @@ -1,4 +1,4 @@ -From 3ef21da5125f32ceb3d1c176028406511f360558 Mon Sep 17 00:00:00 2001 +From 1a07a2da0857383abc1812913795dad6c0896574 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:20:03 -0600 Subject: [PATCH 05/12] update ntpd.conf to indicate OS-dependent options @@ -49,5 +49,5 @@ index af11a7e..87f94e8 100644 .Xr ntpd 8 will use each given sensor that actually exists. -- -2.7.0 +2.8.1 diff --git a/patches/0006-allow-overriding-default-user-and-file-locations.patch b/patches/0006-allow-overriding-default-user-and-file-locations.patch index c8a63ed..296dd53 100644 --- a/patches/0006-allow-overriding-default-user-and-file-locations.patch +++ b/patches/0006-allow-overriding-default-user-and-file-locations.patch @@ -1,4 +1,4 @@ -From 00fff5a8c36c3b3574abf8bd4bb1a558d1f8232d Mon Sep 17 00:00:00 2001 +From 4bffc797018df06078af909df2ea8af89eaa3a82 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Thu, 1 Jan 2015 07:18:11 -0600 Subject: [PATCH 06/12] allow overriding default user and file locations @@ -10,7 +10,7 @@ default user. 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h -index 1d46c6c..dfcaf33 100644 +index 3fddba8..9ee2e42 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h @@ -35,10 +35,20 @@ @@ -35,9 +35,9 @@ index 1d46c6c..dfcaf33 100644 +#define DRIFTFILE LOCALSTATEDIR "/db/ntpd.drift" +#define CTLSOCKET LOCALSTATEDIR "/run/ntpd.sock" - #if defined(SO_SETFIB) - #define SO_RTABLE SO_SETFIB -@@ -86,7 +96,9 @@ + #define INTERVAL_QUERY_NORMAL 30 /* sync to peers every n secs */ + #define INTERVAL_QUERY_PATHETIC 60 +@@ -80,7 +90,9 @@ #define CONSTRAINT_PORT "443" /* HTTPS port */ #define CONSTRAINT_MAXHEADERLENGTH 8192 #define CONSTRAINT_PASSFD (STDERR_FILENO + 1) @@ -48,5 +48,5 @@ index 1d46c6c..dfcaf33 100644 enum client_state { STATE_NONE, -- -2.7.0 +2.8.1 diff --git a/patches/0007-add-p-option-to-create-a-pid-file.patch b/patches/0007-add-p-option-to-create-a-pid-file.patch index abe9bdb..f9c7e34 100644 --- a/patches/0007-add-p-option-to-create-a-pid-file.patch +++ b/patches/0007-add-p-option-to-create-a-pid-file.patch @@ -1,4 +1,4 @@ -From 4eaf878371b6a3bcba24fcf6ece12a6170d7d983 Mon Sep 17 00:00:00 2001 +From 04896536acf7a0305de2397afe4f86d3bbf66df7 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Wed, 31 Dec 2014 08:26:41 -0600 Subject: [PATCH 07/12] add -p option to create a pid file @@ -8,9 +8,9 @@ This is used in both the Gentoo and Debian ports. Origin: https://bugs.gentoo.org/show_bug.cgi?id=493082 --- src/usr.sbin/ntpd/ntpd.8 | 4 ++++ - src/usr.sbin/ntpd/ntpd.c | 33 ++++++++++++++++++++++++++++----- + src/usr.sbin/ntpd/ntpd.c | 35 +++++++++++++++++++++++++++++------ src/usr.sbin/ntpd/ntpd.h | 1 + - 3 files changed, 33 insertions(+), 5 deletions(-) + 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/usr.sbin/ntpd/ntpd.8 b/src/usr.sbin/ntpd/ntpd.8 index dcfb6d2..1b885a1 100644 @@ -35,7 +35,7 @@ index dcfb6d2..1b885a1 100644 Do not set the time immediately at startup. This is the default. diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c -index b6eb98e..8dbd51e 100644 +index 43486f0..f8727f6 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c @@ -87,6 +87,18 @@ sighdlr(int sig) @@ -93,12 +93,21 @@ index b6eb98e..8dbd51e 100644 + if (!lconf.debug) { if (daemon(1, 0)) fatal("daemon"); -+ writepid(&lconf); + } ++ writepid(&lconf); } else timeout = SETTIME_TIMEOUT * 1000; -@@ -273,9 +290,11 @@ main(int argc, char *argv[]) +@@ -230,7 +247,7 @@ main(int argc, char *argv[]) + * Constraint processes are forked with certificates in memory, + * then privdrop into chroot before speaking to the outside world. + */ +-#if 0 ++#if 0 + if (pledge("stdio rpath inet settime proc id", NULL) == -1) + err(1, "pledge"); + #endif +@@ -275,9 +292,11 @@ main(int argc, char *argv[]) log_verbose(lconf.verbose); log_warnx("no reply received in time, skipping initial " "time setting"); @@ -111,7 +120,7 @@ index b6eb98e..8dbd51e 100644 } if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT)) -@@ -318,6 +337,8 @@ main(int argc, char *argv[]) +@@ -320,6 +339,8 @@ main(int argc, char *argv[]) msgbuf_clear(&ibuf->w); free(ibuf); log_info("Terminating"); @@ -120,7 +129,7 @@ index b6eb98e..8dbd51e 100644 return (0); } -@@ -401,9 +422,11 @@ dispatch_imsg(struct ntpd_conf *lconf, const char *pw_dir, +@@ -403,9 +424,11 @@ dispatch_imsg(struct ntpd_conf *lconf, const char *pw_dir, memcpy(&d, imsg.data, sizeof(d)); ntpd_settime(d); /* daemonize now */ @@ -134,10 +143,10 @@ index b6eb98e..8dbd51e 100644 timeout = INFTIM; break; diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h -index dfcaf33..24a3222 100644 +index 9ee2e42..d39628c 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h -@@ -243,6 +243,7 @@ struct ntpd_conf { +@@ -237,6 +237,7 @@ struct ntpd_conf { u_int constraint_errors; u_int8_t *ca; size_t ca_len; @@ -146,5 +155,5 @@ index dfcaf33..24a3222 100644 struct ctl_show_status { -- -2.7.0 +2.8.1 diff --git a/patches/0008-initialize-setproctitle-where-needed.patch b/patches/0008-initialize-setproctitle-where-needed.patch index 9c2da32..2542975 100644 --- a/patches/0008-initialize-setproctitle-where-needed.patch +++ b/patches/0008-initialize-setproctitle-where-needed.patch @@ -1,4 +1,4 @@ -From 0efb3313d88327d01c158c9d4f842888f4710b8e Mon Sep 17 00:00:00 2001 +From 9a99fbbdf9e1df934f7d6d0b81e3069ca855d9c5 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Mon, 12 Jan 2015 06:18:31 -0600 Subject: [PATCH 08/12] initialize setproctitle where needed @@ -10,7 +10,7 @@ clobbering them. 1 file changed, 19 insertions(+) diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c -index 8dbd51e..c90c52f 100644 +index f8727f6..cf3b4d9 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c @@ -117,6 +117,13 @@ usage(void) @@ -54,5 +54,5 @@ index 8dbd51e..c90c52f 100644 switch (ch) { case 'd': -- -2.7.0 +2.8.1 diff --git a/patches/0009-Notify-the-user-when-constraint-support-is-disabled.patch b/patches/0009-Notify-the-user-when-constraint-support-is-disabled.patch index b05722a..90e028e 100644 --- a/patches/0009-Notify-the-user-when-constraint-support-is-disabled.patch +++ b/patches/0009-Notify-the-user-when-constraint-support-is-disabled.patch @@ -1,4 +1,4 @@ -From dfc8622622b49b4ed919bf07120ad78a6cc62c26 Mon Sep 17 00:00:00 2001 +From 9b1a06a5c90941b622f97ecebf41fb14adeabef5 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Fri, 27 Mar 2015 23:14:15 -0500 Subject: [PATCH 09/12] Notify the user when constraint support is disabled. @@ -27,7 +27,7 @@ index 87de17a..5a75030 100644 } diff --git a/src/usr.sbin/ntpd/constraint.c b/src/usr.sbin/ntpd/constraint.c -index 0beecd4..b683cc5 100644 +index 18fc3ef..3889085 100644 --- a/src/usr.sbin/ntpd/constraint.c +++ b/src/usr.sbin/ntpd/constraint.c @@ -292,12 +292,14 @@ priv_constraint_child(struct constraint *cstr, struct ntp_addr_msg *am, @@ -64,5 +64,5 @@ index 87f94e8..7f729d2 100644 .It Ic constraint from Ar url Specify the URL, IP address or the hostname of an HTTPS server to -- -2.7.0 +2.8.1 diff --git a/patches/0010-add-a-method-for-updating-the-realtime-clock-on-sync.patch b/patches/0010-add-a-method-for-updating-the-realtime-clock-on-sync.patch index 3acd820..098d4e4 100644 --- a/patches/0010-add-a-method-for-updating-the-realtime-clock-on-sync.patch +++ b/patches/0010-add-a-method-for-updating-the-realtime-clock-on-sync.patch @@ -1,4 +1,4 @@ -From 2cbd6167722989c83f76167dab38dc090b2be15a Mon Sep 17 00:00:00 2001 +From 316da4311a4f4020aa5b3b28bd9232b9302e5496 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Mon, 4 May 2015 04:27:29 -0500 Subject: [PATCH 10/12] add a method for updating the realtime clock on sync @@ -9,7 +9,7 @@ from Christian Weisgerber 1 file changed, 2 insertions(+) diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c -index c90c52f..af8700e 100644 +index cf3b4d9..b665000 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c @@ -55,6 +55,7 @@ const char *ctl_lookup_option(char *, const char **); @@ -20,7 +20,7 @@ index c90c52f..af8700e 100644 volatile sig_atomic_t quit = 0; volatile sig_atomic_t reconfig = 0; -@@ -494,6 +495,7 @@ ntpd_adjtime(double d) +@@ -496,6 +497,7 @@ ntpd_adjtime(double d) else if (!firstadj && olddelta.tv_sec == 0 && olddelta.tv_usec == 0) synced = 1; firstadj = 0; @@ -29,5 +29,5 @@ index c90c52f..af8700e 100644 } -- -2.7.0 +2.8.1 diff --git a/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch b/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch index 7924229..2978219 100644 --- a/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch +++ b/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch @@ -1,4 +1,4 @@ -From 2c75747b9d10183dbec1d680abbfa6f780c738bb Mon Sep 17 00:00:00 2001 +From 1ee4fc6bb354675f9e70df4a4b3c8dea0bf0f87a Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sun, 6 Dec 2015 22:35:38 -0600 Subject: [PATCH 11/12] Deal with missing SO_TIMESTAMP @@ -65,5 +65,5 @@ index 7ce3b38..edca87c 100644 if (T4 < JAN_1970) { client_log_error(p, "recvmsg control format", EBADF); -- -2.7.0 +2.8.1 diff --git a/patches/0012-check-result-of-ftello-ftruncate.patch b/patches/0012-check-result-of-ftello-ftruncate.patch index 35d7808..ed65ee4 100644 --- a/patches/0012-check-result-of-ftello-ftruncate.patch +++ b/patches/0012-check-result-of-ftello-ftruncate.patch @@ -1,4 +1,4 @@ -From e8b7619433a6d6e6ff8f106850a3f1d2808653fb Mon Sep 17 00:00:00 2001 +From 84fa6ee10689cc7808f8aacb404b5bc8588ad89b Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Mon, 21 Dec 2015 05:53:20 -0600 Subject: [PATCH 12/12] check result of ftello/ftruncate @@ -8,10 +8,10 @@ Subject: [PATCH 12/12] check result of ftello/ftruncate 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c -index af8700e..631e4de 100644 +index b665000..18cc21d 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c -@@ -598,6 +598,7 @@ writefreq(double d) +@@ -600,6 +600,7 @@ writefreq(double d) { int r; static int warnonce = 1; @@ -19,7 +19,7 @@ index af8700e..631e4de 100644 if (freqfp == NULL) return 0; -@@ -611,8 +612,10 @@ writefreq(double d) +@@ -613,8 +614,10 @@ writefreq(double d) clearerr(freqfp); return 0; } @@ -33,5 +33,5 @@ index af8700e..631e4de 100644 } -- -2.7.0 +2.8.1