From c1deb0674cecd0c627c9da93abfaace945f8cfee Mon Sep 17 00:00:00 2001 From: Cy Schubert Date: Sun, 28 Jun 2020 03:28:28 +0000 Subject: [PATCH] MFC r362568: MFV r362565: Update 4.2.8p14 --> 4.2.8p15 Summary: Systems that use a CMAC algorithm in ntp.keys will not release a bit of memory on each packet that uses a CMAC keyid, eventually causing ntpd to run out of memory and fail. The CMAC cleanup from https://bugs.ntp.org/3447, part of ntp-4.2.8p11, introduced a bug whereby the CMAC data structure was no longer completely removed. Security: NTP Bug 3661 --- contrib/ntp/ChangeLog | 29 + contrib/ntp/CommitLog | 717 +++++++++++++++++- contrib/ntp/NEWS | 38 + contrib/ntp/config.h.in | 6 + contrib/ntp/configure | 22 +- contrib/ntp/configure.ac | 2 +- contrib/ntp/html/drivers/driver40-ja.html | 12 +- contrib/ntp/html/drivers/driver40.html | 11 +- contrib/ntp/include/l_stdlib.h | 9 + contrib/ntp/include/ntp.h | 2 +- contrib/ntp/include/ntp_config.h | 10 - contrib/ntp/include/recvbuff.h | 30 +- contrib/ntp/lib/isc/win32/include/isc/int.h | 4 +- contrib/ntp/libntp/a_md5encrypt.c | 2 +- contrib/ntp/libntp/decodenetnum.c | 200 +++-- contrib/ntp/libntp/recvbuff.c | 204 +++-- contrib/ntp/libntp/strdup.c | 34 +- contrib/ntp/libntp/timexsup.c | 7 +- contrib/ntp/ntpd/invoke-ntp.conf.texi | 2 +- contrib/ntp/ntpd/invoke-ntp.keys.texi | 2 +- contrib/ntp/ntpd/invoke-ntpd.texi | 4 +- contrib/ntp/ntpd/ntp.conf.5man | 4 +- contrib/ntp/ntpd/ntp.conf.5mdoc | 4 +- contrib/ntp/ntpd/ntp.conf.html | 2 +- contrib/ntp/ntpd/ntp.conf.man.in | 4 +- contrib/ntp/ntpd/ntp.conf.mdoc.in | 4 +- contrib/ntp/ntpd/ntp.keys.5man | 4 +- contrib/ntp/ntpd/ntp.keys.5mdoc | 4 +- contrib/ntp/ntpd/ntp.keys.html | 2 +- contrib/ntp/ntpd/ntp.keys.man.in | 4 +- contrib/ntp/ntpd/ntp.keys.mdoc.in | 4 +- contrib/ntp/ntpd/ntp_config.c | 12 +- contrib/ntp/ntpd/ntp_io.c | 36 +- contrib/ntp/ntpd/ntp_proto.c | 57 +- contrib/ntp/ntpd/ntp_refclock.c | 72 +- contrib/ntp/ntpd/ntp_request.c | 2 +- contrib/ntp/ntpd/ntp_timer.c | 35 +- contrib/ntp/ntpd/ntpd-opts.c | 14 +- contrib/ntp/ntpd/ntpd-opts.h | 6 +- contrib/ntp/ntpd/ntpd.1ntpdman | 4 +- contrib/ntp/ntpd/ntpd.1ntpdmdoc | 4 +- contrib/ntp/ntpd/ntpd.html | 4 +- contrib/ntp/ntpd/ntpd.man.in | 4 +- contrib/ntp/ntpd/ntpd.mdoc.in | 4 +- contrib/ntp/ntpd/refclock_jjy.c | 108 ++- contrib/ntp/ntpd/refclock_nmea.c | 2 +- contrib/ntp/ntpd/refclock_palisade.c | 48 +- contrib/ntp/ntpd/refclock_parse.c | 2 +- contrib/ntp/ntpdate/ntpdate.c | 5 +- contrib/ntp/ntpdc/invoke-ntpdc.texi | 4 +- contrib/ntp/ntpdc/ntpdc-opts.c | 14 +- contrib/ntp/ntpdc/ntpdc-opts.h | 6 +- contrib/ntp/ntpdc/ntpdc.1ntpdcman | 4 +- contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc | 4 +- contrib/ntp/ntpdc/ntpdc.html | 4 +- contrib/ntp/ntpdc/ntpdc.man.in | 4 +- contrib/ntp/ntpdc/ntpdc.mdoc.in | 4 +- contrib/ntp/ntpq/invoke-ntpq.texi | 4 +- contrib/ntp/ntpq/ntpq-opts.c | 14 +- contrib/ntp/ntpq/ntpq-opts.h | 6 +- contrib/ntp/ntpq/ntpq.1ntpqman | 4 +- contrib/ntp/ntpq/ntpq.1ntpqmdoc | 4 +- contrib/ntp/ntpq/ntpq.html | 4 +- contrib/ntp/ntpq/ntpq.man.in | 4 +- contrib/ntp/ntpq/ntpq.mdoc.in | 4 +- contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi | 2 +- contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c | 14 +- contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h | 6 +- contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman | 4 +- contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc | 4 +- contrib/ntp/ntpsnmpd/ntpsnmpd.html | 2 +- contrib/ntp/ntpsnmpd/ntpsnmpd.man.in | 4 +- contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in | 4 +- contrib/ntp/packageinfo.sh | 2 +- .../calc_tickadj.1calc_tickadjman | 4 +- .../calc_tickadj.1calc_tickadjmdoc | 4 +- .../scripts/calc_tickadj/calc_tickadj.html | 2 +- .../scripts/calc_tickadj/calc_tickadj.man.in | 4 +- .../scripts/calc_tickadj/calc_tickadj.mdoc.in | 4 +- .../calc_tickadj/invoke-calc_tickadj.texi | 2 +- contrib/ntp/scripts/invoke-plot_summary.texi | 4 +- contrib/ntp/scripts/invoke-summary.texi | 4 +- .../ntp/scripts/ntp-wait/invoke-ntp-wait.texi | 4 +- contrib/ntp/scripts/ntp-wait/ntp-wait-opts | 4 +- .../scripts/ntp-wait/ntp-wait.1ntp-waitman | 4 +- .../scripts/ntp-wait/ntp-wait.1ntp-waitmdoc | 4 +- contrib/ntp/scripts/ntp-wait/ntp-wait.html | 4 +- contrib/ntp/scripts/ntp-wait/ntp-wait.man.in | 4 +- contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in | 4 +- .../ntp/scripts/ntpsweep/invoke-ntpsweep.texi | 4 +- contrib/ntp/scripts/ntpsweep/ntpsweep-opts | 4 +- .../scripts/ntpsweep/ntpsweep.1ntpsweepman | 4 +- .../scripts/ntpsweep/ntpsweep.1ntpsweepmdoc | 4 +- contrib/ntp/scripts/ntpsweep/ntpsweep.html | 4 +- contrib/ntp/scripts/ntpsweep/ntpsweep.man.in | 4 +- contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in | 4 +- .../ntp/scripts/ntptrace/invoke-ntptrace.texi | 4 +- contrib/ntp/scripts/ntptrace/ntptrace-opts | 4 +- .../scripts/ntptrace/ntptrace.1ntptraceman | 4 +- .../scripts/ntptrace/ntptrace.1ntptracemdoc | 4 +- contrib/ntp/scripts/ntptrace/ntptrace.html | 4 +- contrib/ntp/scripts/ntptrace/ntptrace.man.in | 4 +- contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in | 4 +- contrib/ntp/scripts/plot_summary-opts | 4 +- .../ntp/scripts/plot_summary.1plot_summaryman | 4 +- .../scripts/plot_summary.1plot_summarymdoc | 4 +- contrib/ntp/scripts/plot_summary.html | 4 +- contrib/ntp/scripts/plot_summary.man.in | 4 +- contrib/ntp/scripts/plot_summary.mdoc.in | 4 +- contrib/ntp/scripts/summary-opts | 4 +- contrib/ntp/scripts/summary.1summaryman | 4 +- contrib/ntp/scripts/summary.1summarymdoc | 4 +- contrib/ntp/scripts/summary.html | 4 +- contrib/ntp/scripts/summary.man.in | 4 +- contrib/ntp/scripts/summary.mdoc.in | 4 +- .../update-leap/invoke-update-leap.texi | 2 +- .../ntp/scripts/update-leap/update-leap-opts | 4 +- .../update-leap/update-leap.1update-leapman | 4 +- .../update-leap/update-leap.1update-leapmdoc | 4 +- .../ntp/scripts/update-leap/update-leap.html | 2 +- .../scripts/update-leap/update-leap.man.in | 4 +- .../scripts/update-leap/update-leap.mdoc.in | 4 +- contrib/ntp/sntp/configure | 20 +- contrib/ntp/sntp/crypto.c | 3 +- contrib/ntp/sntp/include/version.def | 2 +- contrib/ntp/sntp/include/version.texi | 6 +- contrib/ntp/sntp/invoke-sntp.texi | 4 +- contrib/ntp/sntp/m4/version.m4 | 2 +- contrib/ntp/sntp/sntp-opts.c | 14 +- contrib/ntp/sntp/sntp-opts.h | 6 +- contrib/ntp/sntp/sntp.1sntpman | 4 +- contrib/ntp/sntp/sntp.1sntpmdoc | 4 +- contrib/ntp/sntp/sntp.html | 4 +- contrib/ntp/sntp/sntp.man.in | 4 +- contrib/ntp/sntp/sntp.mdoc.in | 4 +- contrib/ntp/sntp/version.c | 2 +- contrib/ntp/util/invoke-ntp-keygen.texi | 4 +- contrib/ntp/util/ntp-keygen-opts.c | 14 +- contrib/ntp/util/ntp-keygen-opts.h | 6 +- contrib/ntp/util/ntp-keygen.1ntp-keygenman | 4 +- contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc | 4 +- contrib/ntp/util/ntp-keygen.html | 4 +- contrib/ntp/util/ntp-keygen.man.in | 4 +- contrib/ntp/util/ntp-keygen.mdoc.in | 4 +- usr.sbin/ntp/config.h | 6 +- usr.sbin/ntp/scripts/mkver | 2 +- 146 files changed, 1642 insertions(+), 605 deletions(-) diff --git a/contrib/ntp/ChangeLog b/contrib/ntp/ChangeLog index 35d5d36c2fa..c0db6042c9f 100644 --- a/contrib/ntp/ChangeLog +++ b/contrib/ntp/ChangeLog @@ -1,3 +1,32 @@ +--- +(4.2.8p15) 2020/06/23 Released by Harlan Stenn +(4.2.8p15) 2020/06/23 Released by Harlan Stenn + +* [Sec 3661] memory leak with AES128CMAC keys +* [Bug 3670] Regression from bad merge of 3592 and 3596 + - fixed a bad merge that happened before 4.2.8-p14. Thanks to + Sylar Tao for noticing this! +* [Bug 3667] decodenetnum fails with numeric port + - rewrite 'decodenetnum()' in terms of inet_pton +* [Bug 3666] avoid unlimited receive buffer allocation + - limit number of receive buffers, with an iron reserve for refclocks +* [Bug 3664] Enable openSSL CMAC support on Windows +* [Bug 3662] Fix build errors on Windows with VS2008 +* [Bug 3660] Manycast orphan mode startup discovery problem. + - integrated patch from Charles Claggett +* [Bug 3659] Move definition of psl[] from ntp_config.h to + ntp_config.h +* [Bug 3657] Wrong "Autokey group mismatch" debug message +* [Bug 3655] ntpdc memstats hash counts + - fix by Gerry garvey +* [Bug 3653] Refclock jitter RMS calculation + - thanks to Gerry Garvey +* [Bug 3646] Avoid sync with unsync orphan + - patch by Gerry Garvey +* [Bug 3644] Unsynchronized server [...] selected as candidate +* [Bug 3639] refclock_jjy: TS-JJY0x can skip time sync depending on the STUS reply. + - applied patch by Takao Abe + --- (4.2.8p14) 2020/03/03 Released by Harlan Stenn diff --git a/contrib/ntp/CommitLog b/contrib/ntp/CommitLog index d4d2869006d..80104bc8d78 100644 --- a/contrib/ntp/CommitLog +++ b/contrib/ntp/CommitLog @@ -1,3 +1,700 @@ +ChangeSet@1.3911, 2020-06-23 02:22:19-07:00, ntpreleng@ntp-build.tal1.ntfo.org + NTP_4_2_8P15 + TAG: NTP_4_2_8P15 + + ChangeLog@1.1985 +1 -0 + NTP_4_2_8P15 + + ntpd/invoke-ntp.conf.texi@1.222 +1 -1 + NTP_4_2_8P15 + + ntpd/invoke-ntp.keys.texi@1.207 +1 -1 + NTP_4_2_8P15 + + ntpd/invoke-ntpd.texi@1.521 +2 -2 + NTP_4_2_8P15 + + ntpd/ntp.conf.5man@1.256 +2 -2 + NTP_4_2_8P15 + + ntpd/ntp.conf.5mdoc@1.256 +2 -2 + NTP_4_2_8P15 + + ntpd/ntp.conf.html@1.204 +1 -1 + NTP_4_2_8P15 + + ntpd/ntp.conf.man.in@1.256 +2 -2 + NTP_4_2_8P15 + + ntpd/ntp.conf.mdoc.in@1.256 +2 -2 + NTP_4_2_8P15 + + ntpd/ntp.keys.5man@1.241 +2 -2 + NTP_4_2_8P15 + + ntpd/ntp.keys.5mdoc@1.241 +2 -2 + NTP_4_2_8P15 + + ntpd/ntp.keys.html@1.202 +1 -1 + NTP_4_2_8P15 + + ntpd/ntp.keys.man.in@1.241 +2 -2 + NTP_4_2_8P15 + + ntpd/ntp.keys.mdoc.in@1.241 +2 -2 + NTP_4_2_8P15 + + ntpd/ntpd-opts.c@1.544 +7 -7 + NTP_4_2_8P15 + + ntpd/ntpd-opts.h@1.543 +3 -3 + NTP_4_2_8P15 + + ntpd/ntpd.1ntpdman@1.350 +2 -2 + NTP_4_2_8P15 + + ntpd/ntpd.1ntpdmdoc@1.350 +2 -2 + NTP_4_2_8P15 + + ntpd/ntpd.html@1.195 +2 -2 + NTP_4_2_8P15 + + ntpd/ntpd.man.in@1.350 +2 -2 + NTP_4_2_8P15 + + ntpd/ntpd.mdoc.in@1.350 +2 -2 + NTP_4_2_8P15 + + ntpdc/invoke-ntpdc.texi@1.518 +2 -2 + NTP_4_2_8P15 + + ntpdc/ntpdc-opts.c@1.537 +7 -7 + NTP_4_2_8P15 + + ntpdc/ntpdc-opts.h@1.536 +3 -3 + NTP_4_2_8P15 + + ntpdc/ntpdc.1ntpdcman@1.349 +2 -2 + NTP_4_2_8P15 + + ntpdc/ntpdc.1ntpdcmdoc@1.349 +2 -2 + NTP_4_2_8P15 + + ntpdc/ntpdc.html@1.364 +2 -2 + NTP_4_2_8P15 + + ntpdc/ntpdc.man.in@1.349 +2 -2 + NTP_4_2_8P15 + + ntpdc/ntpdc.mdoc.in@1.349 +2 -2 + NTP_4_2_8P15 + + ntpq/invoke-ntpq.texi@1.528 +2 -2 + NTP_4_2_8P15 + + ntpq/ntpq-opts.c@1.546 +7 -7 + NTP_4_2_8P15 + + ntpq/ntpq-opts.h@1.544 +3 -3 + NTP_4_2_8P15 + + ntpq/ntpq.1ntpqman@1.356 +2 -2 + NTP_4_2_8P15 + + ntpq/ntpq.1ntpqmdoc@1.356 +2 -2 + NTP_4_2_8P15 + + ntpq/ntpq.html@1.195 +2 -2 + NTP_4_2_8P15 + + ntpq/ntpq.man.in@1.356 +2 -2 + NTP_4_2_8P15 + + ntpq/ntpq.mdoc.in@1.356 +2 -2 + NTP_4_2_8P15 + + ntpsnmpd/invoke-ntpsnmpd.texi@1.520 +1 -1 + NTP_4_2_8P15 + + ntpsnmpd/ntpsnmpd-opts.c@1.539 +7 -7 + NTP_4_2_8P15 + + ntpsnmpd/ntpsnmpd-opts.h@1.538 +3 -3 + NTP_4_2_8P15 + + ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.349 +2 -2 + NTP_4_2_8P15 + + ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.349 +2 -2 + NTP_4_2_8P15 + + ntpsnmpd/ntpsnmpd.html@1.188 +1 -1 + NTP_4_2_8P15 + + ntpsnmpd/ntpsnmpd.man.in@1.349 +2 -2 + NTP_4_2_8P15 + + ntpsnmpd/ntpsnmpd.mdoc.in@1.349 +2 -2 + NTP_4_2_8P15 + + packageinfo.sh@1.546 +2 -2 + NTP_4_2_8P15 + + scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.110 +2 -2 + NTP_4_2_8P15 + + scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.111 +2 -2 + NTP_4_2_8P15 + + scripts/calc_tickadj/calc_tickadj.html@1.111 +1 -1 + NTP_4_2_8P15 + + scripts/calc_tickadj/calc_tickadj.man.in@1.109 +2 -2 + NTP_4_2_8P15 + + scripts/calc_tickadj/calc_tickadj.mdoc.in@1.111 +2 -2 + NTP_4_2_8P15 + + scripts/calc_tickadj/invoke-calc_tickadj.texi@1.114 +1 -1 + NTP_4_2_8P15 + + scripts/invoke-plot_summary.texi@1.132 +2 -2 + NTP_4_2_8P15 + + scripts/invoke-summary.texi@1.131 +2 -2 + NTP_4_2_8P15 + + scripts/ntp-wait/invoke-ntp-wait.texi@1.342 +2 -2 + NTP_4_2_8P15 + + scripts/ntp-wait/ntp-wait-opts@1.78 +2 -2 + NTP_4_2_8P15 + + scripts/ntp-wait/ntp-wait.1ntp-waitman@1.338 +2 -2 + NTP_4_2_8P15 + + scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.339 +2 -2 + NTP_4_2_8P15 + + scripts/ntp-wait/ntp-wait.html@1.360 +2 -2 + NTP_4_2_8P15 + + scripts/ntp-wait/ntp-wait.man.in@1.338 +2 -2 + NTP_4_2_8P15 + + scripts/ntp-wait/ntp-wait.mdoc.in@1.339 +2 -2 + NTP_4_2_8P15 + + scripts/ntpsweep/invoke-ntpsweep.texi@1.129 +2 -2 + NTP_4_2_8P15 + + scripts/ntpsweep/ntpsweep-opts@1.80 +2 -2 + NTP_4_2_8P15 + + scripts/ntpsweep/ntpsweep.1ntpsweepman@1.117 +2 -2 + NTP_4_2_8P15 + + scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.117 +2 -2 + NTP_4_2_8P15 + + scripts/ntpsweep/ntpsweep.html@1.132 +2 -2 + NTP_4_2_8P15 + + scripts/ntpsweep/ntpsweep.man.in@1.117 +2 -2 + NTP_4_2_8P15 + + scripts/ntpsweep/ntpsweep.mdoc.in@1.118 +2 -2 + NTP_4_2_8P15 + + scripts/ntptrace/invoke-ntptrace.texi@1.131 +2 -2 + NTP_4_2_8P15 + + scripts/ntptrace/ntptrace-opts@1.80 +2 -2 + NTP_4_2_8P15 + + scripts/ntptrace/ntptrace.1ntptraceman@1.117 +2 -2 + NTP_4_2_8P15 + + scripts/ntptrace/ntptrace.1ntptracemdoc@1.118 +2 -2 + NTP_4_2_8P15 + + scripts/ntptrace/ntptrace.html@1.133 +2 -2 + NTP_4_2_8P15 + + scripts/ntptrace/ntptrace.man.in@1.117 +2 -2 + NTP_4_2_8P15 + + scripts/ntptrace/ntptrace.mdoc.in@1.119 +2 -2 + NTP_4_2_8P15 + + scripts/plot_summary-opts@1.81 +2 -2 + NTP_4_2_8P15 + + scripts/plot_summary.1plot_summaryman@1.130 +2 -2 + NTP_4_2_8P15 + + scripts/plot_summary.1plot_summarymdoc@1.130 +2 -2 + NTP_4_2_8P15 + + scripts/plot_summary.html@1.135 +2 -2 + NTP_4_2_8P15 + + scripts/plot_summary.man.in@1.130 +2 -2 + NTP_4_2_8P15 + + scripts/plot_summary.mdoc.in@1.130 +2 -2 + NTP_4_2_8P15 + + scripts/summary-opts@1.80 +2 -2 + NTP_4_2_8P15 + + scripts/summary.1summaryman@1.129 +2 -2 + NTP_4_2_8P15 + + scripts/summary.1summarymdoc@1.129 +2 -2 + NTP_4_2_8P15 + + scripts/summary.html@1.134 +2 -2 + NTP_4_2_8P15 + + scripts/summary.man.in@1.129 +2 -2 + NTP_4_2_8P15 + + scripts/summary.mdoc.in@1.129 +2 -2 + NTP_4_2_8P15 + + scripts/update-leap/invoke-update-leap.texi@1.30 +1 -1 + NTP_4_2_8P15 + + scripts/update-leap/update-leap-opts@1.31 +2 -2 + NTP_4_2_8P15 + + scripts/update-leap/update-leap.1update-leapman@1.30 +2 -2 + NTP_4_2_8P15 + + scripts/update-leap/update-leap.1update-leapmdoc@1.30 +2 -2 + NTP_4_2_8P15 + + scripts/update-leap/update-leap.html@1.31 +1 -1 + NTP_4_2_8P15 + + scripts/update-leap/update-leap.man.in@1.30 +2 -2 + NTP_4_2_8P15 + + scripts/update-leap/update-leap.mdoc.in@1.30 +2 -2 + NTP_4_2_8P15 + + sntp/invoke-sntp.texi@1.520 +2 -2 + NTP_4_2_8P15 + + sntp/sntp-opts.c@1.540 +7 -7 + NTP_4_2_8P15 + + sntp/sntp-opts.h@1.538 +3 -3 + NTP_4_2_8P15 + + sntp/sntp.1sntpman@1.355 +2 -2 + NTP_4_2_8P15 + + sntp/sntp.1sntpmdoc@1.355 +2 -2 + NTP_4_2_8P15 + + sntp/sntp.html@1.536 +2 -2 + NTP_4_2_8P15 + + sntp/sntp.man.in@1.355 +2 -2 + NTP_4_2_8P15 + + sntp/sntp.mdoc.in@1.355 +2 -2 + NTP_4_2_8P15 + + util/invoke-ntp-keygen.texi@1.523 +2 -2 + NTP_4_2_8P15 + + util/ntp-keygen-opts.c@1.542 +7 -7 + NTP_4_2_8P15 + + util/ntp-keygen-opts.h@1.540 +3 -3 + NTP_4_2_8P15 + + util/ntp-keygen.1ntp-keygenman@1.351 +2 -2 + NTP_4_2_8P15 + + util/ntp-keygen.1ntp-keygenmdoc@1.351 +2 -2 + NTP_4_2_8P15 + + util/ntp-keygen.html@1.196 +2 -2 + NTP_4_2_8P15 + + util/ntp-keygen.man.in@1.351 +2 -2 + NTP_4_2_8P15 + + util/ntp-keygen.mdoc.in@1.351 +2 -2 + NTP_4_2_8P15 + +ChangeSet@1.3910, 2020-06-23 02:05:32-07:00, ntpreleng@ntp-build.tal1.ntfo.org + ntp-4.2.8p15 + + packageinfo.sh@1.545 +1 -1 + ntp-4.2.8p15 + +ChangeSet@1.3908, 2020-06-09 07:12:27-04:00, stenn@psp-deb2.ntp.org + p15 updates + + ChangeLog@1.1983 +1 -1 + p15 updates + + NEWS@1.214 +1 -1 + p15 updates + +ChangeSet@1.3896.1.22, 2020-06-09 07:09:18-04:00, stenn@psp-deb2.ntp.org + 3670 + + ChangeLog@1.1974.1.14 +1 -1 + 3670 + + NEWS@1.205.1.7 +3 -1 + 3670 + +ChangeSet@1.3896.1.21, 2020-06-09 08:39:26+02:00, perlinger@ntp.org + [Bug 3670] Deleted statements come back + + ChangeLog@1.1974.1.13 +3 -0 + [Bug 3670] Deleted statements come back + + ntpd/ntp_proto.c@1.437 +4 -19 + [Bug 3670] Deleted statements come back + +ChangeSet@1.3906, 2020-05-31 09:52:14+00:00, stenn@psp-deb1.ntp.org + update the expected releease date + + NEWS@1.213 +1 -1 + update the expected releease date + +ChangeSet@1.3896.9.3, 2020-05-31 09:49:39+00:00, stenn@psp-deb1.ntp.org + Update ChangeLog and NEWS files for 3644 + + ChangeLog@1.1974.1.12 +1 -3 + Update ChangeLog and NEWS files for 3644 + + NEWS@1.205.1.6 +2 -1 + Update ChangeLog and NEWS files for 3644 + +ChangeSet@1.3896.9.2, 2020-05-31 09:47:05+00:00, stenn@psp-deb1.ntp.org + [Bug 3644]: Do we want to log an event in this case? + + ntpd/ntp_timer.c@1.99 +2 -0 + [Bug 3644]: Do we want to log an event in this case? + +ChangeSet@1.3896.9.1, 2020-05-31 11:13:45+02:00, perlinger@ntp.org + [Bug 3644] Unsynchronized server (minsane not satisfied) selected as candidate + + ChangeLog@1.1974.1.11 +3 -0 + [Bug 3644] Unsynchronized server (minsane not satisfied) selected as candidate + + include/ntp.h@1.233 +1 -1 + [Bug 3644] Unsynchronized server [...] selected as candidate + - comment typo + + ntpd/ntp_proto.c@1.436 +2 -3 + [Bug 3644] Unsynchronized server (minsane not satisfied) selected as candidate + + ntpd/ntp_timer.c@1.98 +24 -9 + [Bug 3644] Unsynchronized server (minsane not satisfied) selected as candidate + - according to DLM, we should go S16/UNSYNCED if we have no proper orphan config + +ChangeSet@1.3896.1.19, 2020-05-25 12:42:46+02:00, nb241700@md2g3rcc.ad001.siemens.net + [Bug 3667] decodenetnum fails with numeric port + - windows compilation issues + + libntp/decodenetnum.c@1.21 +1 -1 + [Bug 3667] decodenetnum fails with numeric port + - windows compilation issues ('sa_family_t' is POSIX, now ANSI/MSVC) + + libntp/strdup.c@1.11 +3 -3 + [Bug 3667] decodenetnum fails with numeric port + - windows compilation issues (typo+cast in memchr replacement) + + ports/winnt/include/config.h@1.117 +2 -0 + [Bug 3667] decodenetnum fails with numeric port + - windows compilation issues (have memchr() and strnlen() in MSVC) + +ChangeSet@1.3896.1.18, 2020-05-22 06:07:28+00:00, stenn@psp-deb1.ntp.org + Update NEWS file with 3667 + + NEWS@1.205.1.5 +3 -1 + Update NEWS file with 3667 + +ChangeSet@1.3896.1.17, 2020-05-22 06:05:45+00:00, stenn@psp-deb1.ntp.org + cleanup + + ChangeLog@1.1974.1.10 +2 -4 + cleanup + +ChangeSet@1.3896.1.16, 2020-05-22 06:04:57+00:00, stenn@psp-deb1.ntp.org + indentation tweaks + + tests/libntp/sockaddrtest.c@1.5 +7 -7 + indentation tweaks + +ChangeSet@1.3896.1.15, 2020-05-20 09:44:15+02:00, perlinger@ntp.org + [Bug 3667] decodenetnum fails with numeric port + + ChangeLog@1.1974.1.9 +4 -0 + [Bug 3667] decodenetnum fails with numeric port + + configure.ac@1.619 +1 -1 + [Bug 3667] decodenetnum fails with numeric port + sidekick: implement strnlen() and memchr() for ancient hosts (pogo.udel.edu...) + + include/l_stdlib.h@1.21 +9 -0 + [Bug 3667] decodenetnum fails with numeric port + sidekick: implement strnlen() and memchr() for ancient hosts (pogo.udel.edu...) + + libntp/decodenetnum.c@1.20 +123 -77 + [Bug 3667] decodenetnum fails with numeric port + - rewrite in terms of inet_pton() and strtoul(), no getaddrinfo() any more + + libntp/strdup.c@1.10 +29 -3 + [Bug 3667] decodenetnum fails with numeric port + sidekick: implement strnlen() and memchr() for ancient hosts (pogo.udel.edu...) + + tests/libntp/decodenetnum.c@1.13 +94 -6 + [Bug 3667] decodenetnum fails with numeric port + - additional tests + + tests/libntp/netof.c@1.10 +2 -0 + Bug 3667 - decodenetnum fails with numeric port + - clear address buffers before use + + tests/libntp/run-decodenetnum.c@1.14 +8 -2 + [Bug 3667] decodenetnum fails with numeric port + - regenerated + + tests/libntp/sockaddrtest.c@1.4 +2 -1 + [Bug 3667] decodenetnum fails with numeric port + - include scope id in IPv6 compare + +ChangeSet@1.3896.1.14, 2020-05-14 03:45:40-07:00, harlan@psp-at0.tal1.ntfo.org + Added 3660 to the NEWS file + + NEWS@1.205.1.4 +3 -1 + Added 3660 to the NEWS file + +ChangeSet@1.3896.8.1, 2020-05-14 03:14:44-07:00, harlan@psp-at0.tal1.ntfo.org + [Bug 3660] Manycast orphan mode startup discovery problem + + ChangeLog@1.1974.8.1 +5 -0 + [Bug 3660] Manycast orphan mode startup discovery problem + + ntpd/ntp_proto.c@1.432.2.1 +2 -1 + [Bug 3660] Manycast orphan mode startup discovery problem + +ChangeSet@1.3896.1.12, 2020-05-10 11:26:21+00:00, stenn@psp-deb1.ntp.org + Update NEWS + + NEWS@1.205.1.3 +3 -1 + Update NEWS + +ChangeSet@1.3896.1.11, 2020-05-10 09:44:50+00:00, stenn@psp-deb1.ntp.org + Merge cleanup + + ChangeLog@1.1974.1.7 +2 -4 + Merge cleanup + +ChangeSet@1.3896.1.10, 2020-05-09 08:20:44+02:00, perlinger@ntp.org + [Bug 3666] avoid unlimited receive buffer allocation + + BitKeeper/etc/ignore@1.95 +1 -0 + [Bug 3666] avoid unlimited receive buffer allocation + - (sidekick) ignore the '.vs' directory of VS2017 & above + + ChangeLog@1.1974.1.6 +4 -0 + [Bug 3666] avoid unlimited receive buffer allocation + + include/recvbuff.h@1.28 +23 -7 + [Bug 3666] avoid unlimited receive buffer allocation + - buffer count limit is 4096 now, always enforced + - API change for urgent buffers + + lib/isc/win32/include/isc/int.h@1.5 +3 -1 + [Bug 3666] avoid unlimited receive buffer allocation + - (sidekick) define standard reserved macros only if not yet defined! + + libntp/recvbuff.c@1.44 +131 -73 + [Bug 3666] avoid unlimited receive buffer allocation + - don't exceed RECV_TOOMANY allocated buffers + - keep emergency reserve for clocks + + libntp/timexsup.c@1.3 +3 -4 + [bug 3666] avoid unlimited receive buffer allocation + - (sidekick) fix some warnings of clang on lp64 targets + + ntpd/ntp_io.c@1.432 +23 -13 + [Bug 3666] avoid unlimited receive buffer allocation + - support urgent buffer reserve for refclocks + + ntpd/refclock_parse.c@1.89 +1 -1 + [Bug 3666] avoid unlimited receive buffer allocation + - support urgent buffer reserve for refclocks + + ntpdate/ntpdate.c@1.106 +1 -1 + [Bug 3666] avoid unlimited receive buffer allocation + - get_free_recv_buffer() API change + + ports/winnt/libntp/messages.h@1.3 +1 -1 + [Bug 3666] avoid unlimited receive buffer allocation + - (sidekick) regenerated + + ports/winnt/ntpd/ntp_iocompletionport.c@1.81 +63 -38 + [Bug 3666] avoid unlimited receive buffer allocation + - reuse last buffer ASAP if no new buffer available + - typos and some internal renaming + + tests/libntp/recvbuff.c@1.8 +2 -2 + [Bug 3666] avoid unlimited receive buffer allocation + - internal API changes + +ChangeSet@1.3896.1.9, 2020-05-05 03:53:50+00:00, stenn@psp-deb1.ntp.org + Update NEWS with 3639 + + NEWS@1.205.1.2 +3 -1 + Update NEWS with 3639 + +ChangeSet@1.3896.1.7, 2020-04-20 08:14:39+00:00, stenn@psp-deb1.ntp.org + NEWS and bug 3664 + + NEWS@1.205.1.1 +2 -1 + NEWS and bug 3664 + +ChangeSet@1.3896.7.1, 2020-04-16 17:50:44+02:00, burnicki@psp-deb1.ntp.org + Enable openSSL CMAC support on Windows. + + ChangeLog@1.1974.7.1 +2 -0 + Enable openSSL CMAC support on Windows. + + ports/winnt/include/config.h@1.116 +2 -0 + Enable openSSL CMAC support on Windows. + +ChangeSet@1.3899, 2020-04-11 09:59:23+00:00, stenn@psp-deb1.ntp.org + update + + NEWS@1.206 +1 -0 + update + +ChangeSet@1.3896.1.5, 2020-04-11 09:35:19+00:00, stenn@psp-deb1.ntp.org + update + + NEWS@1.205 +2 -2 + update + +ChangeSet@1.3896.1.3, 2020-04-11 08:10:59+00:00, stenn@psp-deb1.ntp.org + update + + NEWS@1.204 +3 -1 + update + +ChangeSet@1.3896.2.3, 2020-04-11 07:21:36+00:00, stenn@psp-deb1.ntp.org + update + + NEWS@1.203 +1 -0 + update + +ChangeSet@1.3896.3.3, 2020-04-11 07:12:47+00:00, stenn@psp-deb1.ntp.org + update + + NEWS@1.202 +22 -0 + update + +ChangeSet@1.3896.6.4, 2020-04-07 17:51:25+02:00, burnicki@psp-deb1.ntp.org + [Bug 3662] Fix build errors on Windows with VS2008. + + ChangeLog@1.1974.6.1 +2 -0 + [Bug 3662] Fix build errors on Windows with VS2008. + +ChangeSet@1.3896.6.3, 2020-04-07 17:49:08+02:00, burnicki@psp-deb1.ntp.org + Fix unused variable warning in ntpdate.c. + + ntpdate/ntpdate.c@1.105 +2 -1 + Fix unused variable warning. + +ChangeSet@1.3896.6.2, 2020-04-07 17:48:25+02:00, burnicki@psp-deb1.ntp.org + Fix compiling refclock_palisade.c + Don't have variable declarations after code. + + ntpd/refclock_palisade.c@1.49 +25 -23 + Don't have variable declarations after code. + +ChangeSet@1.3896.6.1, 2020-04-07 17:47:02+02:00, burnicki@psp-deb1.ntp.org + Fix prototype in ntpd/refclock_nmea.c + + ntpd/refclock_nmea.c@1.85 +1 -1 + Fix prototype in ntpd/refclock_nmea.c + +ChangeSet@1.3896.5.1, 2020-04-05 10:10:12+02:00, perlinger@ntp.org + [Bug 3646] Avoid sync with unsync orphan + + ChangeLog@1.1974.5.1 +4 -0 + [Bug 3646] Avoid sync with unsync orphan + + ntpd/ntp_proto.c@1.432.1.1 +21 -0 + [Bug 3646] Avoid sync with unsync orphan + +ChangeSet@1.3896.4.1, 2020-04-05 09:53:25+02:00, perlinger@ntp.org + [Bug 3653] Refclock jitter RMS calculation + + ChangeLog@1.1974.4.1 +4 -0 + [Bug 3653] Refclock jitter RMS calculation + + ntpd/ntp_refclock.c@1.132 +36 -36 + [Bug 3653] Refclock jitter RMS calculation + +ChangeSet@1.3896.3.1, 2020-04-04 08:57:51+02:00, perlinger@ntp.org + [Bug 3655] ntpdc memstats hash counts + + ChangeLog@1.1974.3.1 +4 -0 + [Bug 3655] ntpdc memstats hash counts + + ntpd/ntp_request.c@1.132 +1 -1 + [Bug 3655] ntpdc memstats hash counts + +ChangeSet@1.3896.2.1, 2020-04-04 08:48:51+02:00, perlinger@ntp.org + [Bug 3657] Wrong "Autokey group mismatch" debug message + + ChangeLog@1.1974.2.1 +3 -0 + [Bug 3657] Wrong "Autokey group mismatch" debug message + + ntpd/ntp_proto.c@1.433 +3 -2 + [Bug 3657] Wrong "Autokey group mismatch" debug message + +ChangeSet@1.3896.1.1, 2020-04-04 08:38:06+02:00, perlinger@ntp.org + [Bug 3659] ntp-4.2.8p14 fails to build + + ChangeLog@1.1974.1.1 +3 -0 + [Bug 3659] ntp-4.2.8p14 fails to build + + include/ntp_config.h@1.90 +0 -10 + [Bug 3659] ntp-4.2.8p14 fails to build + - move global declaration of 'psl' from header to static declaration in code + + ntpd/ntp_config.c@1.376 +10 -0 + [Bug 3659] ntp-4.2.8p14 fails to build + - move global declaration of 'psl' from header to static declaration in code + +ChangeSet@1.3897, 2020-04-01 16:49:43+02:00, perlinger@ntp.org + [Bug 3661] memory leak with AES128CMAC keys + + ChangeLog@1.1975 +3 -0 + [Bug 3661] memory leak with AES128CMAC keys + + libntp/a_md5encrypt.c@1.52 +1 -1 + [Bug 3661] memory leak with AES128CMAC keys + - free context, not just cleaning up internally + + sntp/crypto.c@1.40 +2 -1 + [Bug 3661] memory leak with AES128CMAC keys + - free context, not just cleaning up internally + ChangeSet@1.3896, 2020-03-03 17:42:43-08:00, ntpreleng@ntp-build.tal1.ntfo.org NTP_4_2_8P14 TAG: NTP_4_2_8P14 @@ -675,7 +1372,7 @@ ChangeSet@1.3892, 2020-03-03 16:05:38-08:00, ntpreleng@ntp-build.tal1.ntfo.org ntpd/ntp_config.c@1.374 +2 -2 provide get_pollskew() for simulator -ChangeSet@1.3844.24.1, 2020-03-03 03:30:13-08:00, ntpreleng@ntp-build.tal1.ntfo.org +ChangeSet@1.3844.25.1, 2020-03-03 03:30:13-08:00, ntpreleng@ntp-build.tal1.ntfo.org NTP_4_2_8P13 TAG: NTP_4_2_8P13 (currently on 1.3894) @@ -933,7 +1630,7 @@ ChangeSet@1.3880, 2020-02-17 08:48:45+00:00, stenn@psp-deb1.ntp.org ChangeSet@1.3879, 2020-02-17 08:11:42+00:00, stenn@psp-deb1.ntp.org updates - ChangeLog@1.1968.34.1 +2 -0 + ChangeLog@1.1968.35.1 +2 -0 ChangeSet@1.3877.1.2, 2020-02-08 23:00:11+00:00, stenn@psp-deb1.ntp.org html/confopt.html cleanup @@ -1289,6 +1986,22 @@ ChangeSet@1.3878, 2020-01-29 06:03:13+00:00, stenn@psp-deb1.ntp.org ntpd/ntp_proto.c@1.427.1.1 +8 -0 Initial pass at fixes for bug 3596 +ChangeSet@1.3844.24.1, 2020-01-21 12:49:14+00:00, abe@psp-deb1.ntp.org + driver40.html, refclock_jjy.c, driver40-ja.html, ChangeLog: + refclock_jjy: TS-JJY0x can skip time sync depending on the STUS reply. + + ChangeLog@1.1968.34.1 +3 -0 + refclock_jjy: TS-JJY0x can skip time sync depending on the STUS reply. + + html/drivers/driver40-ja.html@1.8 +10 -2 + refclock_jjy: TS-JJY0x can skip time sync depending on the STUS reply. + + html/drivers/driver40.html@1.23 +9 -2 + refclock_jjy: TS-JJY0x can skip time sync depending on the STUS reply. + + ntpd/refclock_jjy.c@1.37 +76 -32 + refclock_jjy: TS-JJY0x can skip time sync depending on the STUS reply. + ChangeSet@1.3873.4.2, 2020-01-18 04:46:30-05:00, stenn@psp-deb2.ntp.org [Bug 3637] Emit the version of ntpd in saveconfig diff --git a/contrib/ntp/NEWS b/contrib/ntp/NEWS index e1ed0005661..caf9ea664df 100644 --- a/contrib/ntp/NEWS +++ b/contrib/ntp/NEWS @@ -1,3 +1,41 @@ +--- +NTP 4.2.8p15 (Harlan Stenn , 2020 Jun 23) + +Focus: Security, Bug fixes + +Severity: MEDIUM + +This release fixes one vulnerability: Associations that use CMAC +authentication between ntpd from versions 4.2.8p11/4.3.97 and +4.2.8p14/4.3.100 will leak a small amount of memory for each packet. +Eventually, ntpd will run out of memory and abort. + +It also fixes 13 other bugs. + +* [Sec 3661] memory leak with AES128CMAC keys +* [Bug 3670] Regression from bad merger between 3592 and 3596 + - Thanks to Sylar Tao +* [Bug 3667] decodenetnum fails with numeric port + - rewrite 'decodenetnum()' in terms of inet_pton +* [Bug 3666] avoid unlimited receive buffer allocation + - limit number of receive buffers, with an iron reserve for refclocks +* [Bug 3664] Enable openSSL CMAC support on Windows +* [Bug 3662] Fix build errors on Windows with VS2008 +* [Bug 3660] Manycast orphan mode startup discovery problem. + - integrated patch from Charles Claggett +* [Bug 3659] Move definition of psl[] from ntp_config.h to + ntp_config.h +* [Bug 3657] Wrong "Autokey group mismatch" debug message +* [Bug 3655] ntpdc memstats hash counts + - fix by Gerry garvey +* [Bug 3653] Refclock jitter RMS calculation + - thanks to Gerry Garvey +* [Bug 3646] Avoid sync with unsync orphan + - patch by Gerry Garvey +* [Bug 3644] Unsynchronized server [...] selected as candidate +* [Bug 3639] refclock_jjy: TS-JJY0x can skip time sync depending on the STUS reply. + - applied patch by Takao Abe + --- NTP 4.2.8p14 (Harlan Stenn , 2020 Mar 03) diff --git a/contrib/ntp/config.h.in b/contrib/ntp/config.h.in index 12e0d1380a4..4fa8c318837 100644 --- a/contrib/ntp/config.h.in +++ b/contrib/ntp/config.h.in @@ -583,6 +583,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MD5_H +/* Define to 1 if you have the `memchr' function. */ +#undef HAVE_MEMCHR + /* Define to 1 if you have the `memlk' function. */ #undef HAVE_MEMLK @@ -895,6 +898,9 @@ /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY +/* Define to 1 if you have the `strnlen' function. */ +#undef HAVE_STRNLEN + /* Define to 1 if you have the header file. */ #undef HAVE_STROPTS_H diff --git a/contrib/ntp/configure b/contrib/ntp/configure index 9f4e925535c..71b0d0c2916 100755 --- a/contrib/ntp/configure +++ b/contrib/ntp/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for ntp 4.2.8p14. +# Generated by GNU Autoconf 2.69 for ntp 4.2.8p15. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='ntp' PACKAGE_TARNAME='ntp' -PACKAGE_VERSION='4.2.8p14' -PACKAGE_STRING='ntp 4.2.8p14' +PACKAGE_VERSION='4.2.8p15' +PACKAGE_STRING='ntp 4.2.8p15' PACKAGE_BUGREPORT='http://bugs.ntp.org./' PACKAGE_URL='http://www.ntp.org./' @@ -1617,7 +1617,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ntp 4.2.8p14 to adapt to many kinds of systems. +\`configure' configures ntp 4.2.8p15 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1687,7 +1687,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntp 4.2.8p14:";; + short | recursive ) echo "Configuration of ntp 4.2.8p15:";; esac cat <<\_ACEOF @@ -1930,7 +1930,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ntp configure 4.2.8p14 +ntp configure 4.2.8p15 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2639,7 +2639,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ntp $as_me 4.2.8p14, which was +It was created by ntp $as_me 4.2.8p15, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3640,7 +3640,7 @@ fi # Define the identity of the package. PACKAGE='ntp' - VERSION='4.2.8p14' + VERSION='4.2.8p15' cat >>confdefs.h <<_ACEOF @@ -27308,7 +27308,7 @@ _ACEOF fi done -for ac_func in strdup strerror setrlimit strchr +for ac_func in strdup strnlen memchr strerror setrlimit strchr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -34174,7 +34174,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ntp $as_me 4.2.8p14, which was +This file was extended by ntp $as_me 4.2.8p15, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -34241,7 +34241,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -ntp config.status 4.2.8p14 +ntp config.status 4.2.8p15 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/contrib/ntp/configure.ac b/contrib/ntp/configure.ac index a0072eeb5be..5dc6aee02ed 100644 --- a/contrib/ntp/configure.ac +++ b/contrib/ntp/configure.ac @@ -912,7 +912,7 @@ case "$host" in ;; esac AC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf]) -AC_CHECK_FUNCS([strdup strerror setrlimit strchr]) +AC_CHECK_FUNCS([strdup strnlen memchr strerror setrlimit strchr]) case "$host" in *-*-aix[[4-9]]*) # XXX only verified thru AIX6. diff --git a/contrib/ntp/html/drivers/driver40-ja.html b/contrib/ntp/html/drivers/driver40-ja.html index 99ca4827dfa..8b24fdc9b1c 100644 --- a/contrib/ntp/html/drivers/driver40-ja.html +++ b/contrib/ntp/html/drivers/driver40-ja.html @@ -52,15 +52,22 @@
server   127.127.40.X   mode 1

-
fudge   127.127.40.X   time1 0.NNN   flag1 0|1
+
fudge   127.127.40.X   time1 0.NNN   flag1 0|1   flag2 0|1   time2 H

Time1 は、受信機からの時刻に加算する調整時間を、固定小数点形式の秒で設定します。
この受信機には、数10ミリ秒 ( 0.0NN秒 ) から百数10ミリ秒 ( 0.1NN秒 ) の調整時間を設定すると良いでしょう。

-

Flag1 は、時刻同期には無関係です。Flag1 を 1 に設定すると、状態を問い合わせるコマンドを DATE コマンドと STIM コマンドの前に発行して、応答を clockstats ファイルに記録します。

+

Time2 は、STUSコマンドの応答が adjusted ではなくなってからの猶予時間を時単位で指定します。
+ この猶予時間は、flag1 と flag2 を共に 1 に設定したときに有効です。

+

Flag1 は、flag2 を 1 に設定しない限り、時刻同期には無関係です。Flag1 を 1 に設定すると、状態を問い合わせるコマンドを DATE コマンドと STIM コマンドの前に発行して、応答を clockstats ファイルに記録します。

0 (Default)DCST と STUS コマンドは、発行しません。
1DCST と STUS コマンドを、発行します。
+

Flag2 は STUSコマンドの応答が adjusted の時だけ、時刻同期処理を行う指定です。この機能を使うときは、flag1 も同時に 1 に設定する必要があります。

+ + + +
0 (Default)常に、時刻同期処理
1adjusted の時だ、け時刻同期委処理

@@ -194,6 +201,7 @@
  • シチズンTIC   JJY-200   http://www.tic-citizen.co.jp/ (日本語)


    +

    JJY-200 は、2013年に販売終了となりました。


    NTPの設定 ( ntp.conf )

    diff --git a/contrib/ntp/html/drivers/driver40.html b/contrib/ntp/html/drivers/driver40.html index 827aeff4ea1..24ced93c3a7 100644 --- a/contrib/ntp/html/drivers/driver40.html +++ b/contrib/ntp/html/drivers/driver40.html @@ -52,14 +52,20 @@
    server   127.127.40.X   mode 1

    -
    fudge   127.127.40.X   time1 0.NNN   flag1 0|1
    +
    fudge   127.127.40.X   time1 0.NNN   flag1 0|1   flag2 0|1   time2 H

    Time1 may specify a constant to be added to the time offset for the time from the receiver, a fixed-point decimal number in seconds. You may specify the time offset from several tens of milli-seconds ( 0.0NN seconds ) to a hundred and several tens of milli-seconds ( 0.1NN seconds ) for this clock.

    -

    Flag1 has no effect for time synchronization. When flag1 is set to 1, status commands are issued before DATE and STIM commands, and write a response text into the clockstats file.

    +

    Time2 may specify a grace period in hours after the 'adjusted' reply of the STUS command stopped coming.
    This hours is effective when both flag1 and flag2 are set to 1.

    +

    Flag1 has no effect for time synchronization unless flag2 is set to 1.
    When flag1 is set to 1, status commands are issued before DATE and STIM commands, and write a response text into the clockstats file.

    0 (Default)DCST and STUS commands are not issued
    1DCST and STUS commands are issued
    +

    Flag2 enables the time synchronization only when the reply of the STUS is 'adjusted'. When this functionality is used, flag1 must be set to 1 together.

    + + + +
    0 (Default)Always
    1'adjusted' only

    @@ -193,6 +199,7 @@
  • CITIZEN T.I.C. CO.,LTD.   JJY-200   http://www.tic-citizen.co.jp/ (Japanese only)


    +

    The JJY-200 became the end of sales in 2013.


    NTP configuration ( ntp.conf )

    diff --git a/contrib/ntp/include/l_stdlib.h b/contrib/ntp/include/l_stdlib.h index 073ea464123..fbf57c53aa9 100644 --- a/contrib/ntp/include/l_stdlib.h +++ b/contrib/ntp/include/l_stdlib.h @@ -221,4 +221,13 @@ extern int errno; extern int h_errno; #endif +#ifndef HAVE_MEMCHR +extern void *memchr(const void *s, int c, size_t n); +#endif + +#ifndef HAVE_STRNLEN +extern size_t strnlen(const char *s, size_t n); +#endif + + #endif /* L_STDLIB_H */ diff --git a/contrib/ntp/include/ntp.h b/contrib/ntp/include/ntp.h index 97f0d5f9e2d..8e0ea2b202a 100644 --- a/contrib/ntp/include/ntp.h +++ b/contrib/ntp/include/ntp.h @@ -128,7 +128,7 @@ typedef char s_char; #define MAX_TTL 8 /* max ttl mapping vector size */ #define BEACON 7200 /* manycast beacon interval */ #define NTP_MAXEXTEN 2048 /* max extension field size */ -#define NTP_ORPHWAIT 300 /* orphan wair (s) */ +#define NTP_ORPHWAIT 300 /* orphan wait (s) */ /* * Miscellaneous stuff diff --git a/contrib/ntp/include/ntp_config.h b/contrib/ntp/include/ntp_config.h index 6bb738bbeef..53546df8d6c 100644 --- a/contrib/ntp/include/ntp_config.h +++ b/contrib/ntp/include/ntp_config.h @@ -276,16 +276,6 @@ typedef struct settrap_parms_tag { } settrap_parms; -/* - * Poll Skew List - */ - -extern psl_item psl[17-3+1]; /* values for polls 3-17 */ - /* To simplify the runtime code we */ - /* don't want to have to special-case */ - /* dealing with a default */ - - /* ** Data Minimization Items */ diff --git a/contrib/ntp/include/recvbuff.h b/contrib/ntp/include/recvbuff.h index 42597153eea..2a4c84c5afc 100644 --- a/contrib/ntp/include/recvbuff.h +++ b/contrib/ntp/include/recvbuff.h @@ -10,10 +10,26 @@ /* * recvbuf memory management */ -#define RECV_INIT 10 /* 10 buffers initially */ +#define RECV_INIT 64 /* 64 buffers initially */ #define RECV_LOWAT 3 /* when we're down to three buffers get more */ -#define RECV_INC 5 /* get 5 more at a time */ -#define RECV_TOOMANY 40 /* this is way too many buffers */ +#define RECV_INC 32 /* [power of 2] get 32 more at a time */ +#define RECV_BATCH 128 /* [power of 2] max increment in one sweep */ +#define RECV_TOOMANY 4096 /* this should suffice, really. TODO: tos option? */ + +/* If we have clocks, keep an iron reserve of receive buffers for + * clocks only. + */ +#if defined(REFCLOCK) +# if !defined(RECV_CLOCK) || RECV_CLOCK == 0 +# undef RECV_CLOCK +# define RECV_CLOCK 16 +# endif +#else +# if defined(RECV_CLOCK) +# undef RECV_CLOCK +# endif +# define RECV_CLOCK 0 +#endif #if defined HAVE_IO_COMPLETION_PORT # include "ntp_iocompletionport.h" @@ -90,10 +106,10 @@ extern void freerecvbuf(struct recvbuf *); * you put it back with freerecvbuf() or */ -/* signal safe - no malloc */ -extern struct recvbuf *get_free_recv_buffer(void); -/* signal unsafe - may malloc, never returs NULL */ -extern struct recvbuf *get_free_recv_buffer_alloc(void); +/* signal safe - no malloc, returns NULL when no bufs */ +extern struct recvbuf *get_free_recv_buffer(int /*BOOL*/ urgent); +/* signal unsafe - may malloc, returns NULL when no bufs */ +extern struct recvbuf *get_free_recv_buffer_alloc(int /*BOOL*/ urgent); /* Add a buffer to the full list */ diff --git a/contrib/ntp/lib/isc/win32/include/isc/int.h b/contrib/ntp/lib/isc/win32/include/isc/int.h index 2ee8bf96a3f..edcf59dd3ad 100644 --- a/contrib/ntp/lib/isc/win32/include/isc/int.h +++ b/contrib/ntp/lib/isc/win32/include/isc/int.h @@ -20,7 +20,9 @@ #ifndef ISC_INT_H #define ISC_INT_H 1 -#define _INTEGRAL_MAX_BITS 64 +#ifndef _INTEGRAL_MAX_BITS +# define _INTEGRAL_MAX_BITS 64 +#endif #include typedef __int8 isc_int8_t; diff --git a/contrib/ntp/libntp/a_md5encrypt.c b/contrib/ntp/libntp/a_md5encrypt.c index 8c046f4e93c..57100de3a86 100644 --- a/contrib/ntp/libntp/a_md5encrypt.c +++ b/contrib/ntp/libntp/a_md5encrypt.c @@ -93,7 +93,7 @@ make_mac( } cmac_fail: if (ctx) - CMAC_CTX_cleanup(ctx); + CMAC_CTX_free(ctx); } else # endif /*ENABLE_CMAC*/ diff --git a/contrib/ntp/libntp/decodenetnum.c b/contrib/ntp/libntp/decodenetnum.c index 35e839aafb0..8ff67625202 100644 --- a/contrib/ntp/libntp/decodenetnum.c +++ b/contrib/ntp/libntp/decodenetnum.c @@ -13,106 +13,152 @@ #include "ntp.h" #include "ntp_stdlib.h" -#include "ntp_assert.h" -#define PORTSTR(x) _PORTSTR(x) -#define _PORTSTR(x) #x -static int -isnumstr( - const char *s +/* If the given string position points to a decimal digit, parse the + * number. If this is not possible, or the parsing did not consume the + * whole string, or if the result exceeds the maximum value, return the + * default value. + */ +static unsigned long +_num_or_dflt( + char * sval, + unsigned long maxval, + unsigned long defval ) { - while (*s >= '0' && *s <= '9') - ++s; - return !*s; + char * ep; + unsigned long num; + + if (!(sval && isdigit(*(unsigned char*)sval))) + return defval; + + num = strtoul(sval, &ep, 10); + if (!*ep && num <= maxval) + return num; + + return defval; +} + +/* If the given string position is not NULL and does not point to the + * terminator, replace the character with NUL and advance the pointer. + * Return the resulting position. + */ +static inline char* +_chop( + char * sp) +{ + if (sp && *sp) + *sp++ = '\0'; + return sp; +} + +/* If the given string position points to the given char, advance the + * pointer and return the result. Otherwise, return NULL. + */ +static inline char* +_skip( + char * sp, + int ch) +{ + if (sp && *(unsigned char*)sp == ch) + return (sp + 1); + return NULL; } /* * decodenetnum convert text IP address and port to sockaddr_u * - * Returns 0 for failure, 1 for success. + * Returns FALSE (->0) for failure, TRUE (->1) for success. */ int decodenetnum( const char *num, - sockaddr_u *netnum + sockaddr_u *net ) { - static const char * const servicename = "ntp"; - static const char * const serviceport = PORTSTR(NTP_PORT); + /* Building a parser is more fun in Haskell, but here we go... + * + * This works through 'inet_pton()' taking the brunt of the + * work, after some string manipulations to split off URI + * brackets, ports and scope identifiers. The heuristics are + * simple but must hold for all _VALID_ addresses. inet_pton() + * will croak on bad ones later, but replicating the whole + * parser logic to detect errors is wasteful. + */ - struct addrinfo hints, *ai = NULL; - int err; - const char *host_str; - const char *port_str; - char *pp; - char *np; - char nbuf[80]; - - REQUIRE(num != NULL); - - if (strlen(num) >= sizeof(nbuf)) { - printf("length error\n"); + sockaddr_u netnum; + char buf[64]; /* working copy of input */ + char *haddr=buf; + unsigned int port=NTP_PORT, scope=0; + unsigned short afam=AF_UNSPEC; + + /* copy input to working buffer with length check */ + if (strlcpy(buf, num, sizeof(buf)) >= sizeof(buf)) return FALSE; - } - port_str = servicename; - if ('[' != num[0]) { - /* - * to distinguish IPv6 embedded colons from a port - * specification on an IPv4 address, assume all - * legal IPv6 addresses have at least two colons. - */ - pp = strchr(num, ':'); - if (NULL == pp) - host_str = num; /* no colons */ - else if (NULL != strchr(pp + 1, ':')) - host_str = num; /* two or more colons */ - else { /* one colon */ - strlcpy(nbuf, num, sizeof(nbuf)); - host_str = nbuf; - pp = strchr(nbuf, ':'); - *pp = '\0'; - port_str = pp + 1; + /* Identify address family and possibly the port, if given. If + * this results in AF_UNSPEC, we will fail in the next step. + */ + if (*haddr == '[') { + char * endp = strchr(++haddr, ']'); + if (endp) { + port = _num_or_dflt(_skip(_chop(endp), ':'), + 0xFFFFu, port); + afam = strchr(haddr, ':') ? AF_INET6 : AF_INET; } } else { - host_str = np = nbuf; - while (*++num && ']' != *num) - *np++ = *num; - *np = 0; - if (']' == num[0] && ':' == num[1] && '\0' != num[2]) - port_str = &num[2]; + char *col = strchr(haddr, ':'); + char *dot = strchr(haddr, '.'); + if (col == dot) { + /* no dot, no colon: bad! */ + afam = AF_UNSPEC; + } else if (!col) { + /* no colon, only dot: IPv4! */ + afam = AF_INET; + } else if (!dot || col < dot) { + /* no dot or 1st colon before 1st dot: IPv6! */ + afam = AF_INET6; + } else { + /* 1st dot before 1st colon: must be IPv4 with port */ + afam = AF_INET; + port = _num_or_dflt(_chop(col), 0xFFFFu, port); + } } - if ( ! *host_str) + + /* Since we don't know about additional members in the address + * structures, we wipe the result buffer thoroughly: + */ + memset(&netnum, 0, sizeof(netnum)); + + /* For AF_INET6, evaluate and remove any scope suffix. Have + * inet_pton() do the real work for AF_INET and AF_INET6, bail + * out otherwise: + */ + switch (afam) { + case AF_INET: + if (inet_pton(afam, haddr, &netnum.sa4.sin_addr) <= 0) + return FALSE; + netnum.sa4.sin_port = htons((unsigned short)port); + break; + + case AF_INET6: + scope = _num_or_dflt(_chop(strchr(haddr, '%')), 0xFFFFFFFFu, scope); + if (inet_pton(afam, haddr, &netnum.sa6.sin6_addr) <= 0) + return FALSE; + netnum.sa6.sin6_port = htons((unsigned short)port); + netnum.sa6.sin6_scope_id = scope; + break; + + case AF_UNSPEC: + default: return FALSE; - if ( ! *port_str) - port_str = servicename; - - ZERO(hints); - hints.ai_flags |= Z_AI_NUMERICHOST; - if (isnumstr(port_str)) - hints.ai_flags |= Z_AI_NUMERICSERV; - err = getaddrinfo(host_str, port_str, &hints, &ai); - /* retry with default service name if the service lookup failed */ - if (err == EAI_SERVICE && strcmp(port_str, servicename)) { - hints.ai_flags &= ~Z_AI_NUMERICSERV; - port_str = servicename; - err = getaddrinfo(host_str, port_str, &hints, &ai); } - /* retry another time with default service port if the service lookup failed */ - if (err == EAI_SERVICE && strcmp(port_str, serviceport)) { - hints.ai_flags |= Z_AI_NUMERICSERV; - port_str = serviceport; - err = getaddrinfo(host_str, port_str, &hints, &ai); - } - if (err != 0) - return FALSE; - - INSIST(ai->ai_addrlen <= sizeof(*netnum)); - ZERO(*netnum); - memcpy(netnum, ai->ai_addr, ai->ai_addrlen); - freeaddrinfo(ai); + /* Collect the remaining pieces and feed the output, which was + * not touched so far: + */ + netnum.sa.sa_family = afam; + memcpy(net, &netnum, sizeof(netnum)); return TRUE; } diff --git a/contrib/ntp/libntp/recvbuff.c b/contrib/ntp/libntp/recvbuff.c index 573fdb2f920..5855ec2147a 100644 --- a/contrib/ntp/libntp/recvbuff.c +++ b/contrib/ntp/libntp/recvbuff.c @@ -11,6 +11,15 @@ #include "recvbuff.h" #include "iosignal.h" +#if (RECV_INC & (RECV_INC-1)) +# error RECV_INC not a power of 2! +#endif +#if (RECV_BATCH & (RECV_BATCH - 1)) +#error RECV_BATCH not a power of 2! +#endif +#if (RECV_BATCH < RECV_INC) +#error RECV_BATCH must be >= RECV_INC! +#endif /* * Memory allocation @@ -21,6 +30,8 @@ static u_long volatile total_recvbufs; /* total recvbufs currently in use */ static u_long volatile lowater_adds; /* number of times we have added memory */ static u_long volatile buffer_shortfall;/* number of missed free receive buffers between replenishments */ +static u_long limit_recvbufs; /* maximum total of receive buffers */ +static u_long emerg_recvbufs; /* emergency/urgent buffers to keep */ static DECL_FIFO_ANCHOR(recvbuf_t) full_recv_fifo; static recvbuf_t * free_recv_list; @@ -33,11 +44,16 @@ static recvbuf_t * free_recv_list; * short a time as possible */ static CRITICAL_SECTION RecvLock; -# define LOCK() EnterCriticalSection(&RecvLock) -# define UNLOCK() LeaveCriticalSection(&RecvLock) +static CRITICAL_SECTION FreeLock; +# define LOCK_R() EnterCriticalSection(&RecvLock) +# define UNLOCK_R() LeaveCriticalSection(&RecvLock) +# define LOCK_F() EnterCriticalSection(&FreeLock) +# define UNLOCK_F() LeaveCriticalSection(&FreeLock) #else -# define LOCK() do {} while (FALSE) -# define UNLOCK() do {} while (FALSE) +# define LOCK_R() do {} while (FALSE) +# define UNLOCK_R() do {} while (FALSE) +# define LOCK_F() do {} while (FALSE) +# define UNLOCK_F() do {} while (FALSE) #endif #ifdef DEBUG @@ -76,33 +92,52 @@ initialise_buffer(recvbuf_t *buff) } static void -create_buffers(int nbufs) +create_buffers( + size_t nbufs) { +# ifndef DEBUG + static const u_int chunk = RECV_INC; +# else + /* Allocate each buffer individually so they can be free()d + * during ntpd shutdown on DEBUG builds to keep them out of heap + * leak reports. + */ + static const u_int chunk = 1; +# endif + register recvbuf_t *bufp; - int i, abuf; + u_int i; + size_t abuf; + if (limit_recvbufs <= total_recvbufs) + return; + abuf = nbufs + buffer_shortfall; buffer_shortfall = 0; -#ifndef DEBUG - bufp = eallocarray(abuf, sizeof(*bufp)); -#endif - - for (i = 0; i < abuf; i++) { -#ifdef DEBUG - /* - * Allocate each buffer individually so they can be - * free()d during ntpd shutdown on DEBUG builds to - * keep them out of heap leak reports. - */ - bufp = emalloc_zero(sizeof(*bufp)); -#endif - LINK_SLIST(free_recv_list, bufp, link); - bufp++; - free_recvbufs++; - total_recvbufs++; + if (abuf < nbufs || abuf > RECV_BATCH) + abuf = RECV_BATCH; /* clamp on overflow */ + else + abuf += (~abuf + 1) & (RECV_INC - 1); /* round up */ + + if (abuf > (limit_recvbufs - total_recvbufs)) + abuf = limit_recvbufs - total_recvbufs; + abuf += (~abuf + 1) & (chunk - 1); /* round up */ + + while (abuf) { + bufp = calloc(chunk, sizeof(*bufp)); + if (!bufp) { + limit_recvbufs = total_recvbufs; + break; + } + for (i = chunk; i; --i,++bufp) { + LINK_SLIST(free_recv_list, bufp, link); + } + free_recvbufs += chunk; + total_recvbufs += chunk; + abuf -= chunk; } - lowater_adds++; + ++lowater_adds; } void @@ -115,15 +150,19 @@ init_recvbuff(int nbufs) free_recvbufs = total_recvbufs = 0; full_recvbufs = lowater_adds = 0; + limit_recvbufs = RECV_TOOMANY; + emerg_recvbufs = RECV_CLOCK; + create_buffers(nbufs); -#if defined(SYS_WINNT) +# if defined(SYS_WINNT) InitializeCriticalSection(&RecvLock); -#endif + InitializeCriticalSection(&FreeLock); +# endif -#ifdef DEBUG +# ifdef DEBUG atexit(&uninit_recvbuff); -#endif +# endif } @@ -146,6 +185,10 @@ uninit_recvbuff(void) break; free(rbunlinked); } +# if defined(SYS_WINNT) + DeleteCriticalSection(&FreeLock); + DeleteCriticalSection(&RecvLock); +# endif } #endif /* DEBUG */ @@ -157,13 +200,14 @@ void freerecvbuf(recvbuf_t *rb) { if (rb) { - LOCK(); - rb->used--; - if (rb->used != 0) + if (--rb->used != 0) { msyslog(LOG_ERR, "******** freerecvbuff non-zero usage: %d *******", rb->used); + rb->used = 0; + } + LOCK_F(); LINK_SLIST(free_recv_list, rb, link); - free_recvbufs++; - UNLOCK(); + ++free_recvbufs; + UNLOCK_F(); } } @@ -175,28 +219,34 @@ add_full_recv_buffer(recvbuf_t *rb) msyslog(LOG_ERR, "add_full_recv_buffer received NULL buffer"); return; } - LOCK(); + LOCK_R(); LINK_FIFO(full_recv_fifo, rb, link); - full_recvbufs++; - UNLOCK(); + ++full_recvbufs; + UNLOCK_R(); } recvbuf_t * -get_free_recv_buffer(void) +get_free_recv_buffer( + int /*BOOL*/ urgent + ) { - recvbuf_t *buffer; + recvbuf_t *buffer = NULL; - LOCK(); - UNLINK_HEAD_SLIST(buffer, free_recv_list, link); + LOCK_F(); + if (free_recvbufs > (urgent ? emerg_recvbufs : 0)) { + UNLINK_HEAD_SLIST(buffer, free_recv_list, link); + } + if (buffer != NULL) { - free_recvbufs--; + if (free_recvbufs) + --free_recvbufs; initialise_buffer(buffer); - buffer->used++; + ++buffer->used; } else { - buffer_shortfall++; + ++buffer_shortfall; } - UNLOCK(); + UNLOCK_F(); return buffer; } @@ -204,17 +254,15 @@ get_free_recv_buffer(void) #ifdef HAVE_IO_COMPLETION_PORT recvbuf_t * -get_free_recv_buffer_alloc(void) +get_free_recv_buffer_alloc( + int /*BOOL*/ urgent + ) { - recvbuf_t *buffer; - - buffer = get_free_recv_buffer(); - if (NULL == buffer) { + LOCK_F(); + if (free_recvbufs <= emerg_recvbufs || buffer_shortfall > 0) create_buffers(RECV_INC); - buffer = get_free_recv_buffer(); - } - ENSURE(buffer != NULL); - return (buffer); + UNLOCK_F(); + return get_free_recv_buffer(urgent); } #endif @@ -224,30 +272,26 @@ get_full_recv_buffer(void) { recvbuf_t * rbuf; - LOCK(); - /* - * make sure there are free buffers when we - * wander off to do lengthy packet processing with - * any buffer we grab from the full list. + * make sure there are free buffers when we wander off to do + * lengthy packet processing with any buffer we grab from the + * full list. * - * fixes malloc() interrupted by SIGIO risk - * (Bug 889) + * fixes malloc() interrupted by SIGIO risk (Bug 889) */ - if (NULL == free_recv_list || buffer_shortfall > 0) { - /* - * try to get us some more buffers - */ + LOCK_F(); + if (free_recvbufs <= emerg_recvbufs || buffer_shortfall > 0) create_buffers(RECV_INC); - } + UNLOCK_F(); /* * try to grab a full buffer */ + LOCK_R(); UNLINK_FIFO(rbuf, full_recv_fifo, link); - if (rbuf != NULL) - full_recvbufs--; - UNLOCK(); + if (rbuf != NULL && full_recvbufs) + --full_recvbufs; + UNLOCK_R(); return rbuf; } @@ -265,12 +309,18 @@ purge_recv_buffers_for_fd( recvbuf_t *rbufp; recvbuf_t *next; recvbuf_t *punlinked; + recvbuf_t *freelist = NULL; - LOCK(); + /* We want to hold only one lock at a time. So we do a scan on + * the full buffer queue, collecting items as we go, and when + * done we spool the the collected items to 'freerecvbuf()'. + */ + LOCK_R(); for (rbufp = HEAD_FIFO(full_recv_fifo); rbufp != NULL; - rbufp = next) { + rbufp = next) + { next = rbufp->link; # ifdef HAVE_IO_COMPLETION_PORT if (rbufp->dstadr == NULL && rbufp->fd == fd) @@ -281,12 +331,20 @@ purge_recv_buffers_for_fd( UNLINK_MID_FIFO(punlinked, full_recv_fifo, rbufp, link, recvbuf_t); INSIST(punlinked == rbufp); - full_recvbufs--; - freerecvbuf(rbufp); + if (full_recvbufs) + --full_recvbufs; + rbufp->link = freelist; + freelist = rbufp; } } - UNLOCK(); + UNLOCK_R(); + + while (freelist) { + next = freelist->link; + freerecvbuf(freelist); + freelist = next; + } } diff --git a/contrib/ntp/libntp/strdup.c b/contrib/ntp/libntp/strdup.c index 62d5a16d433..8af9ff81b39 100644 --- a/contrib/ntp/libntp/strdup.c +++ b/contrib/ntp/libntp/strdup.c @@ -1,13 +1,15 @@ #include #include -#include "ntp_malloc.h" #include +#include "ntp_malloc.h" +#include "l_stdlib.h" -#ifndef HAVE_STRDUP +#define STRDUP_EMPTY_UNIT +#ifndef HAVE_STRDUP +# undef STRDUP_EMPTY_UNIT char *strdup(const char *s); - char * strdup( const char *s @@ -24,6 +26,30 @@ strdup( return cp; } -#else +#endif + +#ifndef HAVE_MEMCHR +# undef STRDUP_EMPTY_UNIT +void *memchr(const void *s, int c, size_t n) +{ + const unsigned char *p = s; + while (n && *p != c) { + --n; + ++p; + } + return n ? (char*)p : NULL; +} +#endif + +#ifndef HAVE_STRNLEN +# undef STRDUP_EMPTY_UNIT +size_t strnlen(const char *s, size_t n) +{ + const char *e = memchr(s, 0, n); + return e ? (size_t)(e - s) : n; +} +#endif + +#ifdef STRDUP_EMPTY_UNIT int strdup_c_nonempty_compilation_unit; #endif diff --git a/contrib/ntp/libntp/timexsup.c b/contrib/ntp/libntp/timexsup.c index 498961f3b3c..979a7c4aea8 100644 --- a/contrib/ntp/libntp/timexsup.c +++ b/contrib/ntp/libntp/timexsup.c @@ -27,13 +27,13 @@ clamp_rounded( dval = floor(dval + 0.5); /* clamp / saturate */ - if (dval >= LONG_MAX) + if (dval >= (double)LONG_MAX) return LONG_MAX; - if (dval <= LONG_MIN) + if (dval <= (double)LONG_MIN) return LONG_MIN; return (long)dval; - } + double dbl_from_var_long( long lval, @@ -80,4 +80,3 @@ usec_long_from_dbl( { return clamp_rounded(dval * 1e+6); } - diff --git a/contrib/ntp/ntpd/invoke-ntp.conf.texi b/contrib/ntp/ntpd/invoke-ntp.conf.texi index 5ef61c7aaf3..b504ce0b047 100644 --- a/contrib/ntp/ntpd/invoke-ntp.conf.texi +++ b/contrib/ntp/ntpd/invoke-ntp.conf.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (invoke-ntp.conf.texi) # -# It has been AutoGen-ed March 3, 2020 at 05:40:57 PM by AutoGen 5.18.5 +# It has been AutoGen-ed June 23, 2020 at 02:20:31 AM by AutoGen 5.18.5 # From the definitions ntp.conf.def # and the template file agtexi-file.tpl @end ignore diff --git a/contrib/ntp/ntpd/invoke-ntp.keys.texi b/contrib/ntp/ntpd/invoke-ntp.keys.texi index 1687d9d6b33..fcaa1949910 100644 --- a/contrib/ntp/ntpd/invoke-ntp.keys.texi +++ b/contrib/ntp/ntpd/invoke-ntp.keys.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (invoke-ntp.keys.texi) # -# It has been AutoGen-ed March 3, 2020 at 05:40:59 PM by AutoGen 5.18.5 +# It has been AutoGen-ed June 23, 2020 at 02:20:33 AM by AutoGen 5.18.5 # From the definitions ntp.keys.def # and the template file agtexi-file.tpl @end ignore diff --git a/contrib/ntp/ntpd/invoke-ntpd.texi b/contrib/ntp/ntpd/invoke-ntpd.texi index 47919ffb210..3438285956e 100644 --- a/contrib/ntp/ntpd/invoke-ntpd.texi +++ b/contrib/ntp/ntpd/invoke-ntpd.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (invoke-ntpd.texi) # -# It has been AutoGen-ed March 3, 2020 at 05:41:00 PM by AutoGen 5.18.5 +# It has been AutoGen-ed June 23, 2020 at 02:20:35 AM by AutoGen 5.18.5 # From the definitions ntpd-opts.def # and the template file agtexi-cmd.tpl @end ignore @@ -142,7 +142,7 @@ with a status code of 0. @exampleindent 0 @example -ntpd - NTP daemon program - Ver. 4.2.8p14 +ntpd - NTP daemon program - Ver. 4.2.8p15 Usage: ntpd [ - [] | --[@{=| @}] ]... \ [ ... ] Flg Arg Option-Name Description diff --git a/contrib/ntp/ntpd/ntp.conf.5man b/contrib/ntp/ntpd/ntp.conf.5man index a24c9866d21..a3649f05210 100644 --- a/contrib/ntp/ntpd/ntp.conf.5man +++ b/contrib/ntp/ntpd/ntp.conf.5man @@ -10,11 +10,11 @@ .ds B-Font B .ds I-Font I .ds R-Font R -.TH ntp.conf 5man "03 Mar 2020" "4.2.8p14" "File Formats" +.TH ntp.conf 5man "23 Jun 2020" "4.2.8p15" "File Formats" .\" .\" EDIT THIS FILE WITH CAUTION (in-mem file) .\" -.\" It has been AutoGen-ed March 3, 2020 at 05:41:02 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed June 23, 2020 at 02:20:36 AM by AutoGen 5.18.5 .\" From the definitions ntp.conf.def .\" and the template file agman-cmd.tpl .SH NAME diff --git a/contrib/ntp/ntpd/ntp.conf.5mdoc b/contrib/ntp/ntpd/ntp.conf.5mdoc index 2272d58b275..c833cf008ba 100644 --- a/contrib/ntp/ntpd/ntp.conf.5mdoc +++ b/contrib/ntp/ntpd/ntp.conf.5mdoc @@ -1,9 +1,9 @@ -.Dd March 3 2020 +.Dd June 23 2020 .Dt NTP_CONF 5mdoc File Formats .Os .\" EDIT THIS FILE WITH CAUTION (ntp.mdoc) .\" -.\" It has been AutoGen-ed March 3, 2020 at 05:40:53 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed June 23, 2020 at 02:20:27 AM by AutoGen 5.18.5 .\" From the definitions ntp.conf.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/contrib/ntp/ntpd/ntp.conf.html b/contrib/ntp/ntpd/ntp.conf.html index 7dc61eda73a..686ec998110 100644 --- a/contrib/ntp/ntpd/ntp.conf.html +++ b/contrib/ntp/ntpd/ntp.conf.html @@ -61,7 +61,7 @@ Next:

    Short Table of Contents

    diff --git a/contrib/ntp/ntpd/ntp.conf.man.in b/contrib/ntp/ntpd/ntp.conf.man.in index f871c3bb17e..ba4cff52383 100644 --- a/contrib/ntp/ntpd/ntp.conf.man.in +++ b/contrib/ntp/ntpd/ntp.conf.man.in @@ -10,11 +10,11 @@ .ds B-Font B .ds I-Font I .ds R-Font R -.TH ntp.conf 5 "03 Mar 2020" "4.2.8p14" "File Formats" +.TH ntp.conf 5 "23 Jun 2020" "4.2.8p15" "File Formats" .\" .\" EDIT THIS FILE WITH CAUTION (in-mem file) .\" -.\" It has been AutoGen-ed March 3, 2020 at 05:41:02 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed June 23, 2020 at 02:20:36 AM by AutoGen 5.18.5 .\" From the definitions ntp.conf.def .\" and the template file agman-cmd.tpl .SH NAME diff --git a/contrib/ntp/ntpd/ntp.conf.mdoc.in b/contrib/ntp/ntpd/ntp.conf.mdoc.in index eaaf14cb094..973e52823e3 100644 --- a/contrib/ntp/ntpd/ntp.conf.mdoc.in +++ b/contrib/ntp/ntpd/ntp.conf.mdoc.in @@ -1,9 +1,9 @@ -.Dd March 3 2020 +.Dd June 23 2020 .Dt NTP_CONF 5 File Formats .Os .\" EDIT THIS FILE WITH CAUTION (ntp.mdoc) .\" -.\" It has been AutoGen-ed March 3, 2020 at 05:40:53 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed June 23, 2020 at 02:20:27 AM by AutoGen 5.18.5 .\" From the definitions ntp.conf.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/contrib/ntp/ntpd/ntp.keys.5man b/contrib/ntp/ntpd/ntp.keys.5man index 6225ee3f0cc..1470ee73a25 100644 --- a/contrib/ntp/ntpd/ntp.keys.5man +++ b/contrib/ntp/ntpd/ntp.keys.5man @@ -1,8 +1,8 @@ -.TH ntp.keys 5man "03 Mar 2020" "4.2.8p14" "File Formats" +.TH ntp.keys 5man "23 Jun 2020" "4.2.8p15" "File Formats" .\" .\" EDIT THIS FILE WITH CAUTION (ntp.man) .\" -.\" It has been AutoGen-ed March 3, 2020 at 05:41:04 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed June 23, 2020 at 02:20:38 AM by AutoGen 5.18.5 .\" From the definitions ntp.keys.def .\" and the template file agman-file.tpl .Sh NAME diff --git a/contrib/ntp/ntpd/ntp.keys.5mdoc b/contrib/ntp/ntpd/ntp.keys.5mdoc index 7a728a3d435..cec0a573aeb 100644 --- a/contrib/ntp/ntpd/ntp.keys.5mdoc +++ b/contrib/ntp/ntpd/ntp.keys.5mdoc @@ -1,9 +1,9 @@ -.Dd March 3 2020 +.Dd June 23 2020 .Dt NTP_KEYS 5mdoc File Formats .Os FreeBSD 11.2-RELEASE_SI .\" EDIT THIS FILE WITH CAUTION (ntp.mdoc) .\" -.\" It has been AutoGen-ed March 3, 2020 at 05:40:54 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed June 23, 2020 at 02:20:28 AM by AutoGen 5.18.5 .\" From the definitions ntp.keys.def .\" and the template file agmdoc-file.tpl .Sh NAME diff --git a/contrib/ntp/ntpd/ntp.keys.html b/contrib/ntp/ntpd/ntp.keys.html index 01511169262..afe07283b87 100644 --- a/contrib/ntp/ntpd/ntp.keys.html +++ b/contrib/ntp/ntpd/ntp.keys.html @@ -61,7 +61,7 @@ Next:

    Short Table of Contents

    diff --git a/contrib/ntp/ntpd/ntp.keys.man.in b/contrib/ntp/ntpd/ntp.keys.man.in index dac04dda45f..2437cd1cdab 100644 --- a/contrib/ntp/ntpd/ntp.keys.man.in +++ b/contrib/ntp/ntpd/ntp.keys.man.in @@ -1,8 +1,8 @@ -.TH ntp.keys 5 "03 Mar 2020" "4.2.8p14" "File Formats" +.TH ntp.keys 5 "23 Jun 2020" "4.2.8p15" "File Formats" .\" .\" EDIT THIS FILE WITH CAUTION (ntp.man) .\" -.\" It has been AutoGen-ed March 3, 2020 at 05:41:04 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed June 23, 2020 at 02:20:38 AM by AutoGen 5.18.5 .\" From the definitions ntp.keys.def .\" and the template file agman-file.tpl .Sh NAME diff --git a/contrib/ntp/ntpd/ntp.keys.mdoc.in b/contrib/ntp/ntpd/ntp.keys.mdoc.in index 0cbb20e0f43..f2a8bb98471 100644 --- a/contrib/ntp/ntpd/ntp.keys.mdoc.in +++ b/contrib/ntp/ntpd/ntp.keys.mdoc.in @@ -1,9 +1,9 @@ -.Dd March 3 2020 +.Dd June 23 2020 .Dt NTP_KEYS 5 File Formats .Os FreeBSD 11.2-RELEASE_SI .\" EDIT THIS FILE WITH CAUTION (ntp.mdoc) .\" -.\" It has been AutoGen-ed March 3, 2020 at 05:40:54 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed June 23, 2020 at 02:20:28 AM by AutoGen 5.18.5 .\" From the definitions ntp.keys.def .\" and the template file agmdoc-file.tpl .Sh NAME diff --git a/contrib/ntp/ntpd/ntp_config.c b/contrib/ntp/ntpd/ntp_config.c index 0d7af42e875..cdc391c1b95 100644 --- a/contrib/ntp/ntpd/ntp_config.c +++ b/contrib/ntp/ntpd/ntp_config.c @@ -136,6 +136,16 @@ typedef struct peer_resolved_ctx_tag { #define MAXPHONE 10 /* maximum number of phone strings */ #define MAXPPS 20 /* maximum length of PPS device string */ +/* + * Poll Skew List + */ + +static psl_item psl[17-3+1]; /* values for polls 3-17 */ + /* To simplify the runtime code we */ + /* don't want to have to special-case */ + /* dealing with a default */ + + /* * Miscellaneous macros */ @@ -202,8 +212,6 @@ int cryptosw; /* crypto command called */ extern char *stats_drift_file; /* name of the driftfile */ -psl_item psl[17-3+1]; - #ifdef BC_LIST_FRAMEWORK_NOT_YET_USED /* * backwards compatibility flags diff --git a/contrib/ntp/ntpd/ntp_io.c b/contrib/ntp/ntpd/ntp_io.c index 4ad1c7fbc3e..c0dcea59812 100644 --- a/contrib/ntp/ntpd/ntp_io.c +++ b/contrib/ntp/ntpd/ntp_io.c @@ -3293,15 +3293,20 @@ read_refclock_packet( int consumed; struct recvbuf * rb; - rb = get_free_recv_buffer(); + rb = get_free_recv_buffer(TRUE); if (NULL == rb) { /* - * No buffer space available - just drop the packet + * No buffer space available - just drop the 'packet'. + * Since this is a non-blocking character stream we read + * all data that we can. + * + * ...hmmmm... what about "tcflush(fd,TCIFLUSH)" here?!? */ - char buf[RX_BUFF_SIZE]; - - buflen = read(fd, buf, sizeof buf); + char buf[128]; + do + buflen = read(fd, buf, sizeof(buf)); + while (buflen > 0); packets_dropped++; return (buflen); } @@ -3487,15 +3492,18 @@ read_network_packet( #endif /* - * Get a buffer and read the frame. If we - * haven't got a buffer, or this is received - * on a disallowed socket, just dump the + * Get a buffer and read the frame. If we haven't got a buffer, + * or this is received on a disallowed socket, just dump the * packet. */ - rb = get_free_recv_buffer(); - if (NULL == rb || itf->ignore_packets) { - char buf[RX_BUFF_SIZE]; + rb = itf->ignore_packets ? NULL : get_free_recv_buffer(FALSE); + if (NULL == rb) { + /* A partial read on a UDP socket truncates the data and + * removes the message from the queue. So there's no + * need to have a full buffer here on the stack. + */ + char buf[16]; sockaddr_u from; if (rb != NULL) @@ -4740,12 +4748,14 @@ process_routing_msgs(struct asyncio_reader *reader) #ifdef HAVE_RTNETLINK for (nh = UA_PTR(struct nlmsghdr, buffer); NLMSG_OK(nh, cnt); - nh = NLMSG_NEXT(nh, cnt)) { + nh = NLMSG_NEXT(nh, cnt)) + { msg_type = nh->nlmsg_type; #else for (p = buffer; (p + sizeof(struct rt_msghdr)) <= (buffer + cnt); - p += rtm.rtm_msglen) { + p += rtm.rtm_msglen) + { memcpy(&rtm, p, sizeof(rtm)); if (rtm.rtm_version != RTM_VERSION) { msyslog(LOG_ERR, diff --git a/contrib/ntp/ntpd/ntp_proto.c b/contrib/ntp/ntpd/ntp_proto.c index 33e97ef9d98..cde5a30852d 100644 --- a/contrib/ntp/ntpd/ntp_proto.c +++ b/contrib/ntp/ntpd/ntp_proto.c @@ -1333,9 +1333,10 @@ receive( * manycaster has already synchronized to us. */ if ( sys_leap == LEAP_NOTINSYNC - || sys_stratum >= hisstratum + || sys_stratum > hisstratum + 1 || (!sys_cohort && sys_stratum == hisstratum + 1) || rbufp->dstadr->addr_refid == pkt->refid) { + DPRINTF(2, ("receive: sys leap: %0x, sys_stratum %d > hisstratum+1 %d, !sys_cohort %d && sys_stratum == hisstratum+1, loop refid %#x == pkt refid %#x\n", sys_leap, sys_stratum, hisstratum + 1, !sys_cohort, rbufp->dstadr->addr_refid, pkt->refid)); DPRINTF(2, ("receive: AM_FXMIT drop: LEAP_NOTINSYNC || stratum || loop\n")); sys_declined++; return; /* no help */ @@ -1681,8 +1682,9 @@ receive( * MODE_ACTIVE KoDs, which will time out eventually. */ if ( hisleap != LEAP_NOTINSYNC - && (hisstratum < sys_floor || hisstratum >= sys_ceiling)) { - DPRINTF(2, ("receive: AM_NEWPASS drop: Autokey group mismatch\n")); + && (hisstratum < sys_floor || hisstratum >= sys_ceiling)) { + DPRINTF(2, ("receive: AM_NEWPASS drop: Remote stratum (%d) out of range\n", + hisstratum)); sys_declined++; return; /* no help */ } @@ -2485,10 +2487,6 @@ process_packet( double etemp, ftemp, td; #endif /* ASSYM */ -#if 0 - sys_processed++; - peer->processed++; -#endif p_del = FPTOD(NTOHS_FP(pkt->rootdelay)); p_offset = 0; p_disp = FPTOD(NTOHS_FP(pkt->rootdisp)); @@ -2501,10 +2499,6 @@ process_packet( pversion = PKT_VERSION(pkt->li_vn_mode); pstratum = PKT_TO_STRATUM(pkt->stratum); - /**/ - - /**/ - /* * Verify the server is synchronized; that is, the leap bits, * stratum and root distance are valid. @@ -2524,19 +2518,15 @@ process_packet( peer->seldisptoolarge++; DPRINTF(1, ("packet: flash header %04x\n", peer->flash)); - - /* ppoll updated? */ - /* XXX: Fuzz the poll? */ - poll_update(peer, peer->hpoll, (peer->hmode == MODE_CLIENT)); + /* [Bug 3592] do *not* update poll on bad packets! */ return; } - /**/ - -#if 1 + /* + * update stats, now that we really handle this packet: + */ sys_processed++; peer->processed++; -#endif /* * Capture the header values in the client/peer association.. @@ -2571,9 +2561,6 @@ process_packet( if (peer->burst > 0) peer->nextdate = current_time; } - poll_update(peer, peer->hpoll, (peer->hmode == MODE_CLIENT)); - - /**/ /* * If the peer was previously unreachable, raise a trap. In any @@ -3455,11 +3442,13 @@ clock_select(void) double d, e, f, g; double high, low; double speermet; + double lastresort_dist = MAXDISPERSE; double orphmet = 2.0 * U_INT32_MAX; /* 2x is greater than */ struct endpoint endp; struct peer *osys_peer; struct peer *sys_prefer = NULL; /* prefer peer */ struct peer *typesystem = NULL; + struct peer *typelastresort = NULL; struct peer *typeorphan = NULL; #ifdef REFCLOCK struct peer *typeacts = NULL; @@ -3523,6 +3512,22 @@ clock_select(void) continue; } + /* + * If we have never been synchronised, look for any peer + * which has ever been synchronised and pick the one which + * has the lowest root distance. This can be used as a last + * resort if all else fails. Once we get an initial sync + * with this peer, sys_reftime gets set and so this + * function becomes disabled. + */ + if (L_ISZERO(&sys_reftime)) { + d = root_distance(peer); + if (!L_ISZERO(&peer->reftime) && d < lastresort_dist) { + typelastresort = peer; + lastresort_dist = d; + } + } + /* * If this peer is an orphan parent, elect the * one with the lowest metric defined as the @@ -3756,6 +3761,9 @@ clock_select(void) if (typeorphan != NULL) { peers[0].peer = typeorphan; nlist = 1; + } else if (typelastresort != NULL) { + peers[0].peer = typelastresort; + nlist = 1; } } @@ -3949,8 +3957,7 @@ clock_select(void) */ if (typesystem == NULL) { if (osys_peer != NULL) { - if (sys_orphwait > 0) - orphwait = current_time + sys_orphwait; + orphwait = current_time + sys_orphwait; report_event(EVNT_NOPEER, NULL, NULL); } sys_peer = NULL; @@ -5344,7 +5351,7 @@ proto_config( case PROTO_ORPHWAIT: /* orphan wait (orphwait) */ orphwait -= sys_orphwait; - sys_orphwait = (int)dvalue; + sys_orphwait = (dvalue >= 1) ? (int)dvalue : NTP_ORPHWAIT; orphwait += sys_orphwait; break; diff --git a/contrib/ntp/ntpd/ntp_refclock.c b/contrib/ntp/ntpd/ntp_refclock.c index 6a0861ed03b..872f4a05263 100644 --- a/contrib/ntp/ntpd/ntp_refclock.c +++ b/contrib/ntp/ntpd/ntp_refclock.c @@ -48,15 +48,15 @@ * structure, which contains for most drivers the decimal equivalants * of the year, day, month, hour, second and millisecond/microsecond * decoded from the ASCII timecode. Additional information includes - * the receive timestamp, exception report, statistics tallies, etc. + * the receive timestamp, exception report, statistics tallies, etc. * In addition, there may be a driver-specific unit structure used for * local control of the device. * * The support routines are passed a pointer to the peer structure, * which is used for all peer-specific processing and contains a * pointer to the refclockproc structure, which in turn contains a - * pointer to the unit structure, if used. The peer structure is - * identified by an interface address in the dotted quad form + * pointer to the unit structure, if used. The peer structure is + * identified by an interface address in the dotted quad form * 127.127.t.u, where t is the clock type and u the unit. */ #define FUDGEFAC .1 /* fudge correction factor */ @@ -343,7 +343,7 @@ refclock_timer( if (pp->action != NULL && pp->nextaction <= current_time) (*pp->action)(p); } - + /* * refclock_transmit - simulate the transmit procedure @@ -435,17 +435,17 @@ refclock_samples_avail( ) { u_int na; - + # if MAXSTAGE & (MAXSTAGE - 1) - + na = pp->coderecv - pp->codeproc; if (na > MAXSTAGE) na += MAXSTAGE; - + # else - + na = (pp->coderecv - pp->codeproc) & (MAXSTAGE - 1); - + # endif return na; } @@ -462,26 +462,26 @@ refclock_samples_expire( ) { u_int na; - + if (nd <= 0) return 0; # if MAXSTAGE & (MAXSTAGE - 1) - + na = pp->coderecv - pp->codeproc; if (na > MAXSTAGE) na += MAXSTAGE; if ((u_int)nd < na) - nd = na; + nd = na; pp->codeproc = (pp->codeproc + nd) % MAXSTAGE; - + # else - + na = (pp->coderecv - pp->codeproc) & (MAXSTAGE - 1); if ((u_int)nd > na) nd = (int)na; pp->codeproc = (pp->codeproc + nd) & (MAXSTAGE - 1); - + # endif return nd; } @@ -615,14 +615,14 @@ refclock_sample( /* * Determine the offset and jitter. */ - pp->offset = 0; + pp->offset = off[i]; pp->jitter = 0; - for (k = i; k < j; k++) { + for (k = i + 1; k < j; k++) { pp->offset += off[k]; - if (k > i) - pp->jitter += SQUARE(off[k] - off[k - 1]); + pp->jitter += SQUARE(off[k] - off[k - 1]); } pp->offset /= m; + m -= (m > 1); /* only (m-1) terms attribute to jitter! */ pp->jitter = max(SQRT(pp->jitter / m), LOGTOD(sys_precision)); /* @@ -736,7 +736,7 @@ refclock_gtlin( while (sp != spend && dp != dpend) { char c; - + c = *sp++ & 0x7f; if (c >= 0x20 && c < 0x7f) *dp++ = c; @@ -1407,7 +1407,7 @@ refclock_params( ap->pps_params.mode & ~PPS_TSFMT_TSPEC, PPS_TSFMT_TSPEC) < 0) { - if (errno != EOPNOTSUPP) { + if (errno != EOPNOTSUPP) { msyslog(LOG_ERR, "refclock_params: time_pps_kcbind: %m"); return (0); @@ -1431,7 +1431,7 @@ int refclock_pps( struct peer *peer, /* peer structure pointer */ struct refclock_atom *ap, /* atom structure pointer */ - int mode /* mode bits */ + int mode /* mode bits */ ) { struct refclockproc *pp; @@ -1443,7 +1443,7 @@ refclock_pps( * We require the clock to be synchronized before setting the * parameters. When the parameters have been set, fetch the * most recent PPS timestamp. - */ + */ pp = peer->procptr; if (ap->handle == 0) return (0); @@ -1519,7 +1519,7 @@ refclock_pps( pp->lastrec.l_uf = (u_int32)(dtemp * FRAC); clk_add_sample(pp, dcorr); refclock_checkburst(peer, pp); - + #ifdef DEBUG if (debug > 1) printf("refclock_pps: %lu %f %f\n", current_time, @@ -1579,7 +1579,7 @@ refclock_ppsaugment( ) { l_fp delta[1]; - + #ifdef HAVE_PPSAPI pps_info_t pps_info; @@ -1589,14 +1589,14 @@ refclock_ppsaugment( static const uint32_t s_plim_hi = UINT32_C(1932735284); static const uint32_t s_plim_lo = UINT32_C(2362232013); - + /* fixup receive time in case we have to bail out early */ DTOLFP(rcvfudge, delta); L_SUB(rcvtime, delta); if (NULL == ap) return FALSE; - + ZERO(timeout); ZERO(pps_info); @@ -1630,7 +1630,7 @@ refclock_ppsaugment( phase = delta->l_ui; if (phase >= 2 && phase < (uint32_t)-2) return FALSE; /* PPS is stale, don't use it */ - + /* If the phase is too close to 0.5, the decision whether to * move up or down is becoming noise sensitive. That is, we * might amplify usec noise between samples into seconds with a @@ -1642,7 +1642,7 @@ refclock_ppsaugment( phase = delta->l_uf; if (phase > s_plim_hi && phase < s_plim_lo) return FALSE; /* we're in the noise lock gap */ - + /* sign-extend fraction into seconds */ delta->l_ui = UINT32_C(0) - ((phase >> 31) & 1); /* add it up now */ @@ -1650,7 +1650,7 @@ refclock_ppsaugment( return TRUE; # else /* have no PPS support at all */ - + /* just fixup receive time and fail */ UNUSED_ARG(ap); UNUSED_ARG(ppsfudge); @@ -1658,7 +1658,7 @@ refclock_ppsaugment( DTOLFP(rcvfudge, delta); L_SUB(rcvtime, delta); return FALSE; - + # endif } @@ -1694,7 +1694,7 @@ refclock_checkburst( * reach mask. With less samples available, we break away. */ needs = peer->reach; - needs -= (needs >> 1) & 0x55; + needs -= (needs >> 1) & 0x55; needs = (needs & 0x33) + ((needs >> 2) & 0x33); needs = (needs + (needs >> 4)) & 0x0F; if (needs > 6) @@ -1706,7 +1706,7 @@ refclock_checkburst( /* Get serious. Reduce the poll to minimum and schedule early. * (Changing the peer poll is probably in vain, as it will be - * re-adjusted, but maybe some time the hint will work...) + * re-adjusted, but maybe some time the hint will work...) */ peer->hpoll = peer->minpoll; peer->nextdate = limit; @@ -1749,7 +1749,7 @@ refclock_vformat_lcode( len = 0; else if (len >= sizeof(pp->a_lastcode)) len = sizeof(pp->a_lastcode) - 1; - + pp->lencode = (u_short)len; pp->a_lastcode[len] = '\0'; /* !note! the NUL byte is needed in case vsnprintf() really fails */ @@ -1763,10 +1763,10 @@ refclock_format_lcode( ) { va_list va; - + va_start(va, fmt); refclock_vformat_lcode(pp, fmt, va); - va_end(va); + va_end(va); } #endif /* REFCLOCK */ diff --git a/contrib/ntp/ntpd/ntp_request.c b/contrib/ntp/ntpd/ntp_request.c index bffdec5a9d1..e7997a3b909 100644 --- a/contrib/ntp/ntpd/ntp_request.c +++ b/contrib/ntp/ntpd/ntp_request.c @@ -1184,7 +1184,7 @@ mem_stats( for (i = 0; i < NTP_HASH_SIZE; i++) ms->hashcount[i] = (u_char) - max((u_int)peer_hash_count[i], UCHAR_MAX); + min((u_int)peer_hash_count[i], UCHAR_MAX); (void) more_pkt(); flush_pkt(); diff --git a/contrib/ntp/ntpd/ntp_timer.c b/contrib/ntp/ntpd/ntp_timer.c index 9725b5bda31..4f669f0699f 100644 --- a/contrib/ntp/ntpd/ntp_timer.c +++ b/contrib/ntp/ntpd/ntp_timer.c @@ -350,21 +350,38 @@ timer(void) * than the orphan stratum are available. A server with no other * synchronization source is an orphan. It shows offset zero and * reference ID the loopback address. + * + * [bug 3644] If the orphan stratum is >= STRATUM_UNSPEC, we + * have to do it a bit different. 'clock_select()' simply + * tiptoed home, but since we're unsync'd and have no peer, we + * should eventually declare we're out of sync. Otherwise we + * would persistently claim we're good, and we're everything but + * that... + * + * XXX: do we want to log an event about this? */ - if (sys_orphan < STRATUM_UNSPEC && sys_peer == NULL && - current_time > orphwait) { - if (sys_leap == LEAP_NOTINSYNC) { - set_sys_leap(LEAP_NOWARNING); + if (sys_peer == NULL && current_time > orphwait) { + if (sys_orphan < STRATUM_UNSPEC) { + if (sys_leap == LEAP_NOTINSYNC) { + set_sys_leap(LEAP_NOWARNING); #ifdef AUTOKEY - if (crypto_flags) - crypto_update(); + if (crypto_flags) + crypto_update(); #endif /* AUTOKEY */ + } + sys_stratum = (u_char)sys_orphan; + } else { + if (sys_leap != LEAP_NOTINSYNC) { + set_sys_leap(LEAP_NOTINSYNC); + msyslog(LOG_WARNING, "%s", + "no peer for too long, server running free now"); + } + sys_stratum = STRATUM_UNSPEC; } - sys_stratum = (u_char)sys_orphan; if (sys_stratum > 1) - sys_refid = htonl(LOOPBACKADR); + sys_refid = htonl(LOOPBACKADR); else - memcpy(&sys_refid, "LOOP", 4); + memcpy(&sys_refid, "LOOP", 4); sys_offset = 0; sys_rootdelay = 0; sys_rootdisp = 0; diff --git a/contrib/ntp/ntpd/ntpd-opts.c b/contrib/ntp/ntpd/ntpd-opts.c index e463b4b4822..42b2a7722cc 100644 --- a/contrib/ntp/ntpd/ntpd-opts.c +++ b/contrib/ntp/ntpd/ntpd-opts.c @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (ntpd-opts.c) * - * It has been AutoGen-ed March 3, 2020 at 05:40:30 PM by AutoGen 5.18.5 + * It has been AutoGen-ed June 23, 2020 at 02:20:04 AM by AutoGen 5.18.5 * From the definitions ntpd-opts.def * and the template file options * @@ -75,7 +75,7 @@ extern FILE * option_usage_fp; * static const strings for ntpd options */ static char const ntpd_opt_strs[3132] = -/* 0 */ "ntpd 4.2.8p14\n" +/* 0 */ "ntpd 4.2.8p15\n" "Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n" "This is free software. It is licensed for use, modification and\n" "redistribution under the terms of the NTP License, copies of which\n" @@ -205,12 +205,12 @@ static char const ntpd_opt_strs[3132] = /* 2901 */ "output version information and exit\0" /* 2937 */ "version\0" /* 2945 */ "NTPD\0" -/* 2950 */ "ntpd - NTP daemon program - Ver. 4.2.8p14\n" +/* 2950 */ "ntpd - NTP daemon program - Ver. 4.2.8p15\n" "Usage: %s [ - [] | --[{=| }] ]... \\\n" "\t\t[ ... ]\n\0" /* 3082 */ "http://bugs.ntp.org, bugs@ntp.org\0" /* 3116 */ "\n\0" -/* 3118 */ "ntpd 4.2.8p14"; +/* 3118 */ "ntpd 4.2.8p15"; /** * ipv4 option description with @@ -1529,7 +1529,7 @@ static void bogus_function(void) { translate option names. */ /* referenced via ntpdOptions.pzCopyright */ - puts(_("ntpd 4.2.8p14\n\ + puts(_("ntpd 4.2.8p15\n\ Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n\ This is free software. It is licensed for use, modification and\n\ redistribution under the terms of the NTP License, copies of which\n\ @@ -1670,7 +1670,7 @@ implied warranty.\n")); puts(_("output version information and exit")); /* referenced via ntpdOptions.pzUsageTitle */ - puts(_("ntpd - NTP daemon program - Ver. 4.2.8p14\n\ + puts(_("ntpd - NTP daemon program - Ver. 4.2.8p15\n\ Usage: %s [ - [] | --[{=| }] ]... \\\n\ \t\t[ ... ]\n")); @@ -1678,7 +1678,7 @@ Usage: %s [ - [] | --[{=| }] ]... \\\n\ puts(_("\n")); /* referenced via ntpdOptions.pzFullVersion */ - puts(_("ntpd 4.2.8p14")); + puts(_("ntpd 4.2.8p15")); /* referenced via ntpdOptions.pzFullUsage */ puts(_("<<>>")); diff --git a/contrib/ntp/ntpd/ntpd-opts.h b/contrib/ntp/ntpd/ntpd-opts.h index a2e1904003c..07cdc2e3e54 100644 --- a/contrib/ntp/ntpd/ntpd-opts.h +++ b/contrib/ntp/ntpd/ntpd-opts.h @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (ntpd-opts.h) * - * It has been AutoGen-ed March 3, 2020 at 05:40:30 PM by AutoGen 5.18.5 + * It has been AutoGen-ed June 23, 2020 at 02:20:04 AM by AutoGen 5.18.5 * From the definitions ntpd-opts.def * and the template file options * @@ -106,9 +106,9 @@ typedef enum { /** count of all options for ntpd */ #define OPTION_CT 38 /** ntpd version */ -#define NTPD_VERSION "4.2.8p14" +#define NTPD_VERSION "4.2.8p15" /** Full ntpd version text */ -#define NTPD_FULL_VERSION "ntpd 4.2.8p14" +#define NTPD_FULL_VERSION "ntpd 4.2.8p15" /** * Interface defines for all options. Replace "n" with the UPPER_CASED diff --git a/contrib/ntp/ntpd/ntpd.1ntpdman b/contrib/ntp/ntpd/ntpd.1ntpdman index 675bd799bd9..461f37d43be 100644 --- a/contrib/ntp/ntpd/ntpd.1ntpdman +++ b/contrib/ntp/ntpd/ntpd.1ntpdman @@ -10,11 +10,11 @@ .ds B-Font B .ds I-Font I .ds R-Font R -.TH ntpd 1ntpdman "03 Mar 2020" "4.2.8p14" "User Commands" +.TH ntpd 1ntpdman "23 Jun 2020" "4.2.8p15" "User Commands" .\" .\" EDIT THIS FILE WITH CAUTION (in-mem file) .\" -.\" It has been AutoGen-ed March 3, 2020 at 05:41:05 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed June 23, 2020 at 02:20:39 AM by AutoGen 5.18.5 .\" From the definitions ntpd-opts.def .\" and the template file agman-cmd.tpl .SH NAME diff --git a/contrib/ntp/ntpd/ntpd.1ntpdmdoc b/contrib/ntp/ntpd/ntpd.1ntpdmdoc index 8d06869e5af..60703324ea1 100644 --- a/contrib/ntp/ntpd/ntpd.1ntpdmdoc +++ b/contrib/ntp/ntpd/ntpd.1ntpdmdoc @@ -1,9 +1,9 @@ -.Dd March 3 2020 +.Dd June 23 2020 .Dt NTPD 1ntpdmdoc User Commands .Os .\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc) .\" -.\" It has been AutoGen-ed March 3, 2020 at 05:40:55 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed June 23, 2020 at 02:20:30 AM by AutoGen 5.18.5 .\" From the definitions ntpd-opts.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/contrib/ntp/ntpd/ntpd.html b/contrib/ntp/ntpd/ntpd.html index 4ac6127dda4..f002faa2ac5 100644 --- a/contrib/ntp/ntpd/ntpd.html +++ b/contrib/ntp/ntpd/ntpd.html @@ -67,7 +67,7 @@ The program can operate in any of several modes, including client/server, symmetric and broadcast modes, and with both symmetric-key and public-key cryptography.

    -

    This document applies to version 4.2.8p14 of ntpd. +

    This document applies to version 4.2.8p15 of ntpd.

    Short Table of Contents

    @@ -309,7 +309,7 @@ used to select the program, defaulting to more. Both will exit with a status code of 0.

    -
    ntpd - NTP daemon program - Ver. 4.2.8p14
    +
    ntpd - NTP daemon program - Ver. 4.2.8p15
     Usage:  ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
                     [ <server1> ... <serverN> ]
       Flg Arg Option-Name    Description
    diff --git a/contrib/ntp/ntpd/ntpd.man.in b/contrib/ntp/ntpd/ntpd.man.in
    index 087af030cf2..00c567f508d 100644
    --- a/contrib/ntp/ntpd/ntpd.man.in
    +++ b/contrib/ntp/ntpd/ntpd.man.in
    @@ -10,11 +10,11 @@
     .ds B-Font B
     .ds I-Font I
     .ds R-Font R
    -.TH ntpd @NTPD_MS@ "03 Mar 2020" "4.2.8p14" "User Commands"
    +.TH ntpd @NTPD_MS@ "23 Jun 2020" "4.2.8p15" "User Commands"
     .\"
     .\" EDIT THIS FILE WITH CAUTION (in-mem file)
     .\"
    -.\" It has been AutoGen-ed March 3, 2020 at 05:41:05 PM by AutoGen 5.18.5
    +.\" It has been AutoGen-ed June 23, 2020 at 02:20:39 AM by AutoGen 5.18.5
     .\" From the definitions ntpd-opts.def
     .\" and the template file agman-cmd.tpl
     .SH NAME
    diff --git a/contrib/ntp/ntpd/ntpd.mdoc.in b/contrib/ntp/ntpd/ntpd.mdoc.in
    index 9f360073d33..8eb547a438f 100644
    --- a/contrib/ntp/ntpd/ntpd.mdoc.in
    +++ b/contrib/ntp/ntpd/ntpd.mdoc.in
    @@ -1,9 +1,9 @@
    -.Dd March 3 2020
    +.Dd June 23 2020
     .Dt NTPD @NTPD_MS@ User Commands
     .Os
     .\"  EDIT THIS FILE WITH CAUTION  (ntpd-opts.mdoc)
     .\"
    -.\"  It has been AutoGen-ed  March  3, 2020 at 05:40:55 PM by AutoGen 5.18.5
    +.\"  It has been AutoGen-ed  June 23, 2020 at 02:20:30 AM by AutoGen 5.18.5
     .\"  From the definitions    ntpd-opts.def
     .\"  and the template file   agmdoc-cmd.tpl
     .Sh NAME
    diff --git a/contrib/ntp/ntpd/refclock_jjy.c b/contrib/ntp/ntpd/refclock_jjy.c
    index a73cdd88948..0b554fac667 100644
    --- a/contrib/ntp/ntpd/refclock_jjy.c
    +++ b/contrib/ntp/ntpd/refclock_jjy.c
    @@ -4,7 +4,7 @@
     
     /**********************************************************************/
     /*								      */
    -/*  Copyright (C) 2001-2015, Takao Abe.  All rights reserved.	      */
    +/*  Copyright (C) 2001-2020, Takao Abe.  All rights reserved.	      */
     /*								      */
     /*  Permission to use, copy, modify, and distribute this software     */
     /*  and its documentation for any purpose is hereby granted	      */
    @@ -115,6 +115,13 @@
     /*             tool. ( The code is harmless and has no bug. )	      */
     /*             teljjy_conn_send()				      */
     /*								      */
    +/*  2020/01/19							      */
    +/*    [Change] Handling TS-JJY01/02 status of the the STUS reply.     */
    +/*             Time synchronization can be skipped by the settings of */
    +/*             the flag2 when the status of the reply is UNADJUSTED.  */
    +/*    [Change] Quiet compilation for the GCC 9.2.0.                   */
    +/*    [Fix]    Correct typos in comment lines                         */
    +/*								      */
     /**********************************************************************/
     
     #ifdef HAVE_CONFIG_H
    @@ -194,6 +201,10 @@ struct jjyunit {
     	char	sTextBuf [ MAX_RAWBUF ] ;
     	int 	iTextBufLen ;
     	char	bSkipCntrlCharOnly ;
    +/* TS-JJY01, TS-JJY02 */
    +	time_t	tLastAdjustedTimestamp ;
    +	char	bStusReplyAdjusted ;
    +	char	bStusReplyAdjustedAtLeastOnce ;
     /* Telephone JJY auto measurement of the loopback delay */
     	char	bLoopbackMode ;
     	short	iLoopbackCount ;
    @@ -371,7 +382,7 @@ struct	refclock refclock_jjy = {
      * Local constants definition
      */
     
    -#define	MAX_LOGTEXT	100
    +#define	MAX_LOGTEXT	200
     
     #ifndef	TRUE
     #define	TRUE	(0==0)
    @@ -410,6 +421,7 @@ struct	refclock refclock_jjy = {
     #define	JJY_CLOCKSTATS_MESSAGE_LOOPBACK_DELAY   	"* Loopback delay : %d.%03d mSec."
     #define	JJY_CLOCKSTATS_MESSAGE_DELAY_ADJUST     	"* Delay adjustment : %d mSec. ( valid=%hd/%d )"
     #define	JJY_CLOCKSTATS_MESSAGE_DELAY_UNADJUST   	"* Delay adjustment : None ( valid=%hd/%d )"
    +#define	JJY_CLOCKSTATS_MESSAGE_STUS_UNADJUSTED  	"* Skip time synchronization : STUS is 'UNADJUSTED' for %.0lf %s"
     
     #define	JJY_CLOCKSTATS_MESSAGE_UNEXPECTED_REPLY     	"# Unexpected reply : [%s]"
     #define	JJY_CLOCKSTATS_MESSAGE_INVALID_LENGTH     	"# Invalid length : length=%d"
    @@ -619,7 +631,7 @@ jjy_receive ( struct recvbuf *rbufp )
     		/* To avoid its claim, pass the value BMAX-1. */
     
     		/*
    -		 * Append received charaters to temporary buffer
    +		 * Append received characters to temporary buffer
     		 */
     		for ( i = 0 ;
     		      i < pp->lencode && up->iRawBufLen < MAX_RAWBUF - 2 ;
    @@ -703,7 +715,7 @@ jjy_receive ( struct recvbuf *rbufp )
     				iBreakPosition = up->iRawBufLen - 1 ;
     			}
     
    -			/* Copy charaters from temporary buffer to process buffer */
    +			/* Copy characters from temporary buffer to process buffer */
     			up->iLineBufLen = up->iTextBufLen = 0 ;
     			for ( i = iReadRawBuf ; i <= iBreakPosition ; i ++ ) {
     
    @@ -926,7 +938,7 @@ jjy_poll ( int unit, struct peer *peer )
     	up->iRawBufLen = 0 ;
     
     	switch ( up->unittype ) {
    -	
    +
     	case UNITTYPE_TRISTATE_JJY01 :
     		jjy_poll_tristate_jjy01  ( unit, peer ) ;
     		break ;
    @@ -991,7 +1003,7 @@ jjy_timer ( int unit, struct peer *peer )
     	}
     
     	switch ( up->unittype ) {
    -	
    +
     	case UNITTYPE_TELEPHONE :
     		jjy_timer_telephone ( unit, peer ) ;
     		break ;
    @@ -1020,8 +1032,8 @@ jjy_synctime ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
     	pp->second = up->second ;
     	pp->nsec   = up->msecond * 1000000 ;
     
    -	/* 
    -	 * JST to UTC 
    +	/*
    +	 * JST to UTC
     	 */
     	pp->hour -= 9 ;
     	if ( pp->hour < 0 ) {
    @@ -1070,7 +1082,7 @@ jjy_synctime ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
     	case 5 : cStatus = '#' ; pStatus = "Selected"  ; break ;
     	case 6 : cStatus = '*' ; pStatus = "Sys.Peer"  ; break ;
     	case 7 : cStatus = 'o' ; pStatus = "PPS.Peer"  ; break ;
    -	default : break ; 
    +	default : break ;
     	}
     
     	snprintf ( sLog, sizeof(sLog),
    @@ -1151,6 +1163,9 @@ jjy_start_tristate_jjy01 ( int unit, struct peer *peer, struct jjyunit *up )
     	up->linespeed = SPEED232_TRISTATE_JJY01 ;
     	up->linediscipline = LDISC_CLK ;
     
    +	time( &(up->tLastAdjustedTimestamp) ) ;
    +	up->bStusReplyAdjustedAtLeastOnce = FALSE ;
    +
     	return 0 ;
     
     }
    @@ -1164,10 +1179,12 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
     	struct refclockproc *pp ;
     	struct peer	    *peer;
     
    -	char *		pBuf ;
    -	char		sLog [ 100 ] ;
    -	int 		iLen ;
    -	int 		rc ;
    +	char *	pBuf ;
    +	char	sLog [ MAX_LOGTEXT ] ;
    +	int 	iLen ;
    +	int 	rc ;
    +	time_t	now ;
    +	double	fSeconds ;
     
     	const char *	pCmd ;
     	int 		iCmdLen ;
    @@ -1269,11 +1286,17 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
     	case TS_JJY01_COMMAND_NUMBER_STUS :
     
     		if ( strncmp( pBuf, TS_JJY01_REPLY_STUS_ADJUSTED,
    -			     TS_JJY01_REPLY_LENGTH_STUS_ADJUSTED ) == 0
    -		  || strncmp( pBuf, TS_JJY01_REPLY_STUS_UNADJUSTED,
    -			     TS_JJY01_REPLY_LENGTH_STUS_UNADJUSTED ) == 0 ) {
    -			/* Good */
    +			     TS_JJY01_REPLY_LENGTH_STUS_ADJUSTED ) == 0 ) {
    +			/* STUS reply : adjusted */
    +			up->bStusReplyAdjusted = TRUE ;
    +			up->bStusReplyAdjustedAtLeastOnce = TRUE ;
    +			time( &(up->tLastAdjustedTimestamp) ) ;
    +		} else if ( strncmp( pBuf, TS_JJY01_REPLY_STUS_UNADJUSTED,
    +			             TS_JJY01_REPLY_LENGTH_STUS_UNADJUSTED ) == 0 ) {
    +			/* STUS reply : unadjusted */
    +			up->bStusReplyAdjusted = FALSE ;
     		} else {
    +			/* Bad reply */
     			snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_INVALID_REPLY,
     				  pBuf ) ;
     			jjy_write_clockstats( peer, JJY_CLOCKSTATS_MARK_ERROR, sLog ) ;
    @@ -1286,11 +1309,12 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
     	case TS_JJY01_COMMAND_NUMBER_DCST :
     
     		if ( strncmp( pBuf, TS_JJY01_REPLY_DCST_VALID,
    -			     TS_JJY01_REPLY_LENGTH_DCST_VALID ) == 0
    +			      TS_JJY01_REPLY_LENGTH_DCST_VALID ) == 0
     		  || strncmp( pBuf, TS_JJY01_REPLY_DCST_INVALID,
    -			     TS_JJY01_REPLY_LENGTH_DCST_INVALID ) == 0 ) {
    -			/* Good */
    +			      TS_JJY01_REPLY_LENGTH_DCST_INVALID ) == 0 ) {
    +			/* Valid reply */
     		} else {
    +			/* Bad reply */
     			snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_INVALID_REPLY,
     				  pBuf ) ;
     			jjy_write_clockstats( peer, JJY_CLOCKSTATS_MARK_ERROR, sLog ) ;
    @@ -1300,7 +1324,7 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
     
     		break ;
     
    -	default : /*  Unexpected reply */
    +	default : /* Unexpected reply */
     
     		snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_INVALID_REPLY,
     			  pBuf ) ;
    @@ -1313,9 +1337,27 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
     	if ( up->iTimestampCount == 2 ) {
     		/* Process date and time */
     
    -		if ( up->iTimestamp[1] - 2 <= up->iTimestamp[0]
    -		  && up->iTimestamp[0]     <= up->iTimestamp[1] ) {
    -			/* 3 commands (time,date,stim) was excuted in two seconds */
    +		time( &now ) ;
    +		fSeconds = difftime( now, up->tLastAdjustedTimestamp ) ;
    +
    +		if ( ( pp->sloppyclockflag & CLK_FLAG2 ) != 0
    +		  && ( ! up->bStusReplyAdjusted )
    +		  && ( fSeconds >= ( pp->fudgetime2 * 3600 ) || ( ! up->bStusReplyAdjustedAtLeastOnce ) ) ) {
    +			/* STUS is not ADJUSTED */
    +			if ( fSeconds < 60 ) {
    +				snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_STUS_UNADJUSTED, fSeconds, "seconds" ) ;
    +			} else if ( fSeconds < 3600 ) {
    +				snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_STUS_UNADJUSTED, fSeconds / 60, "minutes" ) ;
    +			} else if ( fSeconds < 86400 ) {
    +				snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_STUS_UNADJUSTED, fSeconds / 3600, "hours" ) ;
    +			} else {
    +				snprintf( sLog, sizeof(sLog)-1, JJY_CLOCKSTATS_MESSAGE_STUS_UNADJUSTED, fSeconds / 86400, "days" ) ;
    +			}
    +			jjy_write_clockstats( peer, JJY_CLOCKSTATS_MARK_INFORMATION, sLog ) ;
    +			return JJY_RECEIVE_SKIP ;
    +		} else if ( up->iTimestamp[1] - 2 <= up->iTimestamp[0]
    +		         && up->iTimestamp[0]     <= up->iTimestamp[1] ) {
    +			/* 3 commands (time,date,stim) was executed in two seconds */
     			jjy_synctime( peer, pp, up ) ;
     			return JJY_RECEIVE_DONE ;
     		} else if ( up->iTimestamp[0] > up->iTimestamp[1] ) {
    @@ -1385,6 +1427,8 @@ jjy_poll_tristate_jjy01  ( int unit, struct peer *peer )
     		up->iLineCount = 2 ;
     	}
     
    +	up->bStusReplyAdjusted = FALSE ;
    +
     #ifdef DEBUG
     	if ( debug ) {
     		printf ( "%s (refclock_jjy.c) : flag1=%X CLK_FLAG1=%X up->iLineCount=%d\n",
    @@ -1421,7 +1465,7 @@ jjy_poll_tristate_jjy01  ( int unit, struct peer *peer )
     /*                                                                                                */
     /*  Command               Response                                  Remarks                       */
     /*  --------------------  ----------------------------------------  ----------------------------  */
    -/*  1J          JYYMMDD HHMMSSS                 J is a fixed character        */
    +/*  1J          JYYMMDDWHHMMSSS                 J is a fixed character        */
     /*                                                                                                */
     /*################################################################################################*/
     
    @@ -1461,7 +1505,7 @@ jjy_receive_cdex_jst2000 ( struct recvbuf *rbufp )
     	struct refclockproc *pp ;
     	struct peer         *peer ;
     
    -	char	*pBuf, sLog [ 100 ] ;
    +	char	*pBuf, sLog [ MAX_LOGTEXT ] ;
     	int 	iLen ;
     	int 	rc ;
     
    @@ -1946,8 +1990,8 @@ jjy_poll_citizentic_jjy200 ( int unit, struct peer *peer )
     /*################################################################################################*/
     /*################################################################################################*/
     /*                                                                                                */
    -/*  This clock has NMEA mode and command/respose mode.                                            */
    -/*  When this jjy driver are used, set to command/respose mode of this clock                      */
    +/*  This clock has NMEA mode and command/response mode.                                           */
    +/*  When this jjy driver are used, set to command/response mode of this clock                     */
     /*  by the onboard switch SW4, and make sure the LED-Y is tured on.                               */
     /*  Other than this JJY driver, the refclock driver type 20, generic NMEA driver,                 */
     /*  works with the NMEA mode of this clock.                                                       */
    @@ -2022,7 +2066,7 @@ jjy_receive_tristate_gpsclock01 ( struct recvbuf *rbufp )
     	struct peer	    *peer;
     
     	char *		pBuf ;
    -	char		sLog [ 100 ] ;
    +	char		sLog [ MAX_LOGTEXT ] ;
     	int 		iLen ;
     	int 		rc ;
     
    @@ -2189,7 +2233,7 @@ jjy_receive_tristate_gpsclock01 ( struct recvbuf *rbufp )
     
     		if ( up->iTimestamp[1] - 2 <= up->iTimestamp[0]
     		  && up->iTimestamp[0]     <= up->iTimestamp[1] ) {
    -			/* 3 commands (time,date,stim) was excuted in two seconds */
    +			/* 3 commands (time,date,stim) was executed in two seconds */
     			jjy_synctime( peer, pp, up ) ;
     			return JJY_RECEIVE_DONE ;
     		} else if ( up->iTimestamp[0] > up->iTimestamp[1] ) {
    @@ -2344,7 +2388,7 @@ jjy_receive_seiko_tsys_tdc_300 ( struct recvbuf *rbufp )
     	struct refclockproc	*pp ;
     	struct jjyunit		*up ;
     
    -	char	*pBuf, sLog [ 100 ] ;
    +	char	*pBuf, sLog [ MAX_LOGTEXT ] ;
     	int	iLen, i ;
     	int	rc, iWeekday ;
     	time_t	now ;
    @@ -3402,7 +3446,7 @@ teljjy_conn_data ( struct peer *peer, struct refclockproc *pp, struct jjyunit *u
     
     	char	*pBuf ;
     	int	iLen, rc ;
    -	char	sLog [ 80 ] ;
    +	char	sLog [ MAX_LOGTEXT ] ;
     	char	bAdjustment ;
     
     
    diff --git a/contrib/ntp/ntpd/refclock_nmea.c b/contrib/ntp/ntpd/refclock_nmea.c
    index 4fdadea61df..1d7997c6aaf 100644
    --- a/contrib/ntp/ntpd/refclock_nmea.c
    +++ b/contrib/ntp/ntpd/refclock_nmea.c
    @@ -289,7 +289,7 @@ static	int	nmea_start	(int, struct peer *);
     static	void	nmea_shutdown	(int, struct peer *);
     static	void	nmea_receive	(struct recvbuf *);
     static	void	nmea_poll	(int, struct peer *);
    -static	void	nmea_procrec	(struct peer *, l_fp);
    +static	void	nmea_procrec	(struct peer * const, l_fp);
     #ifdef HAVE_PPSAPI
     static	double	tabsdiffd	(l_fp, l_fp);
     static	void	nmea_control	(int, const struct refclockstat *,
    diff --git a/contrib/ntp/ntpd/refclock_palisade.c b/contrib/ntp/ntpd/refclock_palisade.c
    index e698d72cc52..cb68255d05b 100644
    --- a/contrib/ntp/ntpd/refclock_palisade.c
    +++ b/contrib/ntp/ntpd/refclock_palisade.c
    @@ -304,13 +304,13 @@ palisade_start (
     	int fd;
     	char gpsdev[20];
     	struct termios tio;
    +	u_int speed;
     
     	snprintf(gpsdev, sizeof(gpsdev), DEVICE, unit);
     
     	/*
     	 * Open serial port. 
     	 */
    -	u_int speed;
     	speed = (CLK_TYPE(peer) == CLK_COPERNICUS) ? SPEED232COP : SPEED232;
     	fd = refclock_open(gpsdev, speed, LDISC_RAW);
     	if (fd <= 0) {
    @@ -941,30 +941,32 @@ TSIP_decode (
     			return 0;
     		}
     		/* Get date & time from WN & ToW minus offset */
    -		TCivilDate cd;
    -		TGpsDatum wd;
    -		l_fp ugo; /* UTC-GPS offset, negative number */
    -		ugo.Ul_i.Xl_i = (int32_t)-GPS_UTC_Offset;
    -		ugo.l_uf = 0;
    -		wd = gpscal_from_gpsweek((wn % 1024), (int32_t)tow, ugo);
    -		gpscal_to_calendar(&cd, &wd);
    -		pp->year = cd.year;
    -		pp->day = cd.yearday;
    -		pp->hour = cd.hour;
    -		pp->minute = cd.minute;
    -		pp->second = cd.second;
    -		pp->nsec = 0;
    -		pp->leap = LEAP_NOWARNING;
    +		{
    +			TCivilDate cd;
    +			TGpsDatum wd;
    +			l_fp ugo; /* UTC-GPS offset, negative number */
    +			ugo.Ul_i.Xl_i = (int32_t)-GPS_UTC_Offset;
    +			ugo.l_uf = 0;
    +			wd = gpscal_from_gpsweek((wn % 1024), (int32_t)tow, ugo);
    +			gpscal_to_calendar(&cd, &wd);
    +			pp->year = cd.year;
    +			pp->day = cd.yearday;
    +			pp->hour = cd.hour;
    +			pp->minute = cd.minute;
    +			pp->second = cd.second;
    +			pp->nsec = 0;
    +			pp->leap = LEAP_NOWARNING;
     #ifdef DEBUG
    -		if (debug > 1)	{
    -			printf("GPS TOW: %ld\n", tow);
    -			printf("GPS WN: %d\n", wn);
    -			printf("GPS UTC-GPS Offset: %d\n", GPS_UTC_Offset);
    -			printf("TSIP_decode: unit %d: %02X #%d %02d:%02d:%02d.%09ld %02d/%02d/%04d ",
    -			       up->unit, mb(0) & 0xff, event, pp->hour, pp->minute, pp->second,
    -			       pp->nsec, cd.month, cd.monthday, pp->year);
    -		}
    +			if (debug > 1)	{
    +				printf("GPS TOW: %ld\n", tow);
    +				printf("GPS WN: %d\n", wn);
    +				printf("GPS UTC-GPS Offset: %d\n", GPS_UTC_Offset);
    +				printf("TSIP_decode: unit %d: %02X #%d %02d:%02d:%02d.%09ld %02d/%02d/%04d ",
    +				       up->unit, mb(0) & 0xff, event, pp->hour, pp->minute, pp->second,
    +				       pp->nsec, cd.month, cd.monthday, pp->year);
    +			}
     #endif
    +		}
     		return 1;
     	}
     
    diff --git a/contrib/ntp/ntpd/refclock_parse.c b/contrib/ntp/ntpd/refclock_parse.c
    index b4a65b80377..043bc8673c7 100644
    --- a/contrib/ntp/ntpd/refclock_parse.c
    +++ b/contrib/ntp/ntpd/refclock_parse.c
    @@ -2366,7 +2366,7 @@ local_input(
     			}
     			if (count)
     			{	/* simulate receive */
    -				buf = get_free_recv_buffer();
    +				buf = get_free_recv_buffer(TRUE);
     				if (buf != NULL) {
     					memmove((caddr_t)buf->recv_buffer,
     						(caddr_t)&parse->parseio.parse_dtime,
    diff --git a/contrib/ntp/ntpdate/ntpdate.c b/contrib/ntp/ntpdate/ntpdate.c
    index f6c5156ee20..fd48604c912 100644
    --- a/contrib/ntp/ntpdate/ntpdate.c
    +++ b/contrib/ntp/ntpdate/ntpdate.c
    @@ -1984,7 +1984,7 @@ input_handler(void)
     			continue;
     		}
     
    -		rb = get_free_recv_buffer();
    +		rb = get_free_recv_buffer(TRUE);
     
     		fromlen = sizeof(rb->recv_srcadr);
     		rb->recv_length = recvfrom(fdc, (char *)&rb->recv_pkt,
    @@ -2013,7 +2013,7 @@ l_adj_systime(
     	l_fp *ts
     	)
     {
    -	struct timeval adjtv, oadjtv;
    +	struct timeval adjtv;
     	int isneg = 0;
     	l_fp offset;
     #ifndef STEP_SLEW
    @@ -2053,6 +2053,7 @@ l_adj_systime(
     		/* A time correction needs to be applied. */
     #if !defined SYS_WINNT && !defined SYS_CYGWIN32
     		/* Slew the time on systems that support this. */
    +		struct timeval oadjtv;
     		if (adjtime(&adjtv, &oadjtv) < 0) {
     			msyslog(LOG_ERR, "Can't adjust the time of day: %m");
     			exit(1);
    diff --git a/contrib/ntp/ntpdc/invoke-ntpdc.texi b/contrib/ntp/ntpdc/invoke-ntpdc.texi
    index e0eadb7aac0..f37dfe572f7 100644
    --- a/contrib/ntp/ntpdc/invoke-ntpdc.texi
    +++ b/contrib/ntp/ntpdc/invoke-ntpdc.texi
    @@ -6,7 +6,7 @@
     #
     # EDIT THIS FILE WITH CAUTION  (invoke-ntpdc.texi)
     #
    -# It has been AutoGen-ed  March  3, 2020 at 05:41:11 PM by AutoGen 5.18.5
    +# It has been AutoGen-ed  June 23, 2020 at 02:20:45 AM by AutoGen 5.18.5
     # From the definitions    ntpdc-opts.def
     # and the template file   agtexi-cmd.tpl
     @end ignore
    @@ -76,7 +76,7 @@ with a status code of 0.
     
     @exampleindent 0
     @example
    -ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p14
    +ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p15
     Usage:  ntpdc [ - [] | --[@{=| @}] ]... [ host ...]
       Flg Arg Option-Name    Description
        -4 no  ipv4           Force IPv4 DNS name resolution
    diff --git a/contrib/ntp/ntpdc/ntpdc-opts.c b/contrib/ntp/ntpdc/ntpdc-opts.c
    index 88d04ea6028..b5eda1138aa 100644
    --- a/contrib/ntp/ntpdc/ntpdc-opts.c
    +++ b/contrib/ntp/ntpdc/ntpdc-opts.c
    @@ -1,7 +1,7 @@
     /*
      *  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.c)
      *
    - *  It has been AutoGen-ed  March  3, 2020 at 05:41:07 PM by AutoGen 5.18.5
    + *  It has been AutoGen-ed  June 23, 2020 at 02:20:41 AM by AutoGen 5.18.5
      *  From the definitions    ntpdc-opts.def
      *  and the template file   options
      *
    @@ -69,7 +69,7 @@ extern FILE * option_usage_fp;
      *  static const strings for ntpdc options
      */
     static char const ntpdc_opt_strs[1914] =
    -/*     0 */ "ntpdc 4.2.8p14\n"
    +/*     0 */ "ntpdc 4.2.8p15\n"
                 "Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n"
                 "This is free software. It is licensed for use, modification and\n"
                 "redistribution under the terms of the NTP License, copies of which\n"
    @@ -128,14 +128,14 @@ static char const ntpdc_opt_strs[1914] =
     /*  1695 */ "no-load-opts\0"
     /*  1708 */ "no\0"
     /*  1711 */ "NTPDC\0"
    -/*  1717 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p14\n"
    +/*  1717 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p15\n"
                 "Usage:  %s [ - [] | --[{=| }] ]... [ host ...]\n\0"
     /*  1848 */ "$HOME\0"
     /*  1854 */ ".\0"
     /*  1856 */ ".ntprc\0"
     /*  1863 */ "http://bugs.ntp.org, bugs@ntp.org\0"
     /*  1897 */ "\n\0"
    -/*  1899 */ "ntpdc 4.2.8p14";
    +/*  1899 */ "ntpdc 4.2.8p15";
     
     /**
      *  ipv4 option description with
    @@ -796,7 +796,7 @@ static void bogus_function(void) {
          translate option names.
        */
       /* referenced via ntpdcOptions.pzCopyright */
    -  puts(_("ntpdc 4.2.8p14\n\
    +  puts(_("ntpdc 4.2.8p15\n\
     Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n\
     This is free software. It is licensed for use, modification and\n\
     redistribution under the terms of the NTP License, copies of which\n\
    @@ -862,14 +862,14 @@ implied warranty.\n"));
       puts(_("load options from a config file"));
     
       /* referenced via ntpdcOptions.pzUsageTitle */
    -  puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p14\n\
    +  puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p15\n\
     Usage:  %s [ - [] | --[{=| }] ]... [ host ...]\n"));
     
       /* referenced via ntpdcOptions.pzExplain */
       puts(_("\n"));
     
       /* referenced via ntpdcOptions.pzFullVersion */
    -  puts(_("ntpdc 4.2.8p14"));
    +  puts(_("ntpdc 4.2.8p15"));
     
       /* referenced via ntpdcOptions.pzFullUsage */
       puts(_("<<>>"));
    diff --git a/contrib/ntp/ntpdc/ntpdc-opts.h b/contrib/ntp/ntpdc/ntpdc-opts.h
    index 36e736e8ec5..9c7659e4735 100644
    --- a/contrib/ntp/ntpdc/ntpdc-opts.h
    +++ b/contrib/ntp/ntpdc/ntpdc-opts.h
    @@ -1,7 +1,7 @@
     /*
      *  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.h)
      *
    - *  It has been AutoGen-ed  March  3, 2020 at 05:41:07 PM by AutoGen 5.18.5
    + *  It has been AutoGen-ed  June 23, 2020 at 02:20:41 AM by AutoGen 5.18.5
      *  From the definitions    ntpdc-opts.def
      *  and the template file   options
      *
    @@ -83,9 +83,9 @@ typedef enum {
     /** count of all options for ntpdc */
     #define OPTION_CT    15
     /** ntpdc version */
    -#define NTPDC_VERSION       "4.2.8p14"
    +#define NTPDC_VERSION       "4.2.8p15"
     /** Full ntpdc version text */
    -#define NTPDC_FULL_VERSION  "ntpdc 4.2.8p14"
    +#define NTPDC_FULL_VERSION  "ntpdc 4.2.8p15"
     
     /**
      *  Interface defines for all options.  Replace "n" with the UPPER_CASED
    diff --git a/contrib/ntp/ntpdc/ntpdc.1ntpdcman b/contrib/ntp/ntpdc/ntpdc.1ntpdcman
    index c7130610ead..7ac601fa4dc 100644
    --- a/contrib/ntp/ntpdc/ntpdc.1ntpdcman
    +++ b/contrib/ntp/ntpdc/ntpdc.1ntpdcman
    @@ -10,11 +10,11 @@
     .ds B-Font B
     .ds I-Font I
     .ds R-Font R
    -.TH ntpdc 1ntpdcman "03 Mar 2020" "4.2.8p14" "User Commands"
    +.TH ntpdc 1ntpdcman "23 Jun 2020" "4.2.8p15" "User Commands"
     .\"
     .\" EDIT THIS FILE WITH CAUTION (in-mem file)
     .\"
    -.\" It has been AutoGen-ed March 3, 2020 at 05:41:12 PM by AutoGen 5.18.5
    +.\" It has been AutoGen-ed June 23, 2020 at 02:20:47 AM by AutoGen 5.18.5
     .\" From the definitions ntpdc-opts.def
     .\" and the template file agman-cmd.tpl
     .SH NAME
    diff --git a/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc b/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
    index 6ec4135af24..59bd61373cc 100644
    --- a/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
    +++ b/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
    @@ -1,9 +1,9 @@
    -.Dd March 3 2020
    +.Dd June 23 2020
     .Dt NTPDC 1ntpdcmdoc User Commands
     .Os
     .\"  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.mdoc)
     .\"
    -.\"  It has been AutoGen-ed  March  3, 2020 at 05:41:10 PM by AutoGen 5.18.5
    +.\"  It has been AutoGen-ed  June 23, 2020 at 02:20:44 AM by AutoGen 5.18.5
     .\"  From the definitions    ntpdc-opts.def
     .\"  and the template file   agmdoc-cmd.tpl
     .Sh NAME
    diff --git a/contrib/ntp/ntpdc/ntpdc.html b/contrib/ntp/ntpdc/ntpdc.html
    index d5e7f069fd6..a0b953d9176 100644
    --- a/contrib/ntp/ntpdc/ntpdc.html
    +++ b/contrib/ntp/ntpdc/ntpdc.html
    @@ -64,7 +64,7 @@ display the time offset of the system clock relative to the server
     clock.  Run as root, it can correct the system clock to this offset as
     well.  It can be run as an interactive command or from a cron job.
     

    -

    This document applies to version 4.2.8p14 of ntpdc. +

    This document applies to version 4.2.8p15 of ntpdc.

    The program implements the SNTP protocol as defined by RFC 5905, the NTPv4 IETF specification. @@ -214,7 +214,7 @@ used to select the program, defaulting to more. Both will exit with a status code of 0.

    -
    ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p14
    +
    ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p15
     Usage:  ntpdc [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]
       Flg Arg Option-Name    Description
        -4 no  ipv4           Force IPv4 DNS name resolution
    diff --git a/contrib/ntp/ntpdc/ntpdc.man.in b/contrib/ntp/ntpdc/ntpdc.man.in
    index e03484df741..43b9138b768 100644
    --- a/contrib/ntp/ntpdc/ntpdc.man.in
    +++ b/contrib/ntp/ntpdc/ntpdc.man.in
    @@ -10,11 +10,11 @@
     .ds B-Font B
     .ds I-Font I
     .ds R-Font R
    -.TH ntpdc @NTPDC_MS@ "03 Mar 2020" "4.2.8p14" "User Commands"
    +.TH ntpdc @NTPDC_MS@ "23 Jun 2020" "4.2.8p15" "User Commands"
     .\"
     .\" EDIT THIS FILE WITH CAUTION (in-mem file)
     .\"
    -.\" It has been AutoGen-ed March 3, 2020 at 05:41:12 PM by AutoGen 5.18.5
    +.\" It has been AutoGen-ed June 23, 2020 at 02:20:47 AM by AutoGen 5.18.5
     .\" From the definitions ntpdc-opts.def
     .\" and the template file agman-cmd.tpl
     .SH NAME
    diff --git a/contrib/ntp/ntpdc/ntpdc.mdoc.in b/contrib/ntp/ntpdc/ntpdc.mdoc.in
    index 787b22a3e1e..349af271d18 100644
    --- a/contrib/ntp/ntpdc/ntpdc.mdoc.in
    +++ b/contrib/ntp/ntpdc/ntpdc.mdoc.in
    @@ -1,9 +1,9 @@
    -.Dd March 3 2020
    +.Dd June 23 2020
     .Dt NTPDC @NTPDC_MS@ User Commands
     .Os
     .\"  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.mdoc)
     .\"
    -.\"  It has been AutoGen-ed  March  3, 2020 at 05:41:10 PM by AutoGen 5.18.5
    +.\"  It has been AutoGen-ed  June 23, 2020 at 02:20:44 AM by AutoGen 5.18.5
     .\"  From the definitions    ntpdc-opts.def
     .\"  and the template file   agmdoc-cmd.tpl
     .Sh NAME
    diff --git a/contrib/ntp/ntpq/invoke-ntpq.texi b/contrib/ntp/ntpq/invoke-ntpq.texi
    index 4534bebed5d..040575a44b7 100644
    --- a/contrib/ntp/ntpq/invoke-ntpq.texi
    +++ b/contrib/ntp/ntpq/invoke-ntpq.texi
    @@ -6,7 +6,7 @@
     #
     # EDIT THIS FILE WITH CAUTION  (invoke-ntpq.texi)
     #
    -# It has been AutoGen-ed  March  3, 2020 at 05:41:21 PM by AutoGen 5.18.5
    +# It has been AutoGen-ed  June 23, 2020 at 02:20:55 AM by AutoGen 5.18.5
     # From the definitions    ntpq-opts.def
     # and the template file   agtexi-cmd.tpl
     @end ignore
    @@ -944,7 +944,7 @@ with a status code of 0.
     
     @exampleindent 0
     @example
    -ntpq - standard NTP query program - Ver. 4.2.8p14
    +ntpq - standard NTP query program - Ver. 4.2.8p15
     Usage:  ntpq [ - [] | --[@{=| @}] ]... [ host ...]
       Flg Arg Option-Name    Description
        -4 no  ipv4           Force IPv4 name resolution
    diff --git a/contrib/ntp/ntpq/ntpq-opts.c b/contrib/ntp/ntpq/ntpq-opts.c
    index 52a299d0138..ca08c3f0cfd 100644
    --- a/contrib/ntp/ntpq/ntpq-opts.c
    +++ b/contrib/ntp/ntpq/ntpq-opts.c
    @@ -1,7 +1,7 @@
     /*
      *  EDIT THIS FILE WITH CAUTION  (ntpq-opts.c)
      *
    - *  It has been AutoGen-ed  March  3, 2020 at 05:41:14 PM by AutoGen 5.18.5
    + *  It has been AutoGen-ed  June 23, 2020 at 02:20:48 AM by AutoGen 5.18.5
      *  From the definitions    ntpq-opts.def
      *  and the template file   options
      *
    @@ -69,7 +69,7 @@ extern FILE * option_usage_fp;
      *  static const strings for ntpq options
      */
     static char const ntpq_opt_strs[1977] =
    -/*     0 */ "ntpq 4.2.8p14\n"
    +/*     0 */ "ntpq 4.2.8p15\n"
                 "Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n"
                 "This is free software. It is licensed for use, modification and\n"
                 "redistribution under the terms of the NTP License, copies of which\n"
    @@ -132,13 +132,13 @@ static char const ntpq_opt_strs[1977] =
     /*  1768 */ "no-load-opts\0"
     /*  1781 */ "no\0"
     /*  1784 */ "NTPQ\0"
    -/*  1789 */ "ntpq - standard NTP query program - Ver. 4.2.8p14\n"
    +/*  1789 */ "ntpq - standard NTP query program - Ver. 4.2.8p15\n"
                 "Usage:  %s [ - [] | --[{=| }] ]... [ host ...]\n\0"
     /*  1909 */ "$HOME\0"
     /*  1915 */ ".\0"
     /*  1917 */ ".ntprc\0"
     /*  1924 */ "http://bugs.ntp.org, bugs@ntp.org\0"
    -/*  1958 */ "ntpq 4.2.8p14\0"
    +/*  1958 */ "ntpq 4.2.8p15\0"
     /*  1972 */ "hash";
     
     /**
    @@ -841,7 +841,7 @@ static void bogus_function(void) {
          translate option names.
        */
       /* referenced via ntpqOptions.pzCopyright */
    -  puts(_("ntpq 4.2.8p14\n\
    +  puts(_("ntpq 4.2.8p15\n\
     Copyright (C) 1992-2020 The University of Delaware and Network Time Foundation, all rights reserved.\n\
     This is free software. It is licensed for use, modification and\n\
     redistribution under the terms of the NTP License, copies of which\n\
    @@ -910,11 +910,11 @@ implied warranty.\n"));
       puts(_("load options from a config file"));
     
       /* referenced via ntpqOptions.pzUsageTitle */
    -  puts(_("ntpq - standard NTP query program - Ver. 4.2.8p14\n\
    +  puts(_("ntpq - standard NTP query program - Ver. 4.2.8p15\n\
     Usage:  %s [ - [] | --[{=| }] ]... [ host ...]\n"));
     
       /* referenced via ntpqOptions.pzFullVersion */
    -  puts(_("ntpq 4.2.8p14"));
    +  puts(_("ntpq 4.2.8p15"));
     
       /* referenced via ntpqOptions.pzFullUsage */
       puts(_("<<>>"));
    diff --git a/contrib/ntp/ntpq/ntpq-opts.h b/contrib/ntp/ntpq/ntpq-opts.h
    index dea113b4399..9bc23b8f0ec 100644
    --- a/contrib/ntp/ntpq/ntpq-opts.h
    +++ b/contrib/ntp/ntpq/ntpq-opts.h
    @@ -1,7 +1,7 @@
     /*
      *  EDIT THIS FILE WITH CAUTION  (ntpq-opts.h)
      *
    - *  It has been AutoGen-ed  March  3, 2020 at 05:41:14 PM by AutoGen 5.18.5
    + *  It has been AutoGen-ed  June 23, 2020 at 02:20:48 AM by AutoGen 5.18.5
      *  From the definitions    ntpq-opts.def
      *  and the template file   options
      *
    @@ -84,9 +84,9 @@ typedef enum {
     /** count of all options for ntpq */
     #define OPTION_CT    16
     /** ntpq version */
    -#define NTPQ_VERSION       "4.2.8p14"
    +#define NTPQ_VERSION       "4.2.8p15"
     /** Full ntpq version text */
    -#define NTPQ_FULL_VERSION  "ntpq 4.2.8p14"
    +#define NTPQ_FULL_VERSION  "ntpq 4.2.8p15"
     
     /**
      *  Interface defines for all options.  Replace "n" with the UPPER_CASED
    diff --git a/contrib/ntp/ntpq/ntpq.1ntpqman b/contrib/ntp/ntpq/ntpq.1ntpqman
    index 524bbfd1a5f..4723f9ff29e 100644
    --- a/contrib/ntp/ntpq/ntpq.1ntpqman
    +++ b/contrib/ntp/ntpq/ntpq.1ntpqman
    @@ -10,11 +10,11 @@
     .ds B-Font B
     .ds I-Font I
     .ds R-Font R
    -.TH ntpq 1ntpqman "03 Mar 2020" "4.2.8p14" "User Commands"
    +.TH ntpq 1ntpqman "23 Jun 2020" "4.2.8p15" "User Commands"
     .\"
     .\" EDIT THIS FILE WITH CAUTION (in-mem file)
     .\"
    -.\" It has been AutoGen-ed March 3, 2020 at 05:41:22 PM by AutoGen 5.18.5
    +.\" It has been AutoGen-ed June 23, 2020 at 02:20:56 AM by AutoGen 5.18.5
     .\" From the definitions ntpq-opts.def
     .\" and the template file agman-cmd.tpl
     .SH NAME
    diff --git a/contrib/ntp/ntpq/ntpq.1ntpqmdoc b/contrib/ntp/ntpq/ntpq.1ntpqmdoc
    index f64841c958b..4b21e393ed0 100644
    --- a/contrib/ntp/ntpq/ntpq.1ntpqmdoc
    +++ b/contrib/ntp/ntpq/ntpq.1ntpqmdoc
    @@ -1,9 +1,9 @@
    -.Dd March 3 2020
    +.Dd June 23 2020
     .Dt NTPQ 1ntpqmdoc User Commands
     .Os
     .\"  EDIT THIS FILE WITH CAUTION  (ntpq-opts.mdoc)
     .\"
    -.\"  It has been AutoGen-ed  March  3, 2020 at 05:41:19 PM by AutoGen 5.18.5
    +.\"  It has been AutoGen-ed  June 23, 2020 at 02:20:53 AM by AutoGen 5.18.5
     .\"  From the definitions    ntpq-opts.def
     .\"  and the template file   agmdoc-cmd.tpl
     .Sh NAME
    diff --git a/contrib/ntp/ntpq/ntpq.html b/contrib/ntp/ntpq/ntpq.html
    index 6122791cf74..7e1f7cad5fe 100644
    --- a/contrib/ntp/ntpq/ntpq.html
    +++ b/contrib/ntp/ntpq/ntpq.html
    @@ -73,7 +73,7 @@ monitor the operational status
     and determine the performance of
     ntpd, the NTP daemon.
     

    -

    This document applies to version 4.2.8p14 of ntpq. +

    This document applies to version 4.2.8p15 of ntpq.