Commits

Fred Wright authored and Clemens Lang committed 7e2fe8d9620
ntpsec: update to 1.1.7

This includes the patches for compatibility with macOS<10.13, which can also be seen (more readably) at: https://gitlab.com/fhgwright/ntpsec/tree/macports_1_1_7 TESTED: Built and ran on MacPro 10.9, MacPro 10.14, MacBookPro 10.9, PowerBook 10.5, and VMs for 10.5-10.13. Built with default variants, all single non-default variants, and all non-default variants. NOTE: Does not address ticket 57272 (s/b low priority).
No tags

sysutils/ntpsec/files/patch-PreHighSierra.diff

Modified
1 ---- ./attic/backwards.c.orig 2019-06-21 19:41:51.000000000 -0700
2 -+++ ./attic/backwards.c 2019-07-11 17:54:24.000000000 -0700
1 +--- ./attic/backwards.c.orig 2019-09-02 19:17:36.000000000 -0700
2 ++++ ./attic/backwards.c 2019-09-03 22:22:14.000000000 -0700
3 3 @@ -7,6 +7,8 @@
4 4 #include <stdlib.h>
5 5 #include <time.h>
6 6
7 7 +#include "ntp_machine.h" /* For clock_gettime fallback */
8 8 +
9 9 #define UNUSED_ARG(arg) ((void)(arg))
10 10
11 11 static void ts_print(struct timespec *ts0, struct timespec *ts1);
12 ---- ./attic/clocks.c.orig 2019-06-21 19:41:51.000000000 -0700
13 -+++ ./attic/clocks.c 2019-07-11 17:54:24.000000000 -0700
12 +--- ./attic/clocks.c.orig 2019-09-02 19:17:36.000000000 -0700
13 ++++ ./attic/clocks.c 2019-09-03 22:22:14.000000000 -0700
14 14 @@ -5,6 +5,8 @@
15 15 #include <stdio.h>
16 16 #include <time.h>
17 17
18 18 +#include "ntp_machine.h" /* For clock_gettime fallback */
19 19 +
20 20 struct table {
21 21 const int type;
22 22 const char* name;
23 ---- ./attic/digest-timing.c.orig 2019-06-21 19:41:51.000000000 -0700
24 -+++ ./attic/digest-timing.c 2019-07-11 17:54:24.000000000 -0700
23 +--- ./attic/digest-timing.c.orig 2019-09-02 19:17:36.000000000 -0700
24 ++++ ./attic/digest-timing.c 2019-09-03 22:22:14.000000000 -0700
25 25 @@ -34,6 +34,8 @@
26 26 #include <openssl/rand.h>
27 27 #include <openssl/objects.h>
28 28
29 29 +#include "ntp_machine.h" /* For clock_gettime fallback */
30 30 +
31 31 #define UNUSED_ARG(arg) ((void)(arg))
32 32
33 33 #ifndef EVP_MD_CTX_reset
34 ---- ./include/ntp_machine.h.orig 2019-06-21 19:41:51.000000000 -0700
35 -+++ ./include/ntp_machine.h 2019-07-11 17:54:24.000000000 -0700
36 -@@ -13,14 +13,135 @@
34 +--- ./include/ntp_machine.h.orig 2019-09-02 19:17:36.000000000 -0700
35 ++++ ./include/ntp_machine.h 2019-09-03 22:22:14.000000000 -0700
36 +@@ -13,14 +13,145 @@
37 37
38 38 #ifndef CLOCK_REALTIME
39 39 /*
40 40 - * Pacify platforms that don't have a real clock_gettime(2),
41 41 - * notably Mac OS X.
42 42 + * Handle platforms that don't have a real clock_gettime(2),
43 43 + * notably some versions of Mac OS X.
44 44 */
45 45 -#define CLOCK_REALTIME 0
46 46 -#define CLOCK_MONOTONIC 1
145 145 + res->tv_nsec = 1;
146 146 + return 0;
147 147 +#endif /* __APPLE__ */
148 148 +
149 149 + default:
150 150 + errno = EINVAL;
151 151 + return -1;
152 152 + }
153 153 +}
154 154 +
155 ++/*
156 ++ * Prototype for settimeofday() may suppressed by feature-test flags.
157 ++ * Provide it here just in case, and get an error if it mismatches.
158 ++ * Similarly, "struct timezone" definition may be suppressed, but the
159 ++ * incomplete definition provided here is adequate given that the
160 ++ * timezone argument is unused.
161 ++ */
162 ++struct timezone;
163 ++int settimeofday(const struct timeval *, const struct timezone *);
164 ++
155 165 +static inline int clock_settime(clockid_t clk_id, const struct timespec *tp)
156 166 +{
157 167 + switch (clk_id) {
158 168 +
159 169 + case CLOCK_REALTIME:
160 170 + {
161 171 + struct timeval tv;
162 172 +
163 173 + tv.tv_sec = tp->tv_sec;
164 174 + tv.tv_usec = (tp->tv_nsec + 500) / 1000;
168 178 + default:
169 179 + errno = EINVAL;
170 180 + return -1;
171 181 + }
172 182 +}
173 183 +
174 184 +#endif /* !CLOCK_REALTIME */
175 185
176 186 int ntp_set_tod (struct timespec *tvs);
177 187
178 ---- ./include/ntp_stdlib.h.orig 2019-06-21 19:41:51.000000000 -0700
179 -+++ ./include/ntp_stdlib.h 2019-07-11 17:54:24.000000000 -0700
180 -@@ -95,7 +95,9 @@ extern const char * eventstr (int);
188 +--- ./include/ntp_stdlib.h.orig 2019-09-02 19:17:36.000000000 -0700
189 ++++ ./include/ntp_stdlib.h 2019-09-03 22:22:14.000000000 -0700
190 +@@ -96,7 +96,9 @@ extern const char * eventstr (int);
181 191 extern const char * ceventstr (int);
182 192 extern const char * res_match_flags(unsigned short);
183 193 extern const char * res_access_flags(unsigned short);
184 194 +#ifdef HAVE_KERNEL_PLL
185 195 extern const char * k_st_flags (uint32_t);
186 196 +#endif
187 197 extern char * statustoa (int, int);
188 198 extern sockaddr_u * netof6 (sockaddr_u *);
189 199 extern const char * socktoa (const sockaddr_u *);
190 ---- ./include/ntp_syscall.h.orig 2019-06-21 19:41:51.000000000 -0700
191 -+++ ./include/ntp_syscall.h 2019-07-11 17:54:24.000000000 -0700
200 +--- ./include/ntp_syscall.h.orig 2019-09-02 19:17:36.000000000 -0700
201 ++++ ./include/ntp_syscall.h 2019-09-03 22:22:14.000000000 -0700
192 202 @@ -9,9 +9,11 @@
193 203 #ifndef GUARD_NTP_SYSCALL_H
194 204 #define GUARD_NTP_SYSCALL_H
195 205
196 206 +#ifdef HAVE_SYS_TIMEX_H
197 207 # include <sys/time.h> /* prerequisite on NetBSD */
198 208 # include <sys/timex.h>
199 209 extern int ntp_adjtime_ns(struct timex *);
200 210 +#endif
201 211
202 212 /*
203 213 * The units of the maxerror and esterror fields vary by platform. If
204 ---- ./libntp/clockwork.c.orig 2019-06-21 19:41:51.000000000 -0700
205 -+++ ./libntp/clockwork.c 2019-07-11 17:54:24.000000000 -0700
214 +--- ./libntp/clockwork.c.orig 2019-09-02 19:17:36.000000000 -0700
215 ++++ ./libntp/clockwork.c 2019-09-03 22:22:14.000000000 -0700
206 216 @@ -5,8 +5,10 @@
207 217 #include "config.h"
208 218
209 219 #include <unistd.h>
210 220 -#include <sys/time.h> /* prerequisite on NetBSD */
211 221 -#include <sys/timex.h>
212 222 +#ifdef HAVE_SYS_TIMEX_H
213 223 +# include <sys/time.h> /* prerequisite on NetBSD */
214 224 +# include <sys/timex.h>
215 225 +#endif
216 226
217 227 #include "ntp.h"
218 228 #include "ntp_machine.h"
219 ---- ./libntp/statestr.c.orig 2019-06-21 19:41:51.000000000 -0700
220 -+++ ./libntp/statestr.c 2019-07-11 17:54:24.000000000 -0700
229 +--- ./libntp/statestr.c.orig 2019-09-02 19:17:36.000000000 -0700
230 ++++ ./libntp/statestr.c 2019-09-03 22:22:14.000000000 -0700
221 231 @@ -12,7 +12,9 @@
222 232 #include "lib_strbuf.h"
223 233 #include "ntp_refclock.h"
224 234 #include "ntp_control.h"
225 235 +#ifdef HAVE_KERNEL_PLL
226 236 # include "ntp_syscall.h"
227 237 +#endif
228 238
229 239
230 240 /*
280 290 { STA_NANO, "nano" },
281 291 # endif
282 292 @@ -214,6 +243,7 @@ static const struct codestring k_st_bits
283 293 # endif
284 294 /* not used with getcode(), no terminating entry needed */
285 295 };
286 296 +#endif /* HAVE_KERNEL_PLL */
287 297
288 298 /* Forwards */
289 299 static const char * getcode(int, const struct codestring *);
290 -@@ -314,10 +344,12 @@ decode_bitflags(
300 +@@ -318,10 +348,12 @@ decode_bitflags(
291 301 "decode_bitflags(%s) can't decode 0x%x in %d bytes",
292 302 (tab == peer_st_bits)
293 303 ? "peer_st"
294 304 - :
295 305 + :
296 306 +#ifdef HAVE_KERNEL_PLL
297 307 (tab == k_st_bits)
298 308 ? "kern_st"
299 309 :
300 310 +#endif
301 311 "",
302 312 (unsigned)bits, (int)LIB_BUFLENGTH);
303 313 errno = saved_errno;
304 -@@ -356,6 +388,7 @@ res_access_flags(
314 +@@ -360,6 +392,7 @@ res_access_flags(
305 315 }
306 316
307 317
308 318 +#ifdef HAVE_KERNEL_PLL
309 319 const char *
310 320 k_st_flags(
311 321 uint32_t st
312 -@@ -363,6 +396,8 @@ k_st_flags(
322 +@@ -367,6 +400,8 @@ k_st_flags(
313 323 {
314 324 return decode_bitflags((int)st, " ", k_st_bits, COUNTOF(k_st_bits));
315 325 }
316 326 +#endif /* HAVE_KERNEL_PLL */
317 327 +
318 328
319 329 /*
320 330 * statustoa - return a descriptive string for a peer status
321 ---- ./ntpd/ntp_control.c.orig 2019-06-30 00:21:32.000000000 -0700
322 -+++ ./ntpd/ntp_control.c 2019-07-11 17:54:24.000000000 -0700
323 -@@ -1357,6 +1357,7 @@ ctl_putsys(
331 +--- ./ntpd/ntp_control.c.orig 2019-09-02 19:17:36.000000000 -0700
332 ++++ ./ntpd/ntp_control.c 2019-09-03 22:22:14.000000000 -0700
333 +@@ -1359,6 +1359,7 @@ ctl_putsys(
324 334 char str[256];
325 335 double dtemp;
326 336 const char *ss;
327 337 +#ifdef HAVE_KERNEL_PLL
328 338 static struct timex ntx;
329 339 static unsigned long ntp_adjtime_time;
330 340
331 -@@ -1372,6 +1373,7 @@ ctl_putsys(
341 +@@ -1374,6 +1375,7 @@ ctl_putsys(
332 342 else
333 343 ntp_adjtime_time = current_time;
334 344 }
335 345 +#endif /* HAVE_KERNEL_PLL */
336 346
337 347 switch (varid) {
338 348
339 -@@ -1767,50 +1769,93 @@ ctl_putsys(
349 +@@ -1769,50 +1771,93 @@ ctl_putsys(
340 350 break;
341 351
342 352 /*
343 353 - * CTL_IF_KERNPPS() puts a zero if kernel hard PPS is not
344 354 + * CTL_IF_KERNLOOP() puts a zero if the kernel loop is
345 355 + * unavailable, otherwise calls putfunc with args.
346 356 + */
347 357 +#ifndef HAVE_KERNEL_PLL
348 358 +# define CTL_IF_KERNLOOP(putfunc, args) \
349 359 + ctl_putint(sys_var[varid].text, 0)
435 445
436 446 case CS_K_FREQTOL:
437 447 - ctl_putsfp(sys_var[varid].text, ntx.tolerance);
438 448 + CTL_IF_KERNLOOP(
439 449 + ctl_putsfp,
440 450 + (sys_var[varid].text, ntx.tolerance)
441 451 + );
442 452 break;
443 453
444 454 case CS_K_PPS_FREQ:
445 ---- ./ntpd/ntp_loopfilter.c.orig 2019-06-21 19:41:51.000000000 -0700
446 -+++ ./ntpd/ntp_loopfilter.c 2019-07-11 17:54:24.000000000 -0700
455 +--- ./ntpd/ntp_loopfilter.c.orig 2019-09-02 19:17:36.000000000 -0700
456 ++++ ./ntpd/ntp_loopfilter.c 2019-09-03 22:22:14.000000000 -0700
447 457 @@ -23,8 +23,10 @@
448 458
449 459 #define NTP_MAXFREQ 500e-6
450 460
451 461 +#ifdef HAVE_KERNEL_PLL
452 462 # define FREQTOD(x) ((x) / 65536e6) /* NTP to double */
453 463 # define DTOFREQ(x) ((int32_t)((x) * 65536e6)) /* double to NTP */
454 464 +#endif /* HAVE_KERNEL_PLL */
455 465
456 466 /*
457 467 * This is an implementation of the clock discipline algorithm described
458 -@@ -127,6 +129,7 @@ static void rstclock (int, double); /* t
468 +@@ -125,6 +127,7 @@ static void rstclock (int, double); /* t
459 469 static double direct_freq(double); /* direct set frequency */
460 470 static void set_freq(double); /* set frequency */
461 471
462 472 +#ifdef HAVE_KERNEL_PLL
463 473 #ifndef PATH_MAX
464 474 # define PATH_MAX MAX_PATH
465 475 #endif
466 -@@ -140,6 +143,7 @@ static unsigned int loop_tai; /* last TA
476 +@@ -138,6 +141,7 @@ static unsigned int loop_tai; /* last TA
467 477 #endif /* STA_NANO */
468 478 static void start_kern_loop(void);
469 479 static void stop_kern_loop(void);
470 480 +#endif /* HAVE_KERNEL_PLL */
471 481
472 482 /*
473 483 * Clock state machine control flags
474 -@@ -156,7 +160,9 @@ struct clock_control_flags clock_ctl = {
484 +@@ -154,7 +158,9 @@ struct clock_control_flags clock_ctl = {
475 485 int freq_cnt; /* initial frequency clamp */
476 486
477 487 static int freq_set; /* initial set frequency switch */
478 488 +#ifdef HAVE_KERNEL_PLL
479 489 static bool ext_enable; /* external clock enabled */
480 490 +#endif /* HAVE_KERNEL_PLL */
481 491
482 492 /*
483 493 * Clock state machine variables
484 -@@ -174,6 +180,7 @@ static int sys_hufflen; /* huff-n'-puff
494 +@@ -172,6 +178,7 @@ static int sys_hufflen; /* huff-n'-puff
485 495 static int sys_huffptr; /* huff-n'-puff filter pointer */
486 496 static double sys_mindly; /* huff-n'-puff filter min delay */
487 497
488 498 +#if defined(HAVE_KERNEL_PLL)
489 499 /* Emacs cc-mode goes nuts if we split the next line... */
490 500 #define MOD_BITS (MOD_OFFSET | MOD_MAXERROR | MOD_ESTERROR | \
491 501 MOD_STATUS | MOD_TIMECONST)
492 -@@ -183,7 +190,9 @@ static struct sigaction sigsys; /* curre
502 +@@ -181,7 +188,9 @@ static struct sigaction sigsys; /* curre
493 503 static struct sigaction newsigsys; /* new sigaction status */
494 504 static sigjmp_buf env; /* environment var. for pll_trap() */
495 505 #endif /* SIGSYS */
496 506 +#endif /* HAVE_KERNEL_PLL */
497 507
498 508 +#ifdef HAVE_KERNEL_PLL
499 509 static void
500 - sync_status(const char *what, int ostatus, int nstatus)
501 - {
502 -@@ -208,6 +217,7 @@ static char *file_name(void)
510 + sync_status(const char *what, int ostatus, int nstatus) {
511 + /* only used in non-lockclock case */
512 +@@ -205,6 +214,7 @@ static char *file_name(void) {
503 513 }
504 514 return this_file;
505 515 }
506 516 +#endif /* HAVE_KERNEL_PLL */
507 517
508 518 /*
509 519 * init_loopfilter - initialize loop filter data
510 -@@ -223,6 +233,7 @@ init_loopfilter(void)
520 +@@ -219,6 +229,7 @@ init_loopfilter(void) {
511 521 freq_cnt = (int)clock_minstep;
512 522 }
513 523
514 524 +#ifdef HAVE_KERNEL_PLL
515 525 /*
516 526 * ntp_adjtime_error_handler - process errors from ntp_adjtime
517 527 */
518 -@@ -421,6 +432,7 @@ or, from ntp_adjtime():
528 +@@ -417,6 +428,7 @@ or, from ntp_adjtime():
519 529 }
520 530 return;
521 531 }
522 532 +#endif /* HAVE_KERNEL_PLL */
523 533
524 534 /*
525 535 * local_clock - the NTP logical clock loop filter.
526 -@@ -453,7 +465,9 @@ local_clock(
536 +@@ -450,7 +462,9 @@ local_clock(
527 537
528 538 int rval; /* return code */
529 539 int osys_poll; /* old system poll */
530 540 +#ifdef HAVE_KERNEL_PLL
531 541 int ntp_adj_ret; /* returned by ntp_adjtime */
532 542 +#endif /* HAVE_KERNEL_PLL */
533 543 double mu; /* interval since last update */
534 544 double clock_frequency; /* clock frequency */
535 545 double dtemp, etemp; /* double temps */
536 -@@ -705,6 +719,7 @@ local_clock(
546 +@@ -707,6 +721,7 @@ local_clock(
537 547 }
538 548 }
539 549
540 550 +#ifdef HAVE_KERNEL_PLL
541 551 /*
542 552 * This code segment works when clock adjustments are made using
543 553 * precision time kernel support and the ntp_adjtime() system
544 -@@ -820,6 +835,7 @@ local_clock(
554 +@@ -823,6 +838,7 @@ local_clock(
545 555 }
546 556 #endif /* STA_NANO */
547 557 }
548 558 +#endif /* HAVE_KERNEL_PLL */
549 559
550 560 /*
551 561 * Clamp the frequency within the tolerance range and calculate
552 -@@ -929,8 +945,10 @@ adj_host_clock(
562 +@@ -934,8 +950,10 @@ adj_host_clock(
553 563 } else if (freq_cnt > 0) {
554 564 offset_adj = clock_offset / (CLOCK_PLL * ULOGTOD(1));
555 565 freq_cnt--;
556 566 +#ifdef HAVE_KERNEL_PLL
557 567 } else if (clock_ctl.pll_control && clock_ctl.kern_enable) {
558 568 offset_adj = 0.;
559 569 +#endif /* HAVE_KERNEL_PLL */
560 570 } else {
561 - offset_adj = clock_offset / (CLOCK_PLL * ULOGTOD(sys_poll));
571 + offset_adj = clock_offset / (CLOCK_PLL * ULOGTOD(clkstate.sys_poll));
562 572 }
563 -@@ -941,9 +959,11 @@ adj_host_clock(
573 +@@ -946,9 +964,11 @@ adj_host_clock(
564 574 * set_freq(). Otherwise it is a component of the adj_systime()
565 575 * offset.
566 576 */
567 577 +#ifdef HAVE_KERNEL_PLL
568 578 if (clock_ctl.pll_control && clock_ctl.kern_enable)
569 579 freq_adj = 0.;
570 580 else
571 581 +#endif /* HAVE_KERNEL_PLL */
572 - freq_adj = drift_comp;
582 + freq_adj = loop_data.drift_comp;
573 583
574 584 /* Bound absolute value of total adjustment to NTP_MAXFREQ. */
575 -@@ -1031,6 +1051,7 @@ set_freq(
585 +@@ -1037,6 +1057,7 @@ set_freq(
576 586
577 - drift_comp = freq;
587 + loop_data.drift_comp = freq;
578 588 loop_desc = "ntpd";
579 589 +#ifdef HAVE_KERNEL_PLL
580 590 if (clock_ctl.pll_control) {
581 591 int ntp_adj_ret;
582 592 ZERO(ntv);
583 -@@ -1043,10 +1064,12 @@ set_freq(
593 +@@ -1049,10 +1070,12 @@ set_freq(
584 594 ntp_adjtime_error_handler(__func__, &ntv, ntp_adj_ret, errno, false, false, __LINE__ - 1);
585 595 }
586 596 }
587 597 +#endif /* HAVE_KERNEL_PLL */
588 598 mprintf_event(EVNT_FSET, NULL, "%s %.6f PPM", loop_desc,
589 - drift_comp * US_PER_S);
599 + loop_data.drift_comp * US_PER_S);
590 600 }
591 601
592 602 +#ifdef HAVE_KERNEL_PLL
593 603 static void
594 604 start_kern_loop(void)
595 605 {
596 -@@ -1107,8 +1130,10 @@ start_kern_loop(void)
606 +@@ -1113,8 +1136,10 @@ start_kern_loop(void)
597 607 "kernel time sync enabled");
598 608 }
599 609 }
600 610 +#endif /* HAVE_KERNEL_PLL */
601 611
602 612
603 613 +#ifdef HAVE_KERNEL_PLL
604 614 static void
605 615 stop_kern_loop(void)
606 616 {
607 -@@ -1116,6 +1141,7 @@ stop_kern_loop(void)
617 +@@ -1122,6 +1147,7 @@ stop_kern_loop(void)
608 618 report_event(EVNT_KERN, NULL,
609 619 "kernel time sync disabled");
610 620 }
611 621 +#endif /* HAVE_KERNEL_PLL */
612 622
613 623
614 624 /*
615 -@@ -1128,11 +1154,15 @@ select_loop(
625 +@@ -1134,11 +1160,15 @@ select_loop(
616 626 {
617 627 if (clock_ctl.kern_enable == use_kern_loop)
618 628 return;
619 629 +#ifdef HAVE_KERNEL_PLL
620 630 if (clock_ctl.pll_control && !use_kern_loop)
621 631 stop_kern_loop();
622 632 +#endif /* HAVE_KERNEL_PLL */
623 633 clock_ctl.kern_enable = use_kern_loop;
624 634 +#ifdef HAVE_KERNEL_PLL
625 635 if (clock_ctl.pll_control && use_kern_loop)
626 636 start_kern_loop();
627 637 +#endif /* HAVE_KERNEL_PLL */
628 638 /*
629 639 * If this loop selection change occurs after initial startup,
630 640 * call set_freq() to switch the frequency compensation to or
631 -@@ -1186,10 +1216,12 @@ loop_config(
641 +@@ -1194,10 +1224,12 @@ loop_config(
632 642 * variables. Otherwise, continue leaving no harm behind.
633 643 */
634 644 case LOOP_DRIFTINIT:
635 645 +#ifdef HAVE_KERNEL_PLL
636 - if (lockclock || clock_ctl.mode_ntpdate)
646 + if (loop_data.lockclock || clock_ctl.mode_ntpdate)
637 647 break;
638 648
639 649 start_kern_loop();
640 650 +#endif /* HAVE_KERNEL_PLL */
641 651
642 652 /*
643 653 * Initialize frequency if given; otherwise, begin frequency
644 -@@ -1207,11 +1239,14 @@ loop_config(
654 +@@ -1216,11 +1248,14 @@ loop_config(
645 655 rstclock(EVNT_FSET, 0);
646 656 else
647 657 rstclock(EVNT_NSET, 0);
648 658 +#ifdef HAVE_KERNEL_PLL
649 659 loop_started = true;
650 660 +#endif /* HAVE_KERNEL_PLL */
651 661 break;
652 662
653 663 case LOOP_KERN_CLEAR:
654 664 #if 0 /* XXX: needs more review, and how can we get here? */
655 665 +# ifdef HAVE_KERNEL_PLL
656 - if (!lockclock && (clock_ctl.pll_control && clock_ctl.kern_enable)) {
666 + if (!loop_data.lockclock && (clock_ctl.pll_control && clock_ctl.kern_enable)) {
657 667 memset((char *)&ntv, 0, sizeof(ntv));
658 668 ntv.modes = MOD_STATUS;
659 -@@ -1221,6 +1256,7 @@ loop_config(
669 +@@ -1230,6 +1265,7 @@ loop_config(
660 670 pll_status,
661 671 ntv.status);
662 672 }
663 673 +# endif /* HAVE_KERNEL_PLL */
664 674 #endif
665 675 break;
666 676
667 -@@ -1299,7 +1335,7 @@ loop_config(
677 +@@ -1310,7 +1346,7 @@ loop_config(
668 678 }
669 679
670 680
671 681 -#if defined(SIGSYS)
672 682 +#if defined(HAVE_KERNEL_PLL) && defined(SIGSYS)
673 683 /*
674 684 * _trap - trap processor for undefined syscalls
675 685 *
676 -@@ -1317,4 +1353,4 @@ pll_trap(
686 +@@ -1328,4 +1364,4 @@ pll_trap(
677 687 clock_ctl.pll_control = false;
678 688 siglongjmp(env, 1);
679 689 }
680 690 -#endif /* SIGSYS */
681 691 +#endif /* HAVE_KERNEL_PLL && SIGSYS */
682 ---- ./ntpd/ntp_timer.c.orig 2019-06-21 19:41:51.000000000 -0700
683 -+++ ./ntpd/ntp_timer.c 2019-07-11 17:54:24.000000000 -0700
692 +--- ./ntpd/ntp_timer.c.orig 2019-09-02 19:17:36.000000000 -0700
693 ++++ ./ntpd/ntp_timer.c 2019-09-03 22:22:14.000000000 -0700
684 694 @@ -13,7 +13,9 @@
685 695 #include <signal.h>
686 696 #include <unistd.h>
687 697
688 698 +#ifdef HAVE_KERNEL_PLL
689 699 #include "ntp_syscall.h"
690 700 +#endif /* HAVE_KERNEL_PLL */
691 701
692 702 #ifdef HAVE_TIMER_CREATE
693 703 /* TC_ERR represents the timer_create() error return value. */
696 706 leap_result_t lsdata;
697 707 uint32_t lsprox;
698 708 +#ifdef HAVE_KERNEL_PLL
699 709 leapsec_electric((clock_ctl.pll_control && clock_ctl.kern_enable) ? electric_on : electric_off);
700 710 +#else
701 711 + leapsec_electric(electric_off);
702 712 +#endif
703 713 #ifdef ENABLE_LEAP_SMEAR
704 714 leap_smear.enabled = (leap_smear_intv != 0);
705 715 #endif
706 ---- ./ntpd/refclock_local.c.orig 2019-06-21 19:41:51.000000000 -0700
707 -+++ ./ntpd/refclock_local.c 2019-07-11 17:54:24.000000000 -0700
716 +--- ./ntpd/refclock_local.c.orig 2019-09-02 19:17:36.000000000 -0700
717 ++++ ./ntpd/refclock_local.c 2019-09-03 22:22:14.000000000 -0700
708 718 @@ -158,6 +158,7 @@ local_poll(
709 719 * If another process is disciplining the system clock, we set
710 720 * the leap bits and quality indicators from the kernel.
711 721 */
712 722 +#ifdef HAVE_KERNEL_PLL
713 - if (lockclock) {
723 + if (loop_data.lockclock) {
714 724 struct timex ntv;
715 725 memset(&ntv, 0, sizeof ntv);
716 726 @@ -188,6 +189,13 @@ local_poll(
717 727 pp->disp = DISPERSION;
718 728 pp->jitter = 0;
719 729 }
720 730 + pp->disp = 0;
721 731 + pp->jitter = 0;
722 732 +#else /* !HAVE_KERNEL_PLL */
723 733 + pp->leap = LEAP_NOWARNING;
724 734 + pp->disp = DISPERSION;
725 735 + pp->jitter = 0;
726 736 +#endif /* !HAVE_KERNEL_PLL */
727 737 pp->lastref = pp->lastrec;
728 738 refclock_receive(peer);
729 739 }
730 ---- ./ntpfrob/precision.c.orig 2019-06-21 19:41:51.000000000 -0700
731 -+++ ./ntpfrob/precision.c 2019-07-11 17:54:24.000000000 -0700
740 +--- ./ntpfrob/precision.c.orig 2019-09-02 19:17:36.000000000 -0700
741 ++++ ./ntpfrob/precision.c 2019-09-03 22:22:14.000000000 -0700
732 742 @@ -11,6 +11,7 @@
733 743 #include "ntp_types.h"
734 744 #include "ntp_calendar.h"
735 745 #include "ntpfrob.h"
736 746 +#include "ntp_machine.h"
737 747
738 748 #define DEFAULT_SYS_PRECISION -99
739 749
740 ---- ./tests/libntp/statestr.c.orig 2019-06-21 19:41:51.000000000 -0700
741 -+++ ./tests/libntp/statestr.c 2019-07-11 17:54:24.000000000 -0700
750 +--- ./tests/libntp/statestr.c.orig 2019-09-02 19:17:36.000000000 -0700
751 ++++ ./tests/libntp/statestr.c 2019-09-03 22:22:14.000000000 -0700
742 752 @@ -4,7 +4,9 @@
743 753 #include "unity.h"
744 754 #include "unity_fixture.h"
745 755
746 756 +#ifdef HAVE_SYS_TIMEX_H
747 757 #include <sys/timex.h>
748 758 +#endif
749 759
750 760 TEST_GROUP(statestr);
751 761
752 762 @@ -29,7 +31,9 @@ TEST(statestr, ResAccessFlags) {
753 763
754 764 // k_st_flags()
755 765 TEST(statestr, KSTFlags) {
756 766 +#ifdef STA_PPSFREQ
757 767 TEST_ASSERT_EQUAL_STRING("ppsfreq", k_st_flags(STA_PPSFREQ));
758 768 +#endif
759 769 }
760 770
761 771 // statustoa
762 ---- ./wafhelpers/bin_test.py.orig 2019-06-21 19:41:51.000000000 -0700
763 -+++ ./wafhelpers/bin_test.py 2019-07-11 17:54:24.000000000 -0700
772 +--- ./wafhelpers/bin_test.py.orig 2019-09-02 19:17:36.000000000 -0700
773 ++++ ./wafhelpers/bin_test.py 2019-09-03 22:22:14.000000000 -0700
764 774 @@ -91,6 +91,12 @@ def cmd_bin_test(ctx, config):
765 775 for cmd in cmd_map3:
766 776 cmd_map2[cmd] = cmd_map3[cmd]
767 777
768 778 + # Kludge to remove ntptime if it didn't get built
769 779 + if not ctx.env.HEADER_SYS_TIMEX_H:
770 780 + for cmd in list(cmd_map.keys()):
771 781 + if 'ntptime' in cmd[0]:
772 782 + del cmd_map[cmd]
773 783 +
774 784 for cmd in sorted(cmd_map):
775 785 if not run(cmd, cmd_map[cmd], False):
776 786 fails += 1
777 ---- ./wafhelpers/options.py.orig 2019-06-21 19:41:51.000000000 -0700
778 -+++ ./wafhelpers/options.py 2019-07-11 17:54:24.000000000 -0700
787 +--- ./wafhelpers/options.py.orig 2019-09-02 19:17:36.000000000 -0700
788 ++++ ./wafhelpers/options.py 2019-09-03 22:22:14.000000000 -0700
779 789 @@ -19,6 +19,8 @@ def options_cmd(ctx, config):
780 790 help="Droproot earlier (breaks SHM and NetBSD).")
781 791 grp.add_option('--enable-seccomp', action='store_true',
782 792 default=False, help="Enable seccomp (restricts syscalls).")
783 793 + grp.add_option('--disable-kernel-pll', action='store_true',
784 794 + default=False, help="Disable kernel PLL.")
785 795 grp.add_option('--disable-mdns-registration', action='store_true',
786 796 default=False, help="Disable MDNS registration.")
787 797 grp.add_option(
788 ---- ./wscript.orig 2019-06-21 19:41:51.000000000 -0700
789 -+++ ./wscript 2019-07-11 17:54:24.000000000 -0700
798 +--- ./wscript.orig 2019-09-02 19:17:36.000000000 -0700
799 ++++ ./wscript 2019-09-03 22:22:14.000000000 -0700
790 800 @@ -593,7 +593,7 @@ int main(int argc, char **argv) {
791 801 structures = (
792 802 ("struct if_laddrconf", ["sys/types.h", "net/if6.h"], False),
793 803 ("struct if_laddrreq", ["sys/types.h", "net/if6.h"], False),
794 804 - ("struct timex", ["sys/time.h", "sys/timex.h"], True),
795 805 + ("struct timex", ["sys/time.h", "sys/timex.h"], False),
796 806 ("struct ntptimeval", ["sys/time.h", "sys/timex.h"], False),
797 807 )
798 808 for (s, h, r) in structures:
799 -@@ -795,6 +795,21 @@ int main(int argc, char **argv) {
809 +@@ -798,6 +798,21 @@ int main(int argc, char **argv) {
800 810 ctx.define("HAVE_WORKING_FORK", 1,
801 811 comment="Whether a working fork() exists")
802 812
803 813 + # Does the kernel implement a phase-locked loop for timing?
804 814 + # All modern Unixes (in particular Linux and *BSD) have this.
805 815 + #
806 816 + # The README for the (now deleted) kernel directory says this:
807 817 + # "If the precision-time kernel (KERNEL_PLL define) is
808 818 + # configured, the installation process requires the header
809 819 + # file /usr/include/sys/timex.h for the particular

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut