From caaaae23de21dd6376c0362af52566043fc3cce9 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Mon, 15 Feb 2016 11:44:42 -0600 Subject: [PATCH] rebase patches --- ...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 | 6 +-- ...onf-to-indicate-OS-dependent-options.patch | 4 +- ...ding-default-user-and-file-locations.patch | 6 +-- ...07-add-p-option-to-create-a-pid-file.patch | 49 +++++++++---------- ...initialize-setproctitle-where-needed.patch | 10 ++-- ...-when-constraint-support-is-disabled.patch | 8 +-- ...-updating-the-realtime-clock-on-sync.patch | 8 +-- .../0011-Deal-with-missing-SO_TIMESTAMP.patch | 4 +- ...012-check-result-of-ftello-ftruncate.patch | 12 ++--- 12 files changed, 57 insertions(+), 62 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 3c390f5..c3f9390 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 477c93ac049d28361ebe4f194ca710e681c92b14 Mon Sep 17 00:00:00 2001 +From 4756a632e1a4094f74285c3c1138c88b7f26a338 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.6.4 +2.7.0 diff --git a/patches/0002-EAI_NODATA-does-not-exist-everywhere.patch b/patches/0002-EAI_NODATA-does-not-exist-everywhere.patch index 3a82e18..ec75a83 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 9ecbfcea549e7bcd36b380892240fcd2f671edb7 Mon Sep 17 00:00:00 2001 +From 8c7c419eee852ecef0c35048d669b9f075d878a2 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.6.4 +2.7.0 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 e571e75..09d5fba 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 d75fce3c40a9e24d8af8a568581e1882d21eb520 Mon Sep 17 00:00:00 2001 +From 4d7e866c45b3dedfc1853fc295dfd937bd20e9b6 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.6.4 +2.7.0 diff --git a/patches/0004-check-if-rdomain-support-is-available.patch b/patches/0004-check-if-rdomain-support-is-available.patch index 5b06c25..2befd9c 100644 --- a/patches/0004-check-if-rdomain-support-is-available.patch +++ b/patches/0004-check-if-rdomain-support-is-available.patch @@ -1,4 +1,4 @@ -From 222700a524b3466607b84c9a896aa8278c4d1aa9 Mon Sep 17 00:00:00 2001 +From cc20e4c83593f1fc5f6616b944a30a51afe94730 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. @@ -12,7 +12,7 @@ Handle FreeBSD's calling rdomain 'FIB'. 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h -index c93ca20..b007da3 100644 +index 3089c14..1d46c6c 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h @@ -40,6 +40,12 @@ @@ -112,5 +112,5 @@ index fb297d7..2e28b9b 100644 if (bind(la->fd, (struct sockaddr *)&la->sa, SA_LEN((struct sockaddr *)&la->sa)) == -1) { -- -2.6.4 +2.7.0 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 ce7282f..7a2588e 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 f1e8552352638f4214768df629e9020507e4af05 Mon Sep 17 00:00:00 2001 +From 3ef21da5125f32ceb3d1c176028406511f360558 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.6.4 +2.7.0 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 f5976c2..c8a63ed 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 fdb958c8a66e32287aa5292200d0777f9f96784a Mon Sep 17 00:00:00 2001 +From 00fff5a8c36c3b3574abf8bd4bb1a558d1f8232d 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 b007da3..7e739c4 100644 +index 1d46c6c..dfcaf33 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h @@ -35,10 +35,20 @@ @@ -48,5 +48,5 @@ index b007da3..7e739c4 100644 enum client_state { STATE_NONE, -- -2.6.4 +2.7.0 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 d4d9a00..3f6a265 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 b4f723b7fd4c3a56f8b0e08da5998fa31bac5673 Mon Sep 17 00:00:00 2001 +From cb6da547c5b532d6e8d241cb993c831605d0d45f 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 | 35 +++++++++++++++++++++++++++++------ + src/usr.sbin/ntpd/ntpd.c | 35 +++++++++++++++++++++++++++++++---- src/usr.sbin/ntpd/ntpd.h | 1 + - 3 files changed, 34 insertions(+), 6 deletions(-) + 3 files changed, 36 insertions(+), 4 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 0f43b1f..e31db98 100644 +index b6eb98e..608e6fd 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c @@ -87,6 +87,18 @@ sighdlr(int sig) @@ -66,17 +66,17 @@ index 0f43b1f..e31db98 100644 __progname); exit(1); } -@@ -134,7 +146,7 @@ main(int argc, char *argv[]) +@@ -132,7 +144,7 @@ main(int argc, char *argv[]) - log_init(1, LOG_DAEMON); /* log to stderr until daemonized */ + memset(&lconf, 0, sizeof(lconf)); - while ((ch = getopt(argc, argv, "df:nsSv")) != -1) { + while ((ch = getopt(argc, argv, "df:np:sSv")) != -1) { switch (ch) { case 'd': - lconf.debug = 1; -@@ -146,6 +158,9 @@ main(int argc, char *argv[]) - case 'n': + lconf.debug = 2; +@@ -144,6 +156,9 @@ main(int argc, char *argv[]) + lconf.debug = 2; lconf.noaction = 1; break; + case 'p': @@ -85,12 +85,16 @@ index 0f43b1f..e31db98 100644 case 's': lconf.settime = 1; break; -@@ -190,9 +205,11 @@ main(int argc, char *argv[]) +@@ -191,10 +206,16 @@ main(int argc, char *argv[]) reset_adjtime(); if (!lconf.settime) { log_init(lconf.debug, LOG_DAEMON); -- if (!lconf.debug) ++<<<<<<< 00fff5a8c36c3b3574abf8bd4bb1a558d1f8232d + log_verbose(lconf.verbose); + if (!lconf.debug) ++======= + if (!lconf.debug) { ++>>>>>>> add -p option to create a pid file if (daemon(1, 0)) fatal("daemon"); + writepid(&lconf); @@ -98,8 +102,8 @@ index 0f43b1f..e31db98 100644 } else timeout = SETTIME_TIMEOUT * 1000; -@@ -271,9 +288,11 @@ main(int argc, char *argv[]) - log_init(lconf.debug, LOG_DAEMON); +@@ -273,9 +294,11 @@ main(int argc, char *argv[]) + log_verbose(lconf.verbose); log_warnx("no reply received in time, skipping initial " "time setting"); - if (!lconf.debug) @@ -111,7 +115,7 @@ index 0f43b1f..e31db98 100644 } if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT)) -@@ -316,6 +335,8 @@ main(int argc, char *argv[]) +@@ -318,6 +341,8 @@ main(int argc, char *argv[]) msgbuf_clear(&ibuf->w); free(ibuf); log_info("Terminating"); @@ -120,7 +124,7 @@ index 0f43b1f..e31db98 100644 return (0); } -@@ -398,9 +419,11 @@ dispatch_imsg(struct ntpd_conf *lconf, const char *pw_dir, +@@ -401,9 +426,11 @@ dispatch_imsg(struct ntpd_conf *lconf, const char *pw_dir, memcpy(&d, imsg.data, sizeof(d)); ntpd_settime(d); /* daemonize now */ @@ -133,20 +137,11 @@ index 0f43b1f..e31db98 100644 lconf->settime = 0; timeout = INFTIM; break; -@@ -528,7 +551,7 @@ readfreq(void) - freqfp = fopen(DRIFTFILE, "w"); - return; - } -- -+ - freqfp = fdopen(fd, "r+"); - - /* if we're adjusting frequency already, don't override */ diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h -index 7e739c4..864d4c4 100644 +index dfcaf33..24a3222 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h -@@ -241,6 +241,7 @@ struct ntpd_conf { +@@ -243,6 +243,7 @@ struct ntpd_conf { u_int constraint_errors; u_int8_t *ca; size_t ca_len; @@ -155,5 +150,5 @@ index 7e739c4..864d4c4 100644 struct ctl_show_status { -- -2.6.4 +2.7.0 diff --git a/patches/0008-initialize-setproctitle-where-needed.patch b/patches/0008-initialize-setproctitle-where-needed.patch index 4872e59..cc9b790 100644 --- a/patches/0008-initialize-setproctitle-where-needed.patch +++ b/patches/0008-initialize-setproctitle-where-needed.patch @@ -1,4 +1,4 @@ -From f86daab4bb1d41bcdcbdaeb6370c500962a09675 Mon Sep 17 00:00:00 2001 +From b3c820711065f53390aa0a82236102deb15442fe 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 e31db98..19720b3 100644 +index 608e6fd..c416c04 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c @@ -117,6 +117,13 @@ usage(void) @@ -36,9 +36,9 @@ index e31db98..19720b3 100644 if (strcmp(__progname, "ntpctl") == 0) { ctl_main(argc, argv); /* NOTREACHED */ -@@ -146,6 +155,16 @@ main(int argc, char *argv[]) +@@ -144,6 +153,16 @@ main(int argc, char *argv[]) - log_init(1, LOG_DAEMON); /* log to stderr until daemonized */ + memset(&lconf, 0, sizeof(lconf)); +#ifndef HAVE_SETPROCTITLE + /* Prepare for later setproctitle emulation */ @@ -54,5 +54,5 @@ index e31db98..19720b3 100644 switch (ch) { case 'd': -- -2.6.4 +2.7.0 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 93b4e91..321d61e 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 93555bfc44a0eb2039f625ab6a5badde63fa5215 Mon Sep 17 00:00:00 2001 +From 09598d4720c5bf6d58b6597d96288b2c0c2ba54a 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,10 +27,10 @@ index 87de17a..5a75030 100644 } diff --git a/src/usr.sbin/ntpd/constraint.c b/src/usr.sbin/ntpd/constraint.c -index 84d21a9..97f0cd5 100644 +index 0beecd4..b683cc5 100644 --- a/src/usr.sbin/ntpd/constraint.c +++ b/src/usr.sbin/ntpd/constraint.c -@@ -289,12 +289,14 @@ priv_constraint_child(struct constraint *cstr, struct ntp_addr_msg *am, +@@ -292,12 +292,14 @@ priv_constraint_child(struct constraint *cstr, struct ntp_addr_msg *am, if (setpriority(PRIO_PROCESS, 0, 0) == -1) log_warn("could not set priority"); @@ -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.6.4 +2.7.0 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 e0d9af4..5ba8b8b 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 340f04a6e14b05803e376c22b0c9170407b6b77d Mon Sep 17 00:00:00 2001 +From 97c083b8d9db34198c98561d3dbc746eb48804ba 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 19720b3..d7281c1 100644 +index c416c04..4d49226 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 19720b3..d7281c1 100644 volatile sig_atomic_t quit = 0; volatile sig_atomic_t reconfig = 0; -@@ -488,6 +489,7 @@ ntpd_adjtime(double d) +@@ -498,6 +499,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 19720b3..d7281c1 100644 } -- -2.6.4 +2.7.0 diff --git a/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch b/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch index 5c96fce..27a1868 100644 --- a/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch +++ b/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch @@ -1,4 +1,4 @@ -From 93d09a37b9a3eb129c2d61db505082ca23ca12f1 Mon Sep 17 00:00:00 2001 +From 5c17d3eb5dba72fca49f9285a76d77debcedbbe8 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.6.4 +2.7.0 diff --git a/patches/0012-check-result-of-ftello-ftruncate.patch b/patches/0012-check-result-of-ftello-ftruncate.patch index 59be1b0..a55e0a8 100644 --- a/patches/0012-check-result-of-ftello-ftruncate.patch +++ b/patches/0012-check-result-of-ftello-ftruncate.patch @@ -1,4 +1,4 @@ -From 4715ab95e394b979df49a30cf50db306f50f30e6 Mon Sep 17 00:00:00 2001 +From 7519735f71bb20104b700eb19206279f51d4849a 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 d7281c1..7df6326 100644 +index 4d49226..781ae7c 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c -@@ -592,6 +592,7 @@ writefreq(double d) +@@ -602,6 +602,7 @@ writefreq(double d) { int r; static int warnonce = 1; @@ -19,8 +19,8 @@ index d7281c1..7df6326 100644 if (freqfp == NULL) return 0; -@@ -605,8 +606,10 @@ writefreq(double d) - } +@@ -615,8 +616,10 @@ writefreq(double d) + clearerr(freqfp); return 0; } - ftruncate(fileno(freqfp), ftello(freqfp)); @@ -33,5 +33,5 @@ index d7281c1..7df6326 100644 } -- -2.6.4 +2.7.0