diff --git a/COPYRIGHT b/COPYRIGHT
index 1775a64784a5..9c1a0f839358 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -4,16 +4,16 @@ This file is automatically generated from html/copyright.html
jpg "Clone me," says Dolly sheepishly.
- Last update: 9-Aug-2014 07:56 UTC
+ Last update: 17-Jan-2015 00:16 UTC
_________________________________________________________________
The following copyright notice applies to all files collectively
called the Network Time Protocol Version 4 Distribution. Unless
- specifically declared otherwise in an individual file, this notice
- applies as if the text was explicitly included in the file.
+ specifically declared otherwise in an individual file, this entire
+ notice applies as if the text was explicitly included in the file.
***********************************************************************
* *
-* Copyright (c) University of Delaware 1992-2014 *
+* Copyright (c) University of Delaware 1992-2015 *
* *
* Permission to use, copy, modify, and distribute this software and *
* its documentation for any purpose with or without fee is hereby *
@@ -27,6 +27,38 @@ This file is automatically generated from html/copyright.html
* purpose. It is provided "as is" without express or implied *
* warranty. *
* *
+***********************************************************************
+
+ Content starting in 2011 from Harlan Stenn, Danny Mayer, and Martin
+ Burnicki is:
+***********************************************************************
+* *
+* Copyright (c) Network Time Foundation 2011-2015 *
+* *
+* All Rights Reserved *
+* *
+* Redistribution and use in source and binary forms, with or without *
+* modification, are permitted provided that the following conditions *
+* are met: *
+* 1. Redistributions of source code must retain the above copyright *
+* notice, this list of conditions and the following disclaimer. *
+* 2. Redistributions in binary form must reproduce the above *
+* copyright notice, this list of conditions and the following *
+* disclaimer in the documentation and/or other materials provided *
+* with the distribution. *
+* *
+* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS *
+* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
+* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE *
+* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
+* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
+* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
+* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
+* DAMAGE. *
***********************************************************************
The following individuals contributed in part to the Network Time
diff --git a/ChangeLog b/ChangeLog
index 4d2ea91b0fac..400cf79340f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,76 @@
---
+(4.2.8p1) 2015/02/04 Released by Harlan Stenn
+
+* Update the NEWS file.
+* [Sec 2671] vallen in extension fields are not validated.
+---
+(4.2.8p1-RC2) 2015/01/29 Released by Harlan Stenn
+
+* [Bug 2627] shm refclock allows only two units with owner-only access
+ rework: reverted sense of mode bit (so default reflects previous
+ behaviour) and updated ducumentation.
+* [Bug 2732] - Leap second not handled correctly on Windows 8
+ use 'GetTickCount()' to get the true elapsed time of slew
+ (This should work for all versions of Windows >= W2K)
+* [Bug 2738] Missing buffer initialization in refclocK_parse.c::parsestate().
+* [Bug 2739] Parse driver with PPS enabled occasionally evaluates
+ PPS timestamp with wrong sign.
+ Removed some German umlauts.
+* [Bug 2740] Removed some obsolete code from the parse driver.
+* [Bug 2741] Incorrect buffer check in refclocK_parse.c::parsestatus().
+---
+(4.2.8p1-RC1) 2015/01/24 Released by Harlan Stenn
+
+* Start the RC for 4.2.8p1.
+* [Bug 2187] Update version number generation scripts.
+* [Bug 2617] Fix sntp Usage documentation section.
+* [Sec 2672] Code cleanup: On some OSes ::1 can be spoofed...
+* [Bug 2736] Show error message if we cannot open the config file.
+* Copyright update.
+* Fix the package name.
+---
+(4.2.8p1-beta5) 2015/01/07 Released by Harlan Stenn
+
+* [Bug 2695] Windows build: __func__ not supported under Windows.
+* [Bug 2728] Work around C99-style structure initialization code
+ for older compilers, specifically Visual Studio prior to VS2013.
+---
+(4.2.8p1-beta4) 2015/01/04 Released by Harlan Stenn
+
+* [Bug 1084] PPSAPI for ntpd on Windows with DLL backends
+* [Bug 2695] Build problem on Windows (sys/socket.h).
+* [Bug 2715] mdnstries option for ntp.conf from NetBSD.
+* Fix a regression introduced to timepps-Solaris.h as part of:
+ [Bug 1206] Required compiler changes for Windows
+ (4.2.5p181) 2009/06/06
+---
+(4.2.8p1-beta3) 2015/01/02 Released by Harlan Stenn
+
+* [Bug 2627] shm refclock allows only two units with owner-only access
+ Use mode bit 0 to select public access for units >= 2 (units 0 & 1 are
+ always private.
+* [Bug 2681] Fix display of certificate EOValidity dates on 32-bit systems.
+* [Bug 2695] 4.2.8 does not build on Windows.
+* [bug 2700] mrulist stopped working in 4.2.8.
+* [Bug 2706] libparse/info_trimble.c build dependencies are broken.
+* [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD.
+* [Bug 2714] libevent may need to be built independently of any build of sntp.
+* [Bug 2715] mdnstries option for ntp.conf from NetBSD.
+---
+(4.2.8p1-beta2) 2014/12/27 Released by Harlan Stenn
+
+* [Bug 2674] Install sntp in sbin on NetBSD.
+* [Bug 2693] ntp-keygen doesn't build without OpenSSL and sntp.
+* [Bug 2707] Avoid a C90 extension in libjsmn/jsmn.c.
+* [Bug 2709] see if we have a C99 compiler (not yet required).
+---
+(4.2.8p1-beta1) 2014/12/23 Released by Harlan Stenn
+
+* [Sec 2672] On some OSes ::1 can be spoofed, bypassing source IP ACLs.
+* [Bug 2693] ntp-keygen doesn't build without OpenSSL.
+* [Bug 2697] IN6_IS_ADDR_LOOPBACK build problems on some OSes.
+* [Bug 2699] HAVE_SYS_SELECT_H is misspelled in refclock_gpsdjson.c.
+---
(4.2.8) 2014/12/19 Released by Harlan Stenn
* [Sec 730] Increase RSA_generate_key modulus.
@@ -25,7 +97,7 @@
* [Bug 2314] Kernel PPS binding EOPNOTSUPP is a failure condition.
* Rename pps_enable to hardpps_enable.
(4.2.7p480) 2014/11/21 Released by Harlan Stenn
-* [Bug 2677] PATH_MAX isn't #define'd under Windows.
+* [Bug 2677] PATH_MAX isn't #define'd under Windows.
Regression from the patch fixing Bug 2639.
(4.2.7p479) 2014/11/15 Released by Harlan Stenn
* [Bug 2651] Certificates with ASN timestamps w/ 4-digit years mis-parsed.
diff --git a/CommitLog b/CommitLog
index fdf3f5e3ac9a..38097ac6ccfe 100644
--- a/CommitLog
+++ b/CommitLog
@@ -1,3 +1,3550 @@
+ChangeSet@1.3302, 2015-02-04 02:44:25-05:00, stenn@deacon.udel.edu
+ NTP_4_2_8P1
+ TAG: NTP_4_2_8P1
+
+ ChangeLog@1.1620 +1 -0
+ NTP_4_2_8P1
+
+ ntpd/invoke-ntp.conf.texi@1.177 +1 -1
+ NTP_4_2_8P1
+
+ ntpd/invoke-ntp.keys.texi@1.174 +1 -1
+ NTP_4_2_8P1
+
+ ntpd/invoke-ntpd.texi@1.490 +2 -2
+ NTP_4_2_8P1
+
+ ntpd/ntp.conf.5man@1.211 +3 -3
+ NTP_4_2_8P1
+
+ ntpd/ntp.conf.5mdoc@1.211 +2 -2
+ NTP_4_2_8P1
+
+ ntpd/ntp.conf.html@1.169 +1 -1
+ NTP_4_2_8P1
+
+ ntpd/ntp.conf.man.in@1.211 +3 -3
+ NTP_4_2_8P1
+
+ ntpd/ntp.conf.mdoc.in@1.211 +2 -2
+ NTP_4_2_8P1
+
+ ntpd/ntp.keys.5man@1.208 +2 -2
+ NTP_4_2_8P1
+
+ ntpd/ntp.keys.5mdoc@1.208 +2 -2
+ NTP_4_2_8P1
+
+ ntpd/ntp.keys.html@1.170 +1 -1
+ NTP_4_2_8P1
+
+ ntpd/ntp.keys.man.in@1.208 +2 -2
+ NTP_4_2_8P1
+
+ ntpd/ntp.keys.mdoc.in@1.208 +2 -2
+ NTP_4_2_8P1
+
+ ntpd/ntpd-opts.c@1.511 +239 -239
+ NTP_4_2_8P1
+
+ ntpd/ntpd-opts.h@1.510 +3 -3
+ NTP_4_2_8P1
+
+ ntpd/ntpd.1ntpdman@1.319 +3 -3
+ NTP_4_2_8P1
+
+ ntpd/ntpd.1ntpdmdoc@1.319 +2 -2
+ NTP_4_2_8P1
+
+ ntpd/ntpd.html@1.164 +2 -2
+ NTP_4_2_8P1
+
+ ntpd/ntpd.man.in@1.319 +3 -3
+ NTP_4_2_8P1
+
+ ntpd/ntpd.mdoc.in@1.319 +2 -2
+ NTP_4_2_8P1
+
+ ntpdc/invoke-ntpdc.texi@1.488 +2 -2
+ NTP_4_2_8P1
+
+ ntpdc/ntpdc-opts.c@1.506 +107 -107
+ NTP_4_2_8P1
+
+ ntpdc/ntpdc-opts.h@1.505 +3 -3
+ NTP_4_2_8P1
+
+ ntpdc/ntpdc.1ntpdcman@1.319 +3 -3
+ NTP_4_2_8P1
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.319 +2 -2
+ NTP_4_2_8P1
+
+ ntpdc/ntpdc.html@1.332 +2 -2
+ NTP_4_2_8P1
+
+ ntpdc/ntpdc.man.in@1.319 +3 -3
+ NTP_4_2_8P1
+
+ ntpdc/ntpdc.mdoc.in@1.319 +2 -2
+ NTP_4_2_8P1
+
+ ntpq/invoke-ntpq.texi@1.494 +2 -2
+ NTP_4_2_8P1
+
+ ntpq/ntpq-opts.c@1.511 +106 -106
+ NTP_4_2_8P1
+
+ ntpq/ntpq-opts.h@1.509 +3 -3
+ NTP_4_2_8P1
+
+ ntpq/ntpq.1ntpqman@1.322 +3 -3
+ NTP_4_2_8P1
+
+ ntpq/ntpq.1ntpqmdoc@1.322 +2 -2
+ NTP_4_2_8P1
+
+ ntpq/ntpq.html@1.161 +2 -2
+ NTP_4_2_8P1
+
+ ntpq/ntpq.man.in@1.322 +3 -3
+ NTP_4_2_8P1
+
+ ntpq/ntpq.mdoc.in@1.322 +2 -2
+ NTP_4_2_8P1
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.490 +2 -2
+ NTP_4_2_8P1
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.508 +68 -68
+ NTP_4_2_8P1
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.507 +3 -3
+ NTP_4_2_8P1
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.319 +3 -3
+ NTP_4_2_8P1
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.319 +2 -2
+ NTP_4_2_8P1
+
+ ntpsnmpd/ntpsnmpd.html@1.159 +1 -1
+ NTP_4_2_8P1
+
+ ntpsnmpd/ntpsnmpd.man.in@1.319 +3 -3
+ NTP_4_2_8P1
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.319 +2 -2
+ NTP_4_2_8P1
+
+ packageinfo.sh@1.503 +3 -3
+ NTP_4_2_8P1
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.80 +3 -3
+ NTP_4_2_8P1
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.81 +2 -2
+ NTP_4_2_8P1
+
+ scripts/calc_tickadj/calc_tickadj.html@1.82 +1 -1
+ NTP_4_2_8P1
+
+ scripts/calc_tickadj/calc_tickadj.man.in@1.79 +3 -3
+ NTP_4_2_8P1
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.81 +2 -2
+ NTP_4_2_8P1
+
+ scripts/calc_tickadj/invoke-calc_tickadj.texi@1.84 +1 -1
+ NTP_4_2_8P1
+
+ scripts/invoke-plot_summary.texi@1.101 +2 -2
+ NTP_4_2_8P1
+
+ scripts/invoke-summary.texi@1.101 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.311 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntp-wait/ntp-wait-opts@1.47 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitman@1.308 +3 -3
+ NTP_4_2_8P1
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.309 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntp-wait/ntp-wait.html@1.328 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntp-wait/ntp-wait.man.in@1.308 +3 -3
+ NTP_4_2_8P1
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.309 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntpsweep/invoke-ntpsweep.texi@1.99 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntpsweep/ntpsweep-opts@1.49 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepman@1.87 +3 -3
+ NTP_4_2_8P1
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.87 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntpsweep/ntpsweep.html@1.100 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntpsweep/ntpsweep.man.in@1.87 +3 -3
+ NTP_4_2_8P1
+
+ scripts/ntpsweep/ntpsweep.mdoc.in@1.88 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.100 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntptrace/ntptrace-opts@1.49 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntptrace/ntptrace.1ntptraceman@1.87 +3 -3
+ NTP_4_2_8P1
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.88 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntptrace/ntptrace.html@1.101 +2 -2
+ NTP_4_2_8P1
+
+ scripts/ntptrace/ntptrace.man.in@1.87 +3 -3
+ NTP_4_2_8P1
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.89 +2 -2
+ NTP_4_2_8P1
+
+ scripts/plot_summary-opts@1.49 +2 -2
+ NTP_4_2_8P1
+
+ scripts/plot_summary.1plot_summaryman@1.99 +3 -3
+ NTP_4_2_8P1
+
+ scripts/plot_summary.1plot_summarymdoc@1.99 +2 -2
+ NTP_4_2_8P1
+
+ scripts/plot_summary.html@1.102 +2 -2
+ NTP_4_2_8P1
+
+ scripts/plot_summary.man.in@1.99 +3 -3
+ NTP_4_2_8P1
+
+ scripts/plot_summary.mdoc.in@1.99 +2 -2
+ NTP_4_2_8P1
+
+ scripts/summary-opts@1.49 +2 -2
+ NTP_4_2_8P1
+
+ scripts/summary.1summaryman@1.99 +3 -3
+ NTP_4_2_8P1
+
+ scripts/summary.1summarymdoc@1.99 +2 -2
+ NTP_4_2_8P1
+
+ scripts/summary.html@1.102 +2 -2
+ NTP_4_2_8P1
+
+ scripts/summary.man.in@1.99 +3 -3
+ NTP_4_2_8P1
+
+ scripts/summary.mdoc.in@1.99 +2 -2
+ NTP_4_2_8P1
+
+ sntp/invoke-sntp.texi@1.487 +2 -2
+ NTP_4_2_8P1
+
+ sntp/sntp-opts.c@1.506 +159 -159
+ NTP_4_2_8P1
+
+ sntp/sntp-opts.h@1.504 +3 -3
+ NTP_4_2_8P1
+
+ sntp/sntp.1sntpman@1.322 +3 -3
+ NTP_4_2_8P1
+
+ sntp/sntp.1sntpmdoc@1.322 +2 -2
+ NTP_4_2_8P1
+
+ sntp/sntp.html@1.502 +2 -2
+ NTP_4_2_8P1
+
+ sntp/sntp.man.in@1.322 +3 -3
+ NTP_4_2_8P1
+
+ sntp/sntp.mdoc.in@1.322 +2 -2
+ NTP_4_2_8P1
+
+ util/invoke-ntp-keygen.texi@1.491 +2 -2
+ NTP_4_2_8P1
+
+ util/ntp-keygen-opts.c@1.509 +173 -173
+ NTP_4_2_8P1
+
+ util/ntp-keygen-opts.h@1.507 +3 -3
+ NTP_4_2_8P1
+
+ util/ntp-keygen.1ntp-keygenman@1.319 +3 -3
+ NTP_4_2_8P1
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.319 +2 -2
+ NTP_4_2_8P1
+
+ util/ntp-keygen.html@1.165 +2 -2
+ NTP_4_2_8P1
+
+ util/ntp-keygen.man.in@1.319 +3 -3
+ NTP_4_2_8P1
+
+ util/ntp-keygen.mdoc.in@1.319 +2 -2
+ NTP_4_2_8P1
+
+ChangeSet@1.3301, 2015-02-04 02:22:55-05:00, stenn@deacon.udel.edu
+ ntp-4.2.8p1
+
+ packageinfo.sh@1.502 +1 -1
+ ntp-4.2.8p1
+
+ChangeSet@1.3300, 2015-02-04 07:16:30+00:00, stenn@psp-deb1.ntp.org
+ Update the ChangeLog and NEWS files
+
+ ChangeLog@1.1619 +4 -1
+ Update the ChangeLog and NEWS files
+
+ NEWS@1.130 +60 -0
+ Update the ChangeLog and NEWS files
+
+ChangeSet@1.3292.1.20, 2015-01-29 19:14:37-05:00, stenn@deacon.udel.edu
+ NTP_4_2_8P1_RC2
+ TAG: NTP_4_2_8P1_RC2
+
+ ChangeLog@1.1613.1.18 +1 -0
+ NTP_4_2_8P1_RC2
+
+ ntpd/invoke-ntp.conf.texi@1.176 +1 -1
+ NTP_4_2_8P1_RC2
+
+ ntpd/invoke-ntp.keys.texi@1.173 +1 -1
+ NTP_4_2_8P1_RC2
+
+ ntpd/invoke-ntpd.texi@1.489 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntp.conf.5man@1.210 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntp.conf.5mdoc@1.210 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntp.conf.html@1.168 +1 -1
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntp.conf.man.in@1.210 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntp.conf.mdoc.in@1.210 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntp.keys.5man@1.207 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntp.keys.5mdoc@1.207 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntp.keys.html@1.169 +1 -1
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntp.keys.man.in@1.207 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntp.keys.mdoc.in@1.207 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntpd-opts.c@1.510 +7 -7
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntpd-opts.h@1.509 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntpd.1ntpdman@1.318 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntpd.1ntpdmdoc@1.318 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntpd.html@1.163 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntpd.man.in@1.318 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpd/ntpd.mdoc.in@1.318 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpdc/invoke-ntpdc.texi@1.487 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpdc/ntpdc-opts.c@1.505 +7 -7
+ NTP_4_2_8P1_RC2
+
+ ntpdc/ntpdc-opts.h@1.504 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpdc/ntpdc.1ntpdcman@1.318 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.318 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpdc/ntpdc.html@1.331 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpdc/ntpdc.man.in@1.318 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpdc/ntpdc.mdoc.in@1.318 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpq/invoke-ntpq.texi@1.493 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpq/ntpq-opts.c@1.510 +7 -7
+ NTP_4_2_8P1_RC2
+
+ ntpq/ntpq-opts.h@1.508 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpq/ntpq.1ntpqman@1.321 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpq/ntpq.1ntpqmdoc@1.321 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpq/ntpq.html@1.160 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpq/ntpq.man.in@1.321 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpq/ntpq.mdoc.in@1.321 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.489 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.507 +7 -7
+ NTP_4_2_8P1_RC2
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.506 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.318 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.318 +2 -2
+ NTP_4_2_8P1_RC2
+
+ ntpsnmpd/ntpsnmpd.html@1.158 +1 -1
+ NTP_4_2_8P1_RC2
+
+ ntpsnmpd/ntpsnmpd.man.in@1.318 +3 -3
+ NTP_4_2_8P1_RC2
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.318 +2 -2
+ NTP_4_2_8P1_RC2
+
+ packageinfo.sh@1.501 +1 -1
+ NTP_4_2_8P1_RC2
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.79 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.80 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/calc_tickadj/calc_tickadj.html@1.81 +1 -1
+ NTP_4_2_8P1_RC2
+
+ scripts/calc_tickadj/calc_tickadj.man.in@1.78 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.80 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/calc_tickadj/invoke-calc_tickadj.texi@1.83 +1 -1
+ NTP_4_2_8P1_RC2
+
+ scripts/invoke-plot_summary.texi@1.100 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/invoke-summary.texi@1.100 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.310 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntp-wait/ntp-wait-opts@1.46 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitman@1.307 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.308 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntp-wait/ntp-wait.html@1.327 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntp-wait/ntp-wait.man.in@1.307 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.308 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntpsweep/invoke-ntpsweep.texi@1.98 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntpsweep/ntpsweep-opts@1.48 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepman@1.86 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.86 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntpsweep/ntpsweep.html@1.99 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntpsweep/ntpsweep.man.in@1.86 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/ntpsweep/ntpsweep.mdoc.in@1.87 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.99 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntptrace/ntptrace-opts@1.48 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntptrace/ntptrace.1ntptraceman@1.86 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.87 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntptrace/ntptrace.html@1.100 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/ntptrace/ntptrace.man.in@1.86 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.88 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/plot_summary-opts@1.48 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/plot_summary.1plot_summaryman@1.98 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/plot_summary.1plot_summarymdoc@1.98 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/plot_summary.html@1.101 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/plot_summary.man.in@1.98 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/plot_summary.mdoc.in@1.98 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/summary-opts@1.48 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/summary.1summaryman@1.98 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/summary.1summarymdoc@1.98 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/summary.html@1.101 +2 -2
+ NTP_4_2_8P1_RC2
+
+ scripts/summary.man.in@1.98 +3 -3
+ NTP_4_2_8P1_RC2
+
+ scripts/summary.mdoc.in@1.98 +2 -2
+ NTP_4_2_8P1_RC2
+
+ sntp/invoke-sntp.texi@1.486 +2 -2
+ NTP_4_2_8P1_RC2
+
+ sntp/sntp-opts.c@1.505 +7 -7
+ NTP_4_2_8P1_RC2
+
+ sntp/sntp-opts.h@1.503 +3 -3
+ NTP_4_2_8P1_RC2
+
+ sntp/sntp.1sntpman@1.321 +3 -3
+ NTP_4_2_8P1_RC2
+
+ sntp/sntp.1sntpmdoc@1.321 +2 -2
+ NTP_4_2_8P1_RC2
+
+ sntp/sntp.html@1.501 +2 -2
+ NTP_4_2_8P1_RC2
+
+ sntp/sntp.man.in@1.321 +3 -3
+ NTP_4_2_8P1_RC2
+
+ sntp/sntp.mdoc.in@1.321 +2 -2
+ NTP_4_2_8P1_RC2
+
+ util/invoke-ntp-keygen.texi@1.490 +2 -2
+ NTP_4_2_8P1_RC2
+
+ util/ntp-keygen-opts.c@1.508 +7 -7
+ NTP_4_2_8P1_RC2
+
+ util/ntp-keygen-opts.h@1.506 +3 -3
+ NTP_4_2_8P1_RC2
+
+ util/ntp-keygen.1ntp-keygenman@1.318 +3 -3
+ NTP_4_2_8P1_RC2
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.318 +2 -2
+ NTP_4_2_8P1_RC2
+
+ util/ntp-keygen.html@1.164 +2 -2
+ NTP_4_2_8P1_RC2
+
+ util/ntp-keygen.man.in@1.318 +3 -3
+ NTP_4_2_8P1_RC2
+
+ util/ntp-keygen.mdoc.in@1.318 +2 -2
+ NTP_4_2_8P1_RC2
+
+ChangeSet@1.3292.5.2, 2015-01-29 00:34:07+00:00, stenn@psp-deb1.ntp.org
+ typo
+
+ ChangeLog@1.1613.5.2 +2 -0
+ typo
+
+ChangeSet@1.3292.4.3, 2015-01-29 00:23:57+00:00, stenn@psp-deb1.ntp.org
+ typos
+
+ ChangeLog@1.1613.4.3 +5 -3
+ typos
+
+ChangeSet@1.3292.4.2, 2015-01-28 23:39:54+01:00, martin@pc-martin.fritz.box
+ Bug 2741 - Incorrect buffer check in parsestatus()
+
+ ChangeLog@1.1613.4.2 +2 -1
+ Bug 2741 - Incorrect buffer check in parsestatus()
+
+ ntpd/refclock_parse.c@1.71 +1 -1
+ Bug 2741 - Incorrect buffer check in parsestatus()
+
+ChangeSet@1.3292.2.3, 2015-01-28 22:06:47+01:00, jnperlin@nemesis.localnet
+ [bug 2732] Bug 2732 - Leap second not handled correctly on Windows 8
+ Guard against slewing twice. Something weird is happening under Win8/8.1.
+
+ ports/winnt/ntpd/nt_clockstuff.c@1.64 +2 -2
+ [bug 2732] Bug 2732 - Leap second not handled correctly on Windows 8
+ Guard against slewing twice. Something weird is happening under Win8/8.1.
+
+ChangeSet@1.3292.5.1, 2015-01-28 17:04:07+01:00, martin@pc-martin.(none)
+ [Bug 2740] Removed some obsolete code from the parse driver.
+
+ ChangeLog@1.1613.5.1 +1 -0
+ [Bug 2740] Removed some obsolete code from the parse driver.
+
+ ntpd/refclock_parse.c@1.69.1.1 +1 -14
+ [Bug 2740] Removed some obsolete code from the parse driver, as discussed with Frank Kardel.
+
+ChangeSet@1.3292.4.1, 2015-01-27 16:33:33+01:00, martin@pc-martin.(none)
+ [Bug 2738] Missing buffer initialisation in parsestate().
+ [Bug 2739] Parse driver with PPS enabled occasionaly evaluates PPS timestamp with wrong sign.
+ Removed some German umlauts.
+
+ ChangeLog@1.1613.4.1 +4 -0
+ [Bug 2738] Missing buffer initialisation in parsestate().
+ [Bug 2739] Parse driver with PPS enabled occasionaly evaluates PPS timestamp with wrong sign.
+ Removed some German umlauts.
+
+
+ ntpd/refclock_parse.c@1.70 +3 -2
+ [Bug 2738] Missing buffer initialisation in parsestate().
+ [Bug 2739] Parse driver with PPS enabled occasionaly evaluates PPS timestamp with wrong sign.
+ Removed some German umlauts.
+
+ChangeSet@1.3292.1.16, 2015-01-27 00:26:25+01:00, jnperlin@hydra.(none)
+ * [Bug 2627] rework: reverted sense of mode bit (so default reflects previous behaviour) and updated ducumentation.
+
+ ChangeLog@1.1613.1.14 +4 -0
+ * [Bug 2627] rework: reverted sense of mode bit (so default reflects previous behaviour) and updated ducumentation.
+
+ html/drivers/driver28.html@1.18 +3 -2
+ * [Bug 2627] rework: updated documentation
+
+ ntpd/refclock_shm.c@1.31 +2 -7
+ * [Bug 2627] rework: reverted sense of mode bit (so default reflects previous behaviour).
+
+ChangeSet@1.3292.2.2, 2015-01-26 23:42:37+01:00, jnperlin@nemesis.localnet
+ [Bug 2732] - Leap second not handled correctly on Windows 8
+ use 'GetTickCount()' to get the true elapsed time of slew
+ (This should work for all versions of Windows >= W2K)
+
+ ChangeLog@1.1613.3.1 +4 -0
+ [Bug 2732] - Leap second not handled correctly on Windows 8
+ use 'GetTickCount()' to get the true elapsed time of slew
+ (This should work for all versions of Windows >= W2K)
+
+ ports/winnt/ntpd/nt_clockstuff.c@1.63 +1 -1
+ [Bug 2732] - Leap second not handled correctly on Windows 8
+ use 'GetTickCount()' to get the true elapsed time of slew
+ (This should work for all versions of Windows >= W2K)
+ Start 1.5 secs before schedule to minimise phase shift errors
+
+ChangeSet@1.3292.1.15, 2015-01-24 20:47:20-05:00, stenn@deacon.udel.edu
+ NTP_4_2_8P1_RC1
+ TAG: NTP_4_2_8P1_RC1
+
+ ChangeLog@1.1613.1.13 +1 -0
+ NTP_4_2_8P1_RC1
+
+ ntpd/invoke-ntp.conf.texi@1.175 +1 -1
+ NTP_4_2_8P1_RC1
+
+ ntpd/invoke-ntp.keys.texi@1.172 +1 -1
+ NTP_4_2_8P1_RC1
+
+ ntpd/invoke-ntpd.texi@1.488 +2 -2
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntp.conf.5man@1.209 +5 -5
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntp.conf.5mdoc@1.209 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntp.conf.html@1.167 +1 -1
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntp.conf.man.in@1.209 +5 -5
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntp.conf.mdoc.in@1.209 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntp.keys.5man@1.206 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntp.keys.5mdoc@1.206 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntp.keys.html@1.168 +1 -1
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntp.keys.man.in@1.206 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntp.keys.mdoc.in@1.206 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntpd-opts.c@1.509 +251 -249
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntpd-opts.h@1.508 +5 -5
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntpd.1ntpdman@1.317 +5 -5
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntpd.1ntpdmdoc@1.317 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntpd.html@1.162 +2 -2
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntpd.man.in@1.317 +5 -5
+ NTP_4_2_8P1_RC1
+
+ ntpd/ntpd.mdoc.in@1.317 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpdc/invoke-ntpdc.texi@1.486 +2 -2
+ NTP_4_2_8P1_RC1
+
+ ntpdc/ntpdc-opts.c@1.504 +119 -117
+ NTP_4_2_8P1_RC1
+
+ ntpdc/ntpdc-opts.h@1.503 +5 -5
+ NTP_4_2_8P1_RC1
+
+ ntpdc/ntpdc.1ntpdcman@1.317 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.317 +3 -3
+ NTP_4_2_8P1_RC1
+
+ ntpdc/ntpdc.html@1.330 +58 -88
+ NTP_4_2_8P1_RC1
+
+ ntpdc/ntpdc.man.in@1.317 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpdc/ntpdc.mdoc.in@1.317 +3 -3
+ NTP_4_2_8P1_RC1
+
+ ntpq/invoke-ntpq.texi@1.492 +2 -2
+ NTP_4_2_8P1_RC1
+
+ ntpq/ntpq-opts.c@1.509 +118 -116
+ NTP_4_2_8P1_RC1
+
+ ntpq/ntpq-opts.h@1.507 +5 -5
+ NTP_4_2_8P1_RC1
+
+ ntpq/ntpq.1ntpqman@1.320 +5 -5
+ NTP_4_2_8P1_RC1
+
+ ntpq/ntpq.1ntpqmdoc@1.320 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpq/ntpq.html@1.159 +2 -2
+ NTP_4_2_8P1_RC1
+
+ ntpq/ntpq.man.in@1.320 +5 -5
+ NTP_4_2_8P1_RC1
+
+ ntpq/ntpq.mdoc.in@1.320 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.488 +2 -2
+ NTP_4_2_8P1_RC1
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.506 +80 -78
+ NTP_4_2_8P1_RC1
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.505 +5 -5
+ NTP_4_2_8P1_RC1
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.317 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.317 +3 -3
+ NTP_4_2_8P1_RC1
+
+ ntpsnmpd/ntpsnmpd.html@1.157 +1 -1
+ NTP_4_2_8P1_RC1
+
+ ntpsnmpd/ntpsnmpd.man.in@1.317 +4 -4
+ NTP_4_2_8P1_RC1
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.317 +3 -3
+ NTP_4_2_8P1_RC1
+
+ packageinfo.sh@1.500 +1 -1
+ NTP_4_2_8P1_RC1
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.78 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.79 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/calc_tickadj/calc_tickadj.html@1.80 +1 -1
+ NTP_4_2_8P1_RC1
+
+ scripts/calc_tickadj/calc_tickadj.man.in@1.77 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.79 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/calc_tickadj/invoke-calc_tickadj.texi@1.82 +1 -1
+ NTP_4_2_8P1_RC1
+
+ scripts/invoke-plot_summary.texi@1.99 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/invoke-summary.texi@1.99 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.309 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntp-wait/ntp-wait-opts@1.45 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitman@1.306 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.307 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntp-wait/ntp-wait.html@1.326 +31 -49
+ NTP_4_2_8P1_RC1
+
+ scripts/ntp-wait/ntp-wait.man.in@1.306 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.307 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntpsweep/invoke-ntpsweep.texi@1.97 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntpsweep/ntpsweep-opts@1.47 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepman@1.85 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.85 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntpsweep/ntpsweep.html@1.98 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntpsweep/ntpsweep.man.in@1.85 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/ntpsweep/ntpsweep.mdoc.in@1.86 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.98 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntptrace/ntptrace-opts@1.47 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntptrace/ntptrace.1ntptraceman@1.85 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.86 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/ntptrace/ntptrace.html@1.99 +27 -36
+ NTP_4_2_8P1_RC1
+
+ scripts/ntptrace/ntptrace.man.in@1.85 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.87 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/plot_summary-opts@1.47 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/plot_summary.1plot_summaryman@1.97 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/plot_summary.1plot_summarymdoc@1.97 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/plot_summary.html@1.100 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/plot_summary.man.in@1.97 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/plot_summary.mdoc.in@1.97 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/summary-opts@1.47 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/summary.1summaryman@1.97 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/summary.1summarymdoc@1.97 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/summary.html@1.100 +2 -2
+ NTP_4_2_8P1_RC1
+
+ scripts/summary.man.in@1.97 +3 -3
+ NTP_4_2_8P1_RC1
+
+ scripts/summary.mdoc.in@1.97 +2 -2
+ NTP_4_2_8P1_RC1
+
+ sntp/invoke-sntp.texi@1.485 +5 -3
+ NTP_4_2_8P1_RC1
+
+ sntp/sntp-opts.c@1.504 +174 -170
+ NTP_4_2_8P1_RC1
+
+ sntp/sntp-opts.h@1.502 +5 -5
+ NTP_4_2_8P1_RC1
+
+ sntp/sntp.1sntpman@1.320 +24 -8
+ NTP_4_2_8P1_RC1
+
+ sntp/sntp.1sntpmdoc@1.320 +22 -7
+ NTP_4_2_8P1_RC1
+
+ sntp/sntp.html@1.500 +88 -120
+ NTP_4_2_8P1_RC1
+
+ sntp/sntp.man.in@1.320 +24 -8
+ NTP_4_2_8P1_RC1
+
+ sntp/sntp.mdoc.in@1.320 +22 -7
+ NTP_4_2_8P1_RC1
+
+ util/invoke-ntp-keygen.texi@1.489 +2 -2
+ NTP_4_2_8P1_RC1
+
+ util/ntp-keygen-opts.c@1.507 +185 -183
+ NTP_4_2_8P1_RC1
+
+ util/ntp-keygen-opts.h@1.505 +5 -5
+ NTP_4_2_8P1_RC1
+
+ util/ntp-keygen.1ntp-keygenman@1.317 +5 -5
+ NTP_4_2_8P1_RC1
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.317 +4 -4
+ NTP_4_2_8P1_RC1
+
+ util/ntp-keygen.html@1.163 +2 -2
+ NTP_4_2_8P1_RC1
+
+ util/ntp-keygen.man.in@1.317 +5 -5
+ NTP_4_2_8P1_RC1
+
+ util/ntp-keygen.mdoc.in@1.317 +4 -4
+ NTP_4_2_8P1_RC1
+
+ChangeSet@1.3292.1.14, 2015-01-24 10:44:12+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2736] Show error message if we cannot open the config file
+
+ ChangeLog@1.1613.1.12 +1 -0
+ [Bug 2736] Show error message if we cannot open the config file
+
+ ntpd/ntp_config.c@1.322 +2 -2
+ [Bug 2736] Show error message if we cannot open the config file
+
+ChangeSet@1.3292.1.12, 2015-01-24 04:02:10+00:00, stenn@psp-deb1.ntp.org
+ Copyright update
+
+ html/copyright.html@1.67 +2 -2
+ Copyright update
+
+ChangeSet@1.3292.1.11, 2015-01-24 03:09:26+00:00, stenn@psp-fb1.ntp.org
+ typo fix
+
+ sntp/include/ntp.lic@1.8 +1 -3
+ typo fix
+
+ChangeSet@1.3292.3.5, 2015-01-24 02:27:46+00:00, stenn@psp-fb1.ntp.org
+ Start the RC for 4.2.8p1
+
+ ChangeLog@1.1613.2.5 +1 -0
+
+ packageinfo.sh@1.499 +1 -1
+
+ChangeSet@1.3292.3.4, 2015-01-24 01:54:36+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2187] Update version number generation scripts
+
+ ChangeLog@1.1613.2.4 +1 -0
+ [Bug 2187] Update version number generation scripts
+
+ scripts/build/UpdatePoint@1.7 +12 -6
+ [Bug 2187] Update version number generation scripts
+
+ scripts/build/VersionName@1.9 +12 -3
+ [Bug 2187] Update version number generation scripts
+
+ChangeSet@1.3292.3.3, 2015-01-24 01:52:52+00:00, stenn@psp-fb1.ntp.org
+ Fix the package name
+
+ ChangeLog@1.1613.2.3 +1 -0
+ Fix the package name
+
+ configure.ac@1.579.1.1 +1 -1
+ Fix the package name
+
+ChangeSet@1.3292.3.2, 2015-01-23 10:29:31+00:00, stenn@psp-fb1.ntp.org
+ [Sec 2672] Code cleanup: On some OSes ::1 can be spoofed...
+
+ ChangeLog@1.1613.2.2 +1 -0
+ [Sec 2672] Code cleanup: On some OSes ::1 can be spoofed...
+
+ ntpd/ntp_io.c@1.399 +10 -12
+ [Sec 2672] Code cleanup: On some OSes ::1 can be spoofed...
+
+ChangeSet@1.3292.3.1, 2015-01-23 10:16:23+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2617] Fix sntp Usage documentation section
+
+ ChangeLog@1.1613.2.1 +3 -0
+ [Bug 2617] Fix sntp Usage documentation section
+
+ sntp/sntp-opts.def@1.46 +19 -4
+ [Bug 2617] Fix sntp Usage documentation section
+
+ChangeSet@1.3292.2.1, 2015-01-21 19:16:29+01:00, jnperlin@nemesis.localnet
+ [bug 2732] leapsecond processing buggy with win8
+
+ ports/winnt/ntpd/nt_clockstuff.c@1.62 +19 -14
+ [bug 2732] leapsecond processing buggy with win8
+
+ChangeSet@1.3281.1.3, 2015-01-14 10:52:55+00:00, stenn@psp-fb1.ntp.org
+ Copyright update
+
+ ChangeLog@1.1604.1.3 +1 -0
+ Copyright update
+
+ html/copyright.html@1.66 +35 -3
+ Copyright update
+
+ ntpd/invoke-ntp.conf.texi@1.170.1.1 +12 -2
+ update
+
+ ntpd/invoke-ntp.keys.texi@1.167.1.1 +12 -2
+ update
+
+ ntpd/invoke-ntpd.texi@1.483.1.1 +14 -4
+ update
+
+ ntpd/ntp.conf.5man@1.204.1.1 +15 -6
+ update
+
+ ntpd/ntp.conf.5mdoc@1.204.1.1 +14 -5
+ update
+
+ ntpd/ntp.conf.man.in@1.204.1.1 +15 -6
+ update
+
+ ntpd/ntp.conf.mdoc.in@1.204.1.1 +14 -5
+ update
+
+ ntpd/ntp.keys.5man@1.201.1.1 +14 -5
+ update
+
+ ntpd/ntp.keys.5mdoc@1.201.1.1 +15 -6
+ update
+
+ ntpd/ntp.keys.man.in@1.201.1.1 +14 -5
+ update
+
+ ntpd/ntp.keys.mdoc.in@1.201.1.1 +15 -6
+ update
+
+ ntpd/ntpd-opts.c@1.504.1.1 +240 -264
+ update
+
+ ntpd/ntpd-opts.h@1.503.1.1 +3 -11
+ update
+
+ ntpd/ntpd.1ntpdman@1.312.1.1 +15 -6
+ update
+
+ ntpd/ntpd.1ntpdmdoc@1.312.1.1 +14 -5
+ update
+
+ ntpd/ntpd.man.in@1.312.1.1 +15 -6
+ update
+
+ ntpd/ntpd.mdoc.in@1.312.1.1 +14 -5
+ update
+
+ ntpdc/invoke-ntpdc.texi@1.481.1.1 +12 -2
+ update
+
+ ntpdc/ntpdc-opts.c@1.499.1.1 +108 -132
+ update
+
+ ntpdc/ntpdc-opts.h@1.498.1.1 +3 -11
+ update
+
+ ntpdc/ntpdc.1ntpdcman@1.312.1.1 +14 -5
+ update
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.312.1.1 +13 -4
+ update
+
+ ntpdc/ntpdc.html@1.325.1.1 +86 -56
+ update
+
+ ntpdc/ntpdc.man.in@1.312.1.1 +14 -5
+ update
+
+ ntpdc/ntpdc.mdoc.in@1.312.1.1 +13 -4
+ update
+
+ ntpq/invoke-ntpq.texi@1.487.1.1 +12 -2
+ update
+
+ ntpq/ntpq-opts.c@1.504.1.1 +107 -131
+ update
+
+ ntpq/ntpq-opts.h@1.502.1.1 +3 -11
+ update
+
+ ntpq/ntpq.1ntpqman@1.315.1.1 +15 -6
+ update
+
+ ntpq/ntpq.1ntpqmdoc@1.315.1.1 +14 -5
+ update
+
+ ntpq/ntpq.man.in@1.315.1.1 +15 -6
+ update
+
+ ntpq/ntpq.mdoc.in@1.315.1.1 +14 -5
+ update
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.483.1.1 +12 -2
+ update
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.501.1.1 +69 -93
+ update
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.500.1.1 +3 -11
+ update
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.312.1.1 +14 -5
+ update
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.312.1.1 +13 -4
+ update
+
+ ntpsnmpd/ntpsnmpd.man.in@1.312.1.1 +14 -5
+ update
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.312.1.1 +13 -4
+ update
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.74.1.1 +2 -2
+ update
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.74.1.1 +2 -2
+ update
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.304.1.1 +1 -1
+ update
+
+ scripts/ntp-wait/ntp-wait-opts@1.40.1.1 +1 -1
+ update
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.302.1.1 +2 -2
+ update
+
+ scripts/ntp-wait/ntp-wait.html@1.321.1.1 +47 -29
+ update
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.302.1.1 +2 -2
+ update
+
+ scripts/ntpsweep/ntpsweep-opts@1.42.1.1 +1 -1
+ update
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.93.1.1 +1 -1
+ update
+
+ scripts/ntptrace/ntptrace-opts@1.42.1.1 +1 -1
+ update
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.81.1.1 +2 -2
+ update
+
+ scripts/ntptrace/ntptrace.html@1.94.1.1 +34 -25
+ update
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.82.1.1 +2 -2
+ update
+
+ scripts/plot_summary-opts@1.42.1.1 +1 -1
+ update
+
+ scripts/summary-opts@1.42.1.1 +1 -1
+ update
+
+ sntp/include/copyright.def@1.25 +2 -2
+ Copyright update
+
+ sntp/include/ntp.lic@1.7 +3 -1
+ Copyright update
+
+ sntp/invoke-sntp.texi@1.480.1.1 +12 -2
+ update
+
+ sntp/sntp-opts.c@1.498.1.1 +160 -184
+ update
+
+ sntp/sntp-opts.h@1.497.1.1 +3 -11
+ update
+
+ sntp/sntp.1sntpman@1.315.1.1 +14 -5
+ update
+
+ sntp/sntp.1sntpmdoc@1.315.1.1 +13 -4
+ update
+
+ sntp/sntp.html@1.495.1.1 +118 -84
+ update
+
+ sntp/sntp.man.in@1.315.1.1 +14 -5
+ update
+
+ sntp/sntp.mdoc.in@1.315.1.1 +13 -4
+ update
+
+ util/invoke-ntp-keygen.texi@1.484.1.1 +12 -2
+ update
+
+ util/ntp-keygen-opts.c@1.501.1.1 +174 -198
+ update
+
+ util/ntp-keygen-opts.h@1.500.1.1 +3 -11
+ update
+
+ util/ntp-keygen.1ntp-keygenman@1.312.1.1 +15 -6
+ update
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.312.1.1 +14 -5
+ update
+
+ util/ntp-keygen.man.in@1.312.1.1 +15 -6
+ update
+
+ util/ntp-keygen.mdoc.in@1.312.1.1 +14 -5
+ update
+
+ChangeSet@1.3292.1.8, 2015-01-07 03:05:51-05:00, stenn@deacon.udel.edu
+ NTP_4_2_8P1_BETA5
+ TAG: NTP_4_2_8P1_BETA5
+
+ ChangeLog@1.1613.1.8 +1 -0
+ NTP_4_2_8P1_BETA5
+
+ ntpd/invoke-ntp.conf.texi@1.173 +1 -1
+ NTP_4_2_8P1_BETA5
+
+ ntpd/invoke-ntp.keys.texi@1.170 +1 -1
+ NTP_4_2_8P1_BETA5
+
+ ntpd/invoke-ntpd.texi@1.486 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntp.conf.5man@1.207 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntp.conf.5mdoc@1.207 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntp.conf.html@1.166 +1 -1
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntp.conf.man.in@1.207 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntp.conf.mdoc.in@1.207 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntp.keys.5man@1.204 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntp.keys.5mdoc@1.204 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntp.keys.html@1.167 +1 -1
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntp.keys.man.in@1.204 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntp.keys.mdoc.in@1.204 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntpd-opts.c@1.507 +7 -7
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntpd-opts.h@1.506 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntpd.1ntpdman@1.315 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntpd.1ntpdmdoc@1.315 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntpd.html@1.161 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntpd.man.in@1.315 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpd/ntpd.mdoc.in@1.315 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpdc/invoke-ntpdc.texi@1.484 +26 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpdc/ntpdc-opts.c@1.502 +7 -7
+ NTP_4_2_8P1_BETA5
+
+ ntpdc/ntpdc-opts.h@1.501 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpdc/ntpdc.1ntpdcman@1.315 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.315 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpdc/ntpdc.html@1.328 +27 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpdc/ntpdc.man.in@1.315 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpdc/ntpdc.mdoc.in@1.315 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpq/invoke-ntpq.texi@1.490 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpq/ntpq-opts.c@1.507 +7 -7
+ NTP_4_2_8P1_BETA5
+
+ ntpq/ntpq-opts.h@1.505 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpq/ntpq.1ntpqman@1.318 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpq/ntpq.1ntpqmdoc@1.318 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpq/ntpq.html@1.158 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpq/ntpq.man.in@1.318 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpq/ntpq.mdoc.in@1.318 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.486 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.504 +7 -7
+ NTP_4_2_8P1_BETA5
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.503 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.315 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.315 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ ntpsnmpd/ntpsnmpd.html@1.156 +1 -1
+ NTP_4_2_8P1_BETA5
+
+ ntpsnmpd/ntpsnmpd.man.in@1.315 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.315 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ packageinfo.sh@1.498 +1 -1
+ NTP_4_2_8P1_BETA5
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.77 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.77 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/calc_tickadj/calc_tickadj.html@1.79 +1 -1
+ NTP_4_2_8P1_BETA5
+
+ scripts/calc_tickadj/calc_tickadj.man.in@1.76 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.77 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/calc_tickadj/invoke-calc_tickadj.texi@1.81 +1 -1
+ NTP_4_2_8P1_BETA5
+
+ scripts/invoke-plot_summary.texi@1.98 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/invoke-summary.texi@1.98 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.307 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntp-wait/ntp-wait-opts@1.43 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitman@1.305 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.305 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntp-wait/ntp-wait.html@1.324 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntp-wait/ntp-wait.man.in@1.305 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.305 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntpsweep/invoke-ntpsweep.texi@1.96 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntpsweep/ntpsweep-opts@1.45 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepman@1.84 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.84 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntpsweep/ntpsweep.html@1.97 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntpsweep/ntpsweep.man.in@1.84 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntpsweep/ntpsweep.mdoc.in@1.85 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.96 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntptrace/ntptrace-opts@1.45 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntptrace/ntptrace.1ntptraceman@1.84 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.84 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntptrace/ntptrace.html@1.97 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntptrace/ntptrace.man.in@1.84 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.85 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/plot_summary-opts@1.45 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/plot_summary.1plot_summaryman@1.96 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/plot_summary.1plot_summarymdoc@1.96 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/plot_summary.html@1.99 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/plot_summary.man.in@1.96 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/plot_summary.mdoc.in@1.96 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/summary-opts@1.45 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/summary.1summaryman@1.96 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/summary.1summarymdoc@1.96 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/summary.html@1.99 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ scripts/summary.man.in@1.96 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ scripts/summary.mdoc.in@1.96 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ sntp/invoke-sntp.texi@1.483 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ sntp/sntp-opts.c@1.502 +7 -7
+ NTP_4_2_8P1_BETA5
+
+ sntp/sntp-opts.h@1.500 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ sntp/sntp.1sntpman@1.318 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ sntp/sntp.1sntpmdoc@1.318 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ sntp/sntp.html@1.498 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ sntp/sntp.man.in@1.318 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ sntp/sntp.mdoc.in@1.318 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ util/invoke-ntp-keygen.texi@1.487 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ util/ntp-keygen-opts.c@1.505 +7 -7
+ NTP_4_2_8P1_BETA5
+
+ util/ntp-keygen-opts.h@1.503 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ util/ntp-keygen.1ntp-keygenman@1.315 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.315 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ util/ntp-keygen.html@1.162 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ util/ntp-keygen.man.in@1.315 +3 -3
+ NTP_4_2_8P1_BETA5
+
+ util/ntp-keygen.mdoc.in@1.315 +2 -2
+ NTP_4_2_8P1_BETA5
+
+ChangeSet@1.3292.1.7, 2015-01-07 07:35:11+00:00, burnicki@psp-deb1.ntp.org
+ cleanup
+
+ ChangeLog@1.1613.1.7 +2 -0
+ cleanup
+
+ChangeSet@1.3292.1.6, 2015-01-06 15:14:03+01:00, burnicki@pc-martin4.
+ [Bug 2728] Work around C99-style structure initialization code for older compilers, specifically Visual Studio prior to VS2013.
+
+ ChangeLog@1.1613.1.6 +2 -0
+ [Bug 2728] Work around C99-style structure initialization code for older compilers, specifically Visual Studio prior to VS2013.
+
+ ntpq/ntpq-subs.c@1.103 +5 -2
+ [Bug 2728] Fix for build environments where C99 style structure initialization is not supported.
+
+ ports/winnt/include/config.h@1.110 +1 -0
+ [Bug 2728] Define MISSING_C99_STYLE_INIT for VS versions prior to VS2013 to indicate C99-style structure initialization is not supported.
+
+ sntp/libopts/autoopts.h@1.20 +1 -1
+ [Bug 2728] Zero out whole structure, avoiding C99-style code zeroing out only specific fields.
+
+ sntp/libopts/enum.c@1.12 +1 -1
+ [Bug 2728] Zero out whole structure, avoiding C99-style code zeroing out only specific fields.
+
+ChangeSet@1.3292.1.5, 2015-01-06 14:29:51+01:00, burnicki@pc-martin4.
+ [Bug 2695] Windows build: __func__ not supported under Windows.
+
+ ChangeLog@1.1613.1.5 +1 -0
+ [Bug 2695] Windows build: __func__ not supported under Windows.
+
+ ports/winnt/include/config.h@1.109 +5 -1
+ [Bug 2695] Windows build: __func__ not supported under Windows.
+
+ChangeSet@1.3295, 2015-01-06 10:52:26+00:00, stenn@psp-deb1.ntp.org
+ Fix the package name
+
+ configure.ac@1.580 +1 -1
+ Fix the package name
+
+ChangeSet@1.3294, 2015-01-06 10:01:10+00:00, stenn@psp-deb1.ntp.org
+ [Sec 2671] vallen in extension fields are not validated
+
+ ntpd/ntp_crypto.c@1.173 +65 -35
+ [Sec 2671] vallen in extension fields are not validated
+
+ChangeSet@1.3292.1.4, 2015-01-04 06:17:14-05:00, stenn@deacon.udel.edu
+ NTP_4_2_8P1_BETA4
+ TAG: NTP_4_2_8P1_BETA4
+
+ ChangeLog@1.1613.1.4 +1 -0
+ NTP_4_2_8P1_BETA4
+
+ ntpd/invoke-ntp.conf.texi@1.172 +1 -1
+ NTP_4_2_8P1_BETA4
+
+ ntpd/invoke-ntp.keys.texi@1.169 +1 -1
+ NTP_4_2_8P1_BETA4
+
+ ntpd/invoke-ntpd.texi@1.485 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntp.conf.5man@1.206 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntp.conf.5mdoc@1.206 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntp.conf.html@1.165 +14 -1
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntp.conf.man.in@1.206 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntp.conf.mdoc.in@1.206 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntp.keys.5man@1.203 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntp.keys.5mdoc@1.203 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntp.keys.html@1.166 +1 -1
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntp.keys.man.in@1.203 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntp.keys.mdoc.in@1.203 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntpd-opts.c@1.506 +7 -7
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntpd-opts.h@1.505 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntpd.1ntpdman@1.314 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntpd.1ntpdmdoc@1.314 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntpd.html@1.160 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntpd.man.in@1.314 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpd/ntpd.mdoc.in@1.314 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpdc/invoke-ntpdc.texi@1.483 +2 -26
+ NTP_4_2_8P1_BETA4
+
+ ntpdc/ntpdc-opts.c@1.501 +7 -7
+ NTP_4_2_8P1_BETA4
+
+ ntpdc/ntpdc-opts.h@1.500 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpdc/ntpdc.1ntpdcman@1.314 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.314 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpdc/ntpdc.html@1.327 +2 -27
+ NTP_4_2_8P1_BETA4
+
+ ntpdc/ntpdc.man.in@1.314 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpdc/ntpdc.mdoc.in@1.314 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpq/invoke-ntpq.texi@1.489 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpq/ntpq-opts.c@1.506 +7 -7
+ NTP_4_2_8P1_BETA4
+
+ ntpq/ntpq-opts.h@1.504 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpq/ntpq.1ntpqman@1.317 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpq/ntpq.1ntpqmdoc@1.317 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpq/ntpq.html@1.157 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpq/ntpq.man.in@1.317 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpq/ntpq.mdoc.in@1.317 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.485 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.503 +7 -7
+ NTP_4_2_8P1_BETA4
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.502 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.314 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.314 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ ntpsnmpd/ntpsnmpd.html@1.155 +1 -1
+ NTP_4_2_8P1_BETA4
+
+ ntpsnmpd/ntpsnmpd.man.in@1.314 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.314 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ packageinfo.sh@1.497 +1 -1
+ NTP_4_2_8P1_BETA4
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.76 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.76 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/calc_tickadj/calc_tickadj.html@1.78 +1 -1
+ NTP_4_2_8P1_BETA4
+
+ scripts/calc_tickadj/calc_tickadj.man.in@1.75 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.76 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/calc_tickadj/invoke-calc_tickadj.texi@1.80 +1 -1
+ NTP_4_2_8P1_BETA4
+
+ scripts/invoke-plot_summary.texi@1.97 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/invoke-summary.texi@1.97 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.306 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntp-wait/ntp-wait-opts@1.42 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitman@1.304 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.304 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntp-wait/ntp-wait.html@1.323 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntp-wait/ntp-wait.man.in@1.304 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.304 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntpsweep/invoke-ntpsweep.texi@1.95 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntpsweep/ntpsweep-opts@1.44 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepman@1.83 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.83 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntpsweep/ntpsweep.html@1.96 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntpsweep/ntpsweep.man.in@1.83 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntpsweep/ntpsweep.mdoc.in@1.84 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.95 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntptrace/ntptrace-opts@1.44 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntptrace/ntptrace.1ntptraceman@1.83 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.83 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntptrace/ntptrace.html@1.96 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntptrace/ntptrace.man.in@1.83 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.84 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/plot_summary-opts@1.44 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/plot_summary.1plot_summaryman@1.95 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/plot_summary.1plot_summarymdoc@1.95 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/plot_summary.html@1.98 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/plot_summary.man.in@1.95 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/plot_summary.mdoc.in@1.95 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/summary-opts@1.44 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/summary.1summaryman@1.95 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/summary.1summarymdoc@1.95 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/summary.html@1.98 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ scripts/summary.man.in@1.95 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ scripts/summary.mdoc.in@1.95 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ sntp/invoke-sntp.texi@1.482 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ sntp/sntp-opts.c@1.501 +7 -7
+ NTP_4_2_8P1_BETA4
+
+ sntp/sntp-opts.h@1.499 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ sntp/sntp.1sntpman@1.317 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ sntp/sntp.1sntpmdoc@1.317 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ sntp/sntp.html@1.497 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ sntp/sntp.man.in@1.317 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ sntp/sntp.mdoc.in@1.317 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ util/invoke-ntp-keygen.texi@1.486 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ util/ntp-keygen-opts.c@1.504 +7 -7
+ NTP_4_2_8P1_BETA4
+
+ util/ntp-keygen-opts.h@1.502 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ util/ntp-keygen.1ntp-keygenman@1.314 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.314 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ util/ntp-keygen.html@1.161 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ util/ntp-keygen.man.in@1.314 +3 -3
+ NTP_4_2_8P1_BETA4
+
+ util/ntp-keygen.mdoc.in@1.314 +2 -2
+ NTP_4_2_8P1_BETA4
+
+ChangeSet@1.3292.1.3, 2015-01-04 04:48:35-05:00, stenn@deacon.udel.edu
+ Fix a regression introduced to timepps-Solaris.h
+
+ ChangeLog@1.1613.1.3 +4 -0
+ Fix a regression introduced to timepps-Solaris.h
+
+ include/timepps-Solaris.h@1.8 +1 -1
+ Fix a regression introduced to timepps-Solaris.h
+
+ChangeSet@1.3292.1.2, 2015-01-04 09:08:36+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2695] Build problem on Windows (sys/socket.h)
+
+ ChangeLog@1.1613.1.2 +4 -3
+ [Bug 2695] Build problem on Windows (sys/socket.h)
+
+ ntpd/refclock_nmea.c@1.77 +2 -0
+ [Bug 2695] Build problem on Windows (sys/socket.h)
+
+ChangeSet@1.3292.1.1, 2015-01-04 00:20:52+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ ChangeLog@1.1613.1.1 +3 -0
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ ntpd/keyword-gen-utd@1.21 +1 -1
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ ntpd/ntp_keyword.h@1.23 +596 -587
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ ntpd/ntp_parser.c@1.89 +1006 -1001
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ ntpd/ntp_parser.h@1.55 +202 -200
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ChangeSet@1.3293, 2015-01-03 10:33:57+00:00, stenn@psp-deb1.ntp.org
+ [Sec 2671] vallen in extension fields are not validated
+
+ ChangeLog@1.1614 +3 -0
+ [Sec 2671] vallen in extension fields are not validated
+
+ ntpd/ntp_crypto.c@1.172 +19 -12
+ [Sec 2671] vallen in extension fields are not validated
+
+ChangeSet@1.3292, 2015-01-02 23:07:47-05:00, stenn@deacon.udel.edu
+ NTP_4_2_8P1_BETA3
+ TAG: NTP_4_2_8P1_BETA3
+
+ ChangeLog@1.1613 +1 -0
+ NTP_4_2_8P1_BETA3
+
+ ntpd/invoke-ntp.conf.texi@1.171 +15 -1
+ NTP_4_2_8P1_BETA3
+
+ ntpd/invoke-ntp.keys.texi@1.168 +1 -1
+ NTP_4_2_8P1_BETA3
+
+ ntpd/invoke-ntpd.texi@1.484 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntp.conf.5man@1.205 +18 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntp.conf.5mdoc@1.205 +16 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntp.conf.html@1.164 +1 -1
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntp.conf.man.in@1.205 +18 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntp.conf.mdoc.in@1.205 +16 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntp.keys.5man@1.202 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntp.keys.5mdoc@1.202 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntp.keys.html@1.165 +1 -1
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntp.keys.man.in@1.202 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntp.keys.mdoc.in@1.202 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntpd-opts.c@1.505 +7 -7
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntpd-opts.h@1.504 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntpd.1ntpdman@1.313 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntpd.1ntpdmdoc@1.313 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntpd.html@1.159 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntpd.man.in@1.313 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpd/ntpd.mdoc.in@1.313 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpdc/invoke-ntpdc.texi@1.482 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpdc/ntpdc-opts.c@1.500 +7 -7
+ NTP_4_2_8P1_BETA3
+
+ ntpdc/ntpdc-opts.h@1.499 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpdc/ntpdc.1ntpdcman@1.313 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.313 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpdc/ntpdc.html@1.326 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpdc/ntpdc.man.in@1.313 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpdc/ntpdc.mdoc.in@1.313 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpq/invoke-ntpq.texi@1.488 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpq/ntpq-opts.c@1.505 +7 -7
+ NTP_4_2_8P1_BETA3
+
+ ntpq/ntpq-opts.h@1.503 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpq/ntpq.1ntpqman@1.316 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpq/ntpq.1ntpqmdoc@1.316 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpq/ntpq.html@1.156 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpq/ntpq.man.in@1.316 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpq/ntpq.mdoc.in@1.316 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.484 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.502 +7 -7
+ NTP_4_2_8P1_BETA3
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.501 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.313 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.313 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ ntpsnmpd/ntpsnmpd.html@1.154 +1 -1
+ NTP_4_2_8P1_BETA3
+
+ ntpsnmpd/ntpsnmpd.man.in@1.313 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.313 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ packageinfo.sh@1.496 +1 -1
+ NTP_4_2_8P1_BETA3
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.75 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.75 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/calc_tickadj/calc_tickadj.html@1.77 +1 -1
+ NTP_4_2_8P1_BETA3
+
+ scripts/calc_tickadj/calc_tickadj.man.in@1.74 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.75 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/calc_tickadj/invoke-calc_tickadj.texi@1.79 +1 -1
+ NTP_4_2_8P1_BETA3
+
+ scripts/invoke-plot_summary.texi@1.96 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/invoke-summary.texi@1.96 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.305 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntp-wait/ntp-wait-opts@1.41 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitman@1.303 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.303 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntp-wait/ntp-wait.html@1.322 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntp-wait/ntp-wait.man.in@1.303 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.303 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntpsweep/invoke-ntpsweep.texi@1.94 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntpsweep/ntpsweep-opts@1.43 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepman@1.82 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.82 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntpsweep/ntpsweep.html@1.95 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntpsweep/ntpsweep.man.in@1.82 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntpsweep/ntpsweep.mdoc.in@1.83 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.94 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntptrace/ntptrace-opts@1.43 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntptrace/ntptrace.1ntptraceman@1.82 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.82 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntptrace/ntptrace.html@1.95 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntptrace/ntptrace.man.in@1.82 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.83 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/plot_summary-opts@1.43 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/plot_summary.1plot_summaryman@1.94 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/plot_summary.1plot_summarymdoc@1.94 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/plot_summary.html@1.97 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/plot_summary.man.in@1.94 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/plot_summary.mdoc.in@1.94 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/summary-opts@1.43 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/summary.1summaryman@1.94 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/summary.1summarymdoc@1.94 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/summary.html@1.97 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ scripts/summary.man.in@1.94 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ scripts/summary.mdoc.in@1.94 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ sntp/invoke-sntp.texi@1.481 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ sntp/sntp-opts.c@1.500 +9 -9
+ NTP_4_2_8P1_BETA3
+
+ sntp/sntp-opts.h@1.498 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ sntp/sntp.1sntpman@1.316 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ sntp/sntp.1sntpmdoc@1.316 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ sntp/sntp.html@1.496 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ sntp/sntp.man.in@1.316 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ sntp/sntp.mdoc.in@1.316 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ util/invoke-ntp-keygen.texi@1.485 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ util/ntp-keygen-opts.c@1.503 +9 -9
+ NTP_4_2_8P1_BETA3
+
+ util/ntp-keygen-opts.h@1.501 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ util/ntp-keygen.1ntp-keygenman@1.313 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.313 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ util/ntp-keygen.html@1.160 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ util/ntp-keygen.man.in@1.313 +3 -3
+ NTP_4_2_8P1_BETA3
+
+ util/ntp-keygen.mdoc.in@1.313 +2 -2
+ NTP_4_2_8P1_BETA3
+
+ChangeSet@1.3281.3.3, 2015-01-02 17:37:39+01:00, jnperlin@hydra.(none)
+ [Bug 2627] changelog file syntax
+
+ ChangeLog@1.1604.3.2 +1 -0
+ [Bug 2627] changelog file syntax
+
+ChangeSet@1.3281.3.2, 2015-01-02 17:23:21+01:00, jnperlin@nemesis.localnet
+ [Bug 2627] sidekick: avoid runtime conversion trap on MSVC builds
+
+ ntpd/ntp_leapsec.c@1.13.1.1 +2 -1
+ [Bug 2627] sidekick: avoid runtime conversion trap on MSVC builds
+
+ChangeSet@1.3273.1.1, 2015-01-02 13:45:05+01:00, jnperlin@hydra.(none)
+ [Bug 2627] shm refclock allows only two units with owner-only access
+
+ ChangeLog@1.1597.1.1 +3 -0
+ [Bug 2627] shm refclock allows only two units with owner-only access
+
+ html/drivers/driver28.html@1.17 +122 -17
+ [Bug 2627] shm refclock allows only two units with owner-only access
+ update docu
+
+ ntpd/refclock_shm.c@1.30 +111 -114
+ [Bug 2627] shm refclock allows only two units with owner-only access
+ use mode bit 0 to select public access for units >= 2 (default is private for all now)
+
+ChangeSet@1.3288, 2015-01-02 07:59:13+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/Makefile.am@1.132 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_loopfilter.c@1.176 +44 -8
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/m4/hms_search_lib.m4@1.2 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/m4/ntp_libntp.m4@1.28 +6 -0
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ChangeSet@1.3281.1.2, 2015-01-01 07:31:57+00:00, stenn@psp-deb1.ntp.org
+ [Bug 2681] Fix display of certificate EOValidity dates on 32-bit systems
+
+ ChangeLog@1.1604.1.2 +1 -0
+ [Bug 2681] Fix display of certificate EOValidity dates on 32-bit systems
+
+ ntpd/ntp_control.c@1.192.2.1 +28 -4
+ [Bug 2681] Fix display of certificate EOValidity dates on 32-bit systems
+
+ChangeSet@1.3281.2.2, 2014-12-30 05:48:04-05:00, murray@pogo.udel.edu
+ ChangeLog:
+ add --- to top of ChangeLog
+
+ ChangeLog@1.1604.2.2 +1 -1
+ add --- to top of ChangeLog
+
+ChangeSet@1.3281.2.1, 2014-12-30 04:55:11-05:00, murray@pogo.udel.edu
+ ChangeLog, ntp_control.c:
+ Fix for bug 2700
+
+ ChangeLog@1.1604.2.1 +2 -0
+ Fix for bug 2700
+
+ ntpd/ntp_control.c@1.192.1.1 +4 -1
+ Fix for bug 2700
+
+ChangeSet@1.3287, 2014-12-30 01:28:39+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ html/confopt.html@1.63 +3 -1
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ ntpd/ntp.conf.def@1.14 +14 -0
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ChangeSet@1.3286, 2014-12-30 00:29:47+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_wwvb.c@1.35 +1 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ChangeSet@1.3285, 2014-12-30 00:28:06+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ ChangeLog@1.1609 +1 -0
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ ntpd/keyword-gen.c@1.26 +2 -1
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ ntpd/ntp_config.c@1.321 +29 -13
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ ntpd/ntp_parser.y@1.82 +3 -0
+ [Bug 2715] mdnstries option for ntp.conf from NetBSD
+
+ChangeSet@1.3278.1.1, 2014-12-29 08:47:40+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2695] 4.2.8 does not build on Windows
+
+ ChangeLog@1.1601.1.1 +1 -0
+ [Bug 2695] 4.2.8 does not build on Windows
+
+ ports/winnt/include/config.h@1.108 +1 -0
+ [Bug 2695] 4.2.8 does not build on Windows
+
+ ports/winnt/vs2008/libntp/libntp.vcproj@1.51 +6 -2
+ [Bug 2695] 4.2.8 does not build on Windows
+
+ ports/winnt/vs2013/libntp/libntp.vcxproj@1.5 +1 -0
+ [Bug 2695] 4.2.8 does not build on Windows
+
+ChangeSet@1.3284, 2014-12-29 06:57:50+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2714] libevent may need to be built independently of any build of sntp
+
+ ChangeLog@1.1608 +1 -0
+ [Bug 2714] libevent may need to be built independently of any build of sntp
+
+ sntp/Makefile.am@1.78 +7 -7
+ [Bug 2714] libevent may need to be built independently of any build of sntp
+
+ChangeSet@1.3283, 2014-12-29 06:42:07+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2706] libparse/info_trimble.c build dependencies are broken
+
+ ChangeLog@1.1607 +1 -0
+ [Bug 2706] libparse/info_trimble.c build dependencies are broken
+
+ libparse/Makefile.am@1.31 +30 -2
+ [Bug 2706] libparse/info_trimble.c build dependencies are broken
+
+ libparse/info_trimble.c@1.6 +2 -2
+ [Bug 2706] libparse/info_trimble.c build dependencies are broken
+
+ libparse/mkinfo_rcmd.sed@1.4 +1 -1
+ [Bug 2706] libparse/info_trimble.c build dependencies are broken
+
+ libparse/mkinfo_scmd.sed@1.4 +1 -1
+ [Bug 2706] libparse/info_trimble.c build dependencies are broken
+
+ChangeSet@1.3282, 2014-12-29 06:39:40+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ChangeLog@1.1606 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ChangeLog@1.1605 +3 -0
+ [Bug 2713] variable type/cast cleanup from NetBSD
+
+ include/audio.h@1.8 +1 -1
+ [Bug 2713] variable type/cast cleanup from NetBSD
+
+ include/icom.h@1.6 +1 -1
+ [Bug 2713] variable type/cast cleanup from NetBSD
+
+ include/ntp_config.h@1.82 +3 -2
+ [Bug 2713] variable type/cast cleanup from NetBSD
+
+ include/ntp_filegen.h@1.11 +1 -1
+ [Bug 2713] variable type/cast cleanup from NetBSD
+
+ include/ntp_stdlib.h@1.77 +5 -5
+ [Bug 2713] variable type/cast cleanup from NetBSD
+
+ include/ntpd.h@1.184 +3 -3
+ [Bug 2713] variable type/cast cleanup from NetBSD
+
+ lib/isc/backtrace.c@1.2 +4 -4
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ lib/isc/event.c@1.2 +1 -3
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ lib/isc/include/isc/backtrace.h@1.2 +2 -2
+ [Bug 2713] variable type/cast, parameter name cleanup from NetBSD
+
+ lib/isc/include/isc/socket.h@1.3 +7 -7
+ [Bug 2713] variable type/cast, parameter name cleanup from NetBSD
+
+ lib/isc/log.c@1.7 +2 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ lib/isc/netaddr.c@1.13 +2 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ lib/isc/sockaddr.c@1.12 +8 -4
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ lib/isc/unix/ifiter_getifaddrs.c@1.13 +7 -3
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libjsmn/jsmn.c@1.3 +3 -3
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/atoint.c@1.4 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/atolfp.c@1.5 +5 -5
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/atouint.c@1.5 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/audio.c@1.35 +12 -12
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/authkeys.c@1.25 +1 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/authreadkeys.c@1.20 +4 -4
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/emalloc.c@1.17 +2 -0
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/hextoint.c@1.5 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/hextolfp.c@1.4 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/humandate.c@1.12 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/icom.c@1.18 +1 -3
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/modetoa.c@1.6 +3 -3
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/mstolfp.c@1.4 +5 -5
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/ntp_calendar.c@1.14 +5 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/ntp_crypto_rnd.c@1.3 +4 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/ntp_intres.c@1.98 +2 -17
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/ntp_lineedit.c@1.12 +6 -7
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/octtoint.c@1.4 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/prettydate.c@1.19 +7 -7
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/ssl_init.c@1.17 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libntp/timetoa.c@1.5 +3 -6
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libparse/clk_meinberg.c@1.11 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libparse/clk_rawdcf.c@1.17 +10 -10
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ libparse/data_mbg.c@1.12 +3 -3
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_control.c@1.193 +60 -62
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_crypto.c@1.171 +8 -10
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_filegen.c@1.25 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_io.c@1.398 +63 -30
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_leapsec.c@1.14 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_proto.c@1.353 +13 -14
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_request.c@1.113 +8 -9
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_restrict.c@1.36 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_scanner.c@1.46 +14 -14
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntp_util.c@1.116 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/ntpd.c@1.158 +6 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_acts.c@1.54 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_arc.c@1.32 +3 -3
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_chu.c@1.56 +0 -4
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_gpsdjson.c@1.16 +6 -6
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_heath.c@1.19 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_irig.c@1.37 +1 -3
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_jjy.c@1.26 +22 -23
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_jupiter.c@1.29 +54 -55
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_neoclock4x.c@1.23 +7 -7
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_nmea.c@1.76 +7 -6
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_oncore.c@1.102 +80 -80
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_parse.c@1.69 +228 -214
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_pcf.c@1.13 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_true.c@1.23 +1 -0
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_wwv.c@1.79 +3 -3
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpd/refclock_wwvb.c@1.34 +2 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpdate/ntpdate.c@1.93 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpdc/ntpdc.c@1.102 +42 -30
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpdc/ntpdc.h@1.11 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpdc/ntpdc_ops.c@1.80 +6 -6
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpq/ntpq-subs.c@1.102 +103 -107
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpq/ntpq.c@1.154 +43 -32
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpq/ntpq.h@1.29 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpsnmpd/netsnmp_daemonize.c@1.5 +1 -0
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ ntpsnmpd/ntp_snmp.h@1.2 +3 -0
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/crypto.c@1.18 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/autoopts.h@1.19 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/autoopts/options.h@1.29 +9 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/configfile.c@1.22 +6 -6
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/enum.c@1.11 +5 -5
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/file.c@1.15 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/find.c@1.11 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/init.c@1.7 +5 -8
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/load.c@1.20 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/makeshell.c@1.19 +8 -8
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/nested.c@1.15 +7 -7
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/numeric.c@1.14 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/parse-duration.c@1.13 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/pgusage.c@1.17 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/reset.c@1.16 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/save.c@1.17 +10 -10
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/tokenize.c@1.12 +1 -1
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/libopts/usage.c@1.20 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/main.c@1.94 +7 -6
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/networking.c@1.65 +16 -7
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ sntp/sntp-opts.c@1.499 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ util/jitter.h@1.4 +3 -3
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ util/ntp-keygen-opts.c@1.502 +2 -2
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ util/ntp-keygen.c@1.100 +26 -25
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ util/ntptime.c@1.25 +5 -4
+ [Bug 2713] variable type/cast, parameter name, general cleanup from NetBSD
+
+ChangeSet@1.3281, 2014-12-27 06:33:35-05:00, stenn@deacon.udel.edu
+ NTP_4_2_8P1_BETA2
+ TAG: NTP_4_2_8P1_BETA2
+
+ ChangeLog@1.1604 +1 -0
+ NTP_4_2_8P1_BETA2
+
+ ntpd/invoke-ntp.conf.texi@1.170 +1 -1
+ NTP_4_2_8P1_BETA2
+
+ ntpd/invoke-ntp.keys.texi@1.167 +1 -1
+ NTP_4_2_8P1_BETA2
+
+ ntpd/invoke-ntpd.texi@1.483 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntp.conf.5man@1.204 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntp.conf.5mdoc@1.204 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntp.conf.html@1.163 +1 -1
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntp.conf.man.in@1.204 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntp.conf.mdoc.in@1.204 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntp.keys.5man@1.201 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntp.keys.5mdoc@1.201 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntp.keys.html@1.164 +1 -1
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntp.keys.man.in@1.201 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntp.keys.mdoc.in@1.201 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntpd-opts.c@1.504 +7 -7
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntpd-opts.h@1.503 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntpd.1ntpdman@1.312 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntpd.1ntpdmdoc@1.312 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntpd.html@1.158 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntpd.man.in@1.312 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpd/ntpd.mdoc.in@1.312 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpdc/invoke-ntpdc.texi@1.481 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpdc/ntpdc-opts.c@1.499 +7 -7
+ NTP_4_2_8P1_BETA2
+
+ ntpdc/ntpdc-opts.h@1.498 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpdc/ntpdc.1ntpdcman@1.312 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.312 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpdc/ntpdc.html@1.325 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpdc/ntpdc.man.in@1.312 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpdc/ntpdc.mdoc.in@1.312 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpq/invoke-ntpq.texi@1.487 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpq/ntpq-opts.c@1.504 +7 -7
+ NTP_4_2_8P1_BETA2
+
+ ntpq/ntpq-opts.h@1.502 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpq/ntpq.1ntpqman@1.315 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpq/ntpq.1ntpqmdoc@1.315 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpq/ntpq.html@1.155 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpq/ntpq.man.in@1.315 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpq/ntpq.mdoc.in@1.315 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.483 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.501 +7 -7
+ NTP_4_2_8P1_BETA2
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.500 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.312 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.312 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ ntpsnmpd/ntpsnmpd.html@1.153 +1 -1
+ NTP_4_2_8P1_BETA2
+
+ ntpsnmpd/ntpsnmpd.man.in@1.312 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.312 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ packageinfo.sh@1.495 +1 -1
+ NTP_4_2_8P1_BETA2
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.74 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.74 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/calc_tickadj/calc_tickadj.html@1.76 +1 -1
+ NTP_4_2_8P1_BETA2
+
+ scripts/calc_tickadj/calc_tickadj.man.in@1.73 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.74 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/calc_tickadj/invoke-calc_tickadj.texi@1.78 +1 -1
+ NTP_4_2_8P1_BETA2
+
+ scripts/invoke-plot_summary.texi@1.95 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/invoke-summary.texi@1.95 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.304 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntp-wait/ntp-wait-opts@1.40 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitman@1.302 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.302 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntp-wait/ntp-wait.html@1.321 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntp-wait/ntp-wait.man.in@1.302 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.302 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntpsweep/invoke-ntpsweep.texi@1.93 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntpsweep/ntpsweep-opts@1.42 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepman@1.81 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.81 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntpsweep/ntpsweep.html@1.94 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntpsweep/ntpsweep.man.in@1.81 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntpsweep/ntpsweep.mdoc.in@1.82 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.93 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntptrace/ntptrace-opts@1.42 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntptrace/ntptrace.1ntptraceman@1.81 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.81 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntptrace/ntptrace.html@1.94 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntptrace/ntptrace.man.in@1.81 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.82 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/plot_summary-opts@1.42 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/plot_summary.1plot_summaryman@1.93 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/plot_summary.1plot_summarymdoc@1.93 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/plot_summary.html@1.96 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/plot_summary.man.in@1.93 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/plot_summary.mdoc.in@1.93 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/summary-opts@1.42 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/summary.1summaryman@1.93 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/summary.1summarymdoc@1.93 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/summary.html@1.96 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ scripts/summary.man.in@1.93 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ scripts/summary.mdoc.in@1.93 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ sntp/invoke-sntp.texi@1.480 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ sntp/sntp-opts.c@1.498 +7 -7
+ NTP_4_2_8P1_BETA2
+
+ sntp/sntp-opts.h@1.497 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ sntp/sntp.1sntpman@1.315 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ sntp/sntp.1sntpmdoc@1.315 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ sntp/sntp.html@1.495 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ sntp/sntp.man.in@1.315 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ sntp/sntp.mdoc.in@1.315 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ util/invoke-ntp-keygen.texi@1.484 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ util/ntp-keygen-opts.c@1.501 +7 -7
+ NTP_4_2_8P1_BETA2
+
+ util/ntp-keygen-opts.h@1.500 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ util/ntp-keygen.1ntp-keygenman@1.312 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.312 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ util/ntp-keygen.html@1.159 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ util/ntp-keygen.man.in@1.312 +3 -3
+ NTP_4_2_8P1_BETA2
+
+ util/ntp-keygen.mdoc.in@1.312 +2 -2
+ NTP_4_2_8P1_BETA2
+
+ChangeSet@1.3280, 2014-12-26 22:21:06-05:00, stenn@deacon.udel.edu
+ [Bug 2674] Install sntp in sbin on NetBSD
+
+ ChangeLog@1.1603 +1 -0
+ [Bug 2674] Install sntp in sbin on NetBSD
+
+ sntp/loc/netbsd@1.3 +1 -1
+ [Bug 2674] Install sntp in sbin on NetBSD
+
+ChangeSet@1.3279, 2014-12-26 22:11:56-05:00, stenn@deacon.udel.edu
+ [Bug 2707] Avoid a C90 extension in libjsmn/jsmn.c
+
+ ChangeLog@1.1602 +1 -0
+ [Bug 2707] Avoid a C90 extension in libjsmn/jsmn.c
+
+ libjsmn/jsmn.c@1.2 +2 -1
+ [Bug 2707] Avoid a C90 extension in libjsmn/jsmn.c
+
+ChangeSet@1.3278, 2014-12-26 23:56:33+00:00, stenn@psp-deb1.ntp.org
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL and sntp
+
+ ChangeLog@1.1601 +1 -0
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL and sntp
+
+ sntp/Makefile.am@1.77 +5 -4
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL and sntp
+
+ChangeSet@1.3277, 2014-12-26 23:50:15+00:00, stenn@psp-deb1.ntp.org
+ [Bug 2709] see if we have a C99 compiler (not yet required)
+
+ ChangeLog@1.1600 +1 -1
+ [Bug 2709] see if we have a C99 compiler (not yet required)
+
+ChangeSet@1.3276, 2014-12-26 23:48:57+00:00, stenn@psp-deb1.ntp.org
+ build: see if we have a C99 compiler (not yet required)
+
+ ChangeLog@1.1599 +3 -0
+ build: see if we have a C99 compiler (not yet required)
+
+ sntp/m4/ntp_compiler.m4@1.5 +1 -0
+ build: see if we have a C99 compiler (not yet required)
+
+ChangeSet@1.3275, 2014-12-23 16:59:55-05:00, stenn@deacon.udel.edu
+ NTP_4_2_8P1_BETA1
+ TAG: NTP_4_2_8P1_BETA1
+
+ ChangeLog@1.1598 +1 -0
+ NTP_4_2_8P1_BETA1
+
+ ntpd/invoke-ntp.conf.texi@1.169 +1 -1
+ NTP_4_2_8P1_BETA1
+
+ ntpd/invoke-ntp.keys.texi@1.166 +1 -1
+ NTP_4_2_8P1_BETA1
+
+ ntpd/invoke-ntpd.texi@1.482 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntp.conf.5man@1.203 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntp.conf.5mdoc@1.203 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntp.conf.html@1.162 +1 -1
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntp.conf.man.in@1.203 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntp.conf.mdoc.in@1.203 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntp.keys.5man@1.200 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntp.keys.5mdoc@1.200 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntp.keys.html@1.163 +1 -1
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntp.keys.man.in@1.200 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntp.keys.mdoc.in@1.200 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntpd-opts.c@1.503 +239 -239
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntpd-opts.h@1.502 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntpd.1ntpdman@1.311 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntpd.1ntpdmdoc@1.311 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntpd.html@1.157 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntpd.man.in@1.311 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpd/ntpd.mdoc.in@1.311 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpdc/invoke-ntpdc.texi@1.480 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpdc/ntpdc-opts.c@1.498 +107 -107
+ NTP_4_2_8P1_BETA1
+
+ ntpdc/ntpdc-opts.h@1.497 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpdc/ntpdc.1ntpdcman@1.311 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.311 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpdc/ntpdc.html@1.324 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpdc/ntpdc.man.in@1.311 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpdc/ntpdc.mdoc.in@1.311 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpq/invoke-ntpq.texi@1.486 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpq/ntpq-opts.c@1.503 +106 -106
+ NTP_4_2_8P1_BETA1
+
+ ntpq/ntpq-opts.h@1.501 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpq/ntpq.1ntpqman@1.314 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpq/ntpq.1ntpqmdoc@1.314 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpq/ntpq.html@1.154 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpq/ntpq.man.in@1.314 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpq/ntpq.mdoc.in@1.314 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.482 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.500 +68 -68
+ NTP_4_2_8P1_BETA1
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.499 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.311 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.311 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ ntpsnmpd/ntpsnmpd.html@1.152 +1 -1
+ NTP_4_2_8P1_BETA1
+
+ ntpsnmpd/ntpsnmpd.man.in@1.311 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.311 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ packageinfo.sh@1.494 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.73 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.73 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/calc_tickadj/calc_tickadj.html@1.75 +1 -1
+ NTP_4_2_8P1_BETA1
+
+ scripts/calc_tickadj/calc_tickadj.man.in@1.72 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.73 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/calc_tickadj/invoke-calc_tickadj.texi@1.77 +1 -1
+ NTP_4_2_8P1_BETA1
+
+ scripts/invoke-plot_summary.texi@1.94 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/invoke-summary.texi@1.94 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.303 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntp-wait/ntp-wait-opts@1.39 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitman@1.301 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.301 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntp-wait/ntp-wait.html@1.320 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntp-wait/ntp-wait.man.in@1.301 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.301 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntpsweep/invoke-ntpsweep.texi@1.92 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntpsweep/ntpsweep-opts@1.41 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepman@1.80 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.80 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntpsweep/ntpsweep.html@1.93 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntpsweep/ntpsweep.man.in@1.80 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntpsweep/ntpsweep.mdoc.in@1.81 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.92 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntptrace/ntptrace-opts@1.41 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntptrace/ntptrace.1ntptraceman@1.80 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.80 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntptrace/ntptrace.html@1.93 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntptrace/ntptrace.man.in@1.80 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.81 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/plot_summary-opts@1.41 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/plot_summary.1plot_summaryman@1.92 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/plot_summary.1plot_summarymdoc@1.92 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/plot_summary.html@1.95 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/plot_summary.man.in@1.92 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/plot_summary.mdoc.in@1.92 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/summary-opts@1.41 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/summary.1summaryman@1.92 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/summary.1summarymdoc@1.92 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/summary.html@1.95 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ scripts/summary.man.in@1.92 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ scripts/summary.mdoc.in@1.92 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ sntp/invoke-sntp.texi@1.479 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ sntp/sntp-opts.c@1.497 +159 -159
+ NTP_4_2_8P1_BETA1
+
+ sntp/sntp-opts.h@1.496 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ sntp/sntp.1sntpman@1.314 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ sntp/sntp.1sntpmdoc@1.314 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ sntp/sntp.html@1.494 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ sntp/sntp.man.in@1.314 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ sntp/sntp.mdoc.in@1.314 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ util/invoke-ntp-keygen.texi@1.483 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ util/ntp-keygen-opts.c@1.500 +173 -173
+ NTP_4_2_8P1_BETA1
+
+ util/ntp-keygen-opts.h@1.499 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ util/ntp-keygen.1ntp-keygenman@1.311 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.311 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ util/ntp-keygen.html@1.158 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ util/ntp-keygen.man.in@1.311 +3 -3
+ NTP_4_2_8P1_BETA1
+
+ util/ntp-keygen.mdoc.in@1.311 +2 -2
+ NTP_4_2_8P1_BETA1
+
+ChangeSet@1.3274, 2014-12-23 21:36:47+00:00, stenn@psp-deb1.ntp.org
+ Disable config.cache-* files for now
+
+ build@1.49 +5 -1
+ Disable config.cache-* files for now
+
+ChangeSet@1.3273, 2014-12-23 04:34:37+00:00, stenn@psp-deb1.ntp.org
+ Update cvo.sh for new CentOS version format
+
+ sntp/scripts/cvo.sh@1.8 +7 -1
+ Update cvo.sh for new CentOS version format
+
+ChangeSet@1.3272, 2014-12-22 05:59:33+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL
+
+ ChangeLog@1.1597 +2 -1
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL
+
+ Makefile.am@1.124 +3 -2
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL
+
+ configure.ac@1.579 +5 -1
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL
+
+ libntp/ntp_crypto_rnd.c@1.2 +15 -0
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL
+
+ sntp/configure.ac@1.77 +8 -5
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL
+
+ sntp/m4/ntp_libevent.m4@1.12 +23 -2
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL
+
+ util/Makefile.am@1.77 +1 -0
+ [Bug 2693] ntp-keygen doesn't build without OpenSSL
+
+ChangeSet@1.3271, 2014-12-22 05:51:47+00:00, stenn@psp-fb1.ntp.org
+ [Bug 2699] IN6_IS_ADDR_LOOPBACK build problems on some OSes
+
+ ChangeLog@1.1596 +1 -0
+ [Bug 2699] IN6_IS_ADDR_LOOPBACK build problems on some OSes
+
+ChangeSet@1.3270, 2014-12-22 02:55:14+00:00, stenn@psp-deb1.ntp.org
+ [Bug 2699] HAVE_SYS_SELECT_H is misspelled in refclock_gpsdjson.c
+
+ ChangeLog@1.1595 +3 -0
+ [Bug 2699] HAVE_SYS_SELECT_H is misspelled in refclock_gpsdjson.c
+
+ ntpd/refclock_gpsdjson.c@1.15 +1 -1
+ [Bug 2699] HAVE_SYS_SELECT_H is misspelled in refclock_gpsdjson.c
+
+ChangeSet@1.3269, 2014-12-22 02:52:42+00:00, stenn@psp-deb1.ntp.org
+ NEWS file update
+
+ NEWS@1.129 +39 -12
+
+ChangeSet@1.3268, 2014-12-21 01:24:15+00:00, stenn@psp-deb1.ntp.org
+ [Sec 2672] On some OSes ::1 can be spoofed, bypassing source IP ACLs
+
+ ChangeLog@1.1594 +1 -0
+ [Sec 2672] On some OSes ::1 can be spoofed, bypassing source IP ACLs
+
+ ntpd/ntp_io.c@1.397 +4 -6
+ [Sec 2672] On some OSes ::1 can be spoofed, bypassing source IP ACLs
+
+ChangeSet@1.3267, 2014-12-21 00:35:39+00:00, stenn@psp-deb1.ntp.org
+ typo
+
+ build@1.48 +1 -1
+ typo
+
ChangeSet@1.3266, 2014-12-19 07:53:07-05:00, stenn@deacon.udel.edu
NTP_4_2_8
TAG: NTP_4_2_8
diff --git a/Makefile.am b/Makefile.am
index 2908f96cd037..fc76719f0428 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,10 @@ ACLOCAL_AMFLAGS = -I sntp/m4 -I sntp/libevent/m4 -I sntp/libopts/m4
NULL =
+# moved sntp first to get libtool and libevent built.
+
SUBDIRS = \
+ sntp \
scripts \
include \
libntp \
@@ -17,7 +20,6 @@ SUBDIRS = \
clockstuff \
kernel \
util \
- sntp \
tests \
$(NULL)
@@ -64,7 +66,6 @@ BUILT_SOURCES = \
.gcc-warning \
libtool \
html/.datecheck \
- sntp/built-sources-only \
$(srcdir)/COPYRIGHT \
$(srcdir)/.checkChangeLog \
$(NULL)
diff --git a/Makefile.in b/Makefile.in
index 4746db9c93b3..abd5a09463b8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -171,6 +171,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -205,7 +206,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
@@ -404,7 +407,10 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I sntp/m4 -I sntp/libevent/m4 -I sntp/libopts/m4
NULL =
+
+# moved sntp first to get libtool and libevent built.
SUBDIRS = \
+ sntp \
scripts \
include \
libntp \
@@ -419,7 +425,6 @@ SUBDIRS = \
clockstuff \
kernel \
util \
- sntp \
tests \
$(NULL)
@@ -465,7 +470,6 @@ BUILT_SOURCES = \
.gcc-warning \
libtool \
html/.datecheck \
- sntp/built-sources-only \
$(srcdir)/COPYRIGHT \
$(srcdir)/.checkChangeLog \
$(NULL)
diff --git a/NEWS b/NEWS
index efd488f302b3..d33f059985e4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,63 @@
+---
+NTP 4.2.8p1 (Harlan Stenn , 2015/02/04)
+
+Focus: Security and Bug fixes, enhancements.
+
+Severity: HIGH
+
+In addition to bug fixes and enhancements, this release fixes the
+following high-severity vulnerabilities:
+
+* vallen is not validated in several places in ntp_crypto.c, leading
+ to a potential information leak or possibly a crash
+
+ References: Sec 2671 / CVE-2014-9297 / VU#852879
+ Affects: All NTP4 releases before 4.2.8p1 that are running autokey.
+ CVSS: (AV:N/AC:L/Au:N/C:P/I:P/A:P) Base Score: 7.5
+ Date Resolved: Stable (4.2.8p1) 04 Feb 2015
+ Summary: The vallen packet value is not validated in several code
+ paths in ntp_crypto.c which can lead to information leakage
+ or perhaps a crash of the ntpd process.
+ Mitigation - any of:
+ Upgrade to 4.2.8p1, or later, from the NTP Project Download Page
+ or the NTP Public Services Project Download Page.
+ Disable Autokey Authentication by removing, or commenting out,
+ all configuration directives beginning with the "crypto"
+ keyword in your ntp.conf file.
+ Credit: This vulnerability was discovered by Stephen Roettger of the
+ Google Security Team, with additional cases found by Sebastian
+ Krahmer of the SUSE Security Team and Harlan Stenn of Network
+ Time Foundation.
+
+* ::1 can be spoofed on some OSes, so ACLs based on IPv6 ::1 addresses
+ can be bypassed.
+
+ References: Sec 2672 / CVE-2014-9298 / VU#852879
+ Affects: All NTP4 releases before 4.2.8p1, under at least some
+ versions of MacOS and Linux. *BSD has not been seen to be vulnerable.
+ CVSS: (AV:N/AC:L/Au:N/C:P/I:P/A:C) Base Score: 9
+ Date Resolved: Stable (4.2.8p1) 04 Feb 2014
+ Summary: While available kernels will prevent 127.0.0.1 addresses
+ from "appearing" on non-localhost IPv4 interfaces, some kernels
+ do not offer the same protection for ::1 source addresses on
+ IPv6 interfaces. Since NTP's access control is based on source
+ address and localhost addresses generally have no restrictions,
+ an attacker can send malicious control and configuration packets
+ by spoofing ::1 addresses from the outside. Note Well: This is
+ not really a bug in NTP, it's a problem with some OSes. If you
+ have one of these OSes where ::1 can be spoofed, ALL ::1 -based
+ ACL restrictions on any application can be bypassed!
+ Mitigation:
+ Upgrade to 4.2.8p1, or later, from the NTP Project Download Page
+ or the NTP Public Services Project Download Page
+ Install firewall rules to block packets claiming to come from
+ ::1 from inappropriate network interfaces.
+ Credit: This vulnerability was discovered by Stephen Roettger of
+ the Google Security Team.
+
+Additionally, over 30 bugfixes and improvements were made to the codebase.
+See the ChangeLog for more information.
+
---
NTP 4.2.8 (Harlan Stenn , 2014/12/18)
@@ -8,6 +68,24 @@ Severity: HIGH
In addition to bug fixes and enhancements, this release fixes the
following high-severity vulnerabilities:
+************************** vv NOTE WELL vv *****************************
+
+The vulnerabilities listed below can be significantly mitigated by
+following the BCP of putting
+
+ restrict default ... noquery
+
+in the ntp.conf file. With the exception of:
+
+ receive(): missing return on error
+ References: Sec 2670 / CVE-2014-9296 / VU#852879
+
+below (which is a limited-risk vulnerability), none of the recent
+vulnerabilities listed below can be exploited if the source IP is
+restricted from sending a 'query'-class packet by your ntp.conf file.
+
+************************** ^^ NOTE WELL ^^ *****************************
+
* Weak default key in config_auth().
References: [Sec 2665] / CVE-2014-9293 / VU#852879
@@ -23,7 +101,9 @@ following high-severity vulnerabilities:
entropy. This was sufficient back in the late 1990s when the
code was written. Not today.
- Mitigation: Upgrade to 4.2.7p11 or later.
+ Mitigation - any of:
+ - Upgrade to 4.2.7p11 or later.
+ - Follow BCP and put 'restrict ... noquery' in your ntp.conf file.
Credit: This vulnerability was noticed in ntp-4.2.6 by Neel Mehta
of the Google Security Team.
@@ -43,7 +123,9 @@ following high-severity vulnerabilities:
cryptographic random number generator, either RAND_bytes from
OpenSSL, or arc4random().
- Mitigation: Upgrade to 4.2.7p230 or later.
+ Mitigation - any of:
+ - Upgrade to 4.2.7p230 or later.
+ - Follow BCP and put 'restrict ... noquery' in your ntp.conf file.
Credit: This vulnerability was discovered in ntp-4.2.6 by
Stephen Roettger of the Google Security Team.
@@ -61,10 +143,11 @@ following high-severity vulnerabilities:
buffer and potentially allow malicious code to be executed
with the privilege level of the ntpd process.
- Mitigation: Upgrade to 4.2.8, or later, or
- Disable Autokey Authentication by removing, or commenting out,
- all configuration directives beginning with the crypto keyword
- in your ntp.conf file.
+ Mitigation - any of:
+ - Upgrade to 4.2.8, or later, or
+ - Disable Autokey Authentication by removing, or commenting out,
+ all configuration directives beginning with the crypto keyword
+ in your ntp.conf file.
Credit: This vulnerability was discovered by Stephen Roettger of the
Google Security Team.
@@ -80,7 +163,9 @@ following high-severity vulnerabilities:
can overflow a stack buffer and potentially allow malicious
code to be executed with the privilege level of the ntpd process.
- Mitigation: Upgrade to 4.2.8, or later.
+ Mitigation - any of:
+ - Upgrade to 4.2.8, or later.
+ - Follow BCP and put 'restrict ... noquery' in your ntp.conf file.
Credit: This vulnerability was discovered by Stephen Roettger of the
Google Security Team.
@@ -96,7 +181,9 @@ following high-severity vulnerabilities:
can overflow a stack buffer and potentially allow malicious
code to be executed with the privilege level of the ntpd process.
- Mitigation: Upgrade to 4.2.8, or later.
+ Mitigation - any of:
+ - Upgrade to 4.2.8, or later.
+ - Follow BCP and put 'restrict ... noquery' in your ntp.conf file.
Credit: This vulnerability was discovered by Stephen Roettger of the
Google Security Team.
@@ -118,10 +205,10 @@ following high-severity vulnerabilities:
becomes a 5. If system integrity can be partially affected
via all three integrity metrics, the CVSS base score become 7.5.
- Mitigation:
- Upgrade to 4.2.8, or later,
- or Remove or comment out all configuration directives
- beginning with the crypto keyword in your ntp.conf file.
+ Mitigation - any of:
+ - Upgrade to 4.2.8, or later,
+ - Remove or comment out all configuration directives
+ beginning with the crypto keyword in your ntp.conf file.
Credit: This vulnerability was discovered by Stephen Roettger of the
Google Security Team.
diff --git a/adjtimed/Makefile.in b/adjtimed/Makefile.in
index b1b441721b8c..a6e97da38919 100644
--- a/adjtimed/Makefile.in
+++ b/adjtimed/Makefile.in
@@ -153,6 +153,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -187,7 +188,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/build b/build
index bfe62770803d..15fe39afa047 100755
--- a/build
+++ b/build
@@ -117,7 +117,7 @@ case "$CC" in
;;
esac
- BDIR="$BASEDIR$KEYSUF$CCSUF"
+BDIR="$BASEDIR$KEYSUF$CCSUF"
[ -d "$BDIR" ] || mkdir $BDIR
[ -f "$BDIR/.buildcvo" ] || echo $CVO > $BDIR/.buildcvo
@@ -162,7 +162,11 @@ if [ -z "$TEST" ] ; then
fi
fi
-CONFIGURE="../configure --cache-file=../config.cache-$IAM$KEYSUF$CCSUF $CONFIG_ARGS"
+CONFIGURE="../configure"
+# We need KEYSUF because of RAND_ and others, and -noopenssl"
+#CONFIGURE="$CONFIGURE --cache-file=../config.cache-$IAM$KEYSUF$CCSUF"
+CONFIGURE="$CONFIGURE $CONFIG_ARGS"
+
( # This sequence of commands is logged to make.log.
# If config.status is newer than ../configure, and the same
diff --git a/clockstuff/Makefile.in b/clockstuff/Makefile.in
index 27f3ee748242..f04ff2c4a8c1 100644
--- a/clockstuff/Makefile.in
+++ b/clockstuff/Makefile.in
@@ -149,6 +149,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -183,7 +184,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/config.h.in b/config.h.in
index b5084b6e4c71..76facf9643b4 100644
--- a/config.h.in
+++ b/config.h.in
@@ -327,6 +327,9 @@
*/
#undef HAVE_ALLOCA_H
+/* Define to 1 if you have the `arc4random_buf' function. */
+#undef HAVE_ARC4RANDOM_BUF
+
/* Define to 1 if you have the header file. */
#undef HAVE_ARPA_NAMESER_H
@@ -1558,6 +1561,9 @@ typedef unsigned int uintptr_t;
/* Use OpenSSL's crypto random functions */
#undef USE_OPENSSL_CRYPTO_RAND
+/* OK to use snprintb()? */
+#undef USE_SNPRINTB
+
/* Can we use SIGPOLL for tty IO? */
#undef USE_TTY_SIGPOLL
diff --git a/configure b/configure
index c99576e43a8a..28e0c3729cd1 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for ntp4 4.2.8.
+# Generated by GNU Autoconf 2.68 for ntp 4.2.8p1.
#
# Report bugs to .
#
@@ -568,10 +568,10 @@ MFLAGS=
MAKEFLAGS=
# Identity of this package.
-PACKAGE_NAME='ntp4'
-PACKAGE_TARNAME='ntp4'
-PACKAGE_VERSION='4.2.8'
-PACKAGE_STRING='ntp4 4.2.8'
+PACKAGE_NAME='ntp'
+PACKAGE_TARNAME='ntp'
+PACKAGE_VERSION='4.2.8p1'
+PACKAGE_STRING='ntp 4.2.8p1'
PACKAGE_BUGREPORT='http://bugs.ntp.org./'
PACKAGE_URL='http://www.ntp.org./'
@@ -649,7 +649,6 @@ DCFD
TESTDCF
MAKE_CHECK_LAYOUT
VER_SUFFIX
-PKG_CONFIG
MAKE_CHECK_Y2K
MAKE_LIBPARSE_KERNEL
MAKE_LIBPARSE
@@ -667,12 +666,18 @@ PTHREADS_TRUE
LIBISC_PTHREADS_NOTHREADS
PTHREAD_LIBS
HAVE_INLINE
+LDADD_LIBUTIL
ALLOCA
LIBM
EDITLINE_LIBS
LDADD_LIBNTP
NTP_CROSSCOMPILE_FALSE
NTP_CROSSCOMPILE_TRUE
+BUILD_LIBEVENT_FALSE
+BUILD_LIBEVENT_TRUE
+LDADD_LIBEVENT
+CPPFLAGS_LIBEVENT
+PKG_CONFIG
LIBOPTS_DIR
LIBOPTS_CFLAGS
LIBOPTS_LDADD
@@ -1568,7 +1573,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 ntp4 4.2.8 to adapt to many kinds of systems.
+\`configure' configures ntp 4.2.8p1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1616,7 +1621,7 @@ Fine tuning of the installation directories:
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/ntp4]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/ntp]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
@@ -1638,7 +1643,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ntp4 4.2.8:";;
+ short | recursive ) echo "Configuration of ntp 4.2.8p1:";;
esac
cat <<\_ACEOF
@@ -1804,7 +1809,7 @@ Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to .
-ntp4 home page: .
+ntp home page: .
_ACEOF
ac_status=$?
fi
@@ -1867,7 +1872,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ntp4 configure 4.2.8
+ntp configure 4.2.8p1
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2692,7 +2697,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 ntp4 $as_me 4.2.8, which was
+It was created by ntp $as_me 4.2.8p1, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -3638,8 +3643,8 @@ fi
# Define the identity of the package.
- PACKAGE='ntp4'
- VERSION='4.2.8'
+ PACKAGE='ntp'
+ VERSION='4.2.8p1'
cat >>confdefs.h <<_ACEOF
@@ -5429,6 +5434,183 @@ if test "x$ac_cv_prog_cc_c89" != xno; then :
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
+$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
+if ${ac_cv_prog_cc_c99+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c99=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include
+#include
+#include
+#include
+#include
+
+// Check varargs macros. These examples are taken from C99 6.10.3.5.
+#define debug(...) fprintf (stderr, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+ int x = 1234;
+ int y = 5678;
+ debug ("Flag");
+ debug ("X = %d\n", x);
+ showlist (The first, second, and third items.);
+ report (x>y, "x is %d but y is %d", x, y);
+}
+
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+ your preprocessor is broken;
+#endif
+#if BIG_OK
+#else
+ your preprocessor is broken;
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+
+struct incomplete_array
+{
+ int datasize;
+ double data[];
+};
+
+struct named_init {
+ int number;
+ const wchar_t *name;
+ double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict (ccp restrict text)
+{
+ // See if C++-style comments work.
+ // Iterate through items via the restricted pointer.
+ // Also check for declarations in for loops.
+ for (unsigned int i = 0; *(text+i) != '\0'; ++i)
+ continue;
+ return 0;
+}
+
+// Check varargs and va_copy.
+static void
+test_varargs (const char *format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ va_list args_copy;
+ va_copy (args_copy, args);
+
+ const char *str;
+ int number;
+ float fnumber;
+
+ while (*format)
+ {
+ switch (*format++)
+ {
+ case 's': // string
+ str = va_arg (args_copy, const char *);
+ break;
+ case 'd': // int
+ number = va_arg (args_copy, int);
+ break;
+ case 'f': // float
+ fnumber = va_arg (args_copy, double);
+ break;
+ default:
+ break;
+ }
+ }
+ va_end (args_copy);
+ va_end (args);
+}
+
+int
+main ()
+{
+
+ // Check bool.
+ _Bool success = false;
+
+ // Check restrict.
+ if (test_restrict ("String literal") == 0)
+ success = true;
+ char *restrict newvar = "Another string";
+
+ // Check varargs.
+ test_varargs ("s, d' f .", "string", 65, 34.234);
+ test_varargs_macros ();
+
+ // Check flexible array members.
+ struct incomplete_array *ia =
+ malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+ ia->datasize = 10;
+ for (int i = 0; i < ia->datasize; ++i)
+ ia->data[i] = i * 1.234;
+
+ // Check named initializers.
+ struct named_init ni = {
+ .number = 34,
+ .name = L"Test wide string",
+ .average = 543.34343,
+ };
+
+ ni.number = 58;
+
+ int dynamic_array[ni.number];
+ dynamic_array[ni.number - 1] = 543;
+
+ // work around unused variable warnings
+ return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
+ || dynamic_array[ni.number - 1] != 543);
+
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c99=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c99" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c99" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c99"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
+$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c99" != xno; then :
+
+fi
+
+
@@ -6162,6 +6344,7 @@ fi
+
CFLAGS_NTP=
CPPFLAGS_NTP=
LDADD_NTP=
@@ -19237,6 +19420,126 @@ fi
+ntp_pkgconfig_min_version='0.15.0'
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+{ ac_cv_path_PKG_CONFIG=; unset ac_cv_path_PKG_CONFIG;}
+{ ac_cv_path_ac_pt_PKG_CONFIG=; unset ac_cv_path_ac_pt_PKG_CONFIG;}
+
+case "$PKG_CONFIG" in
+ /*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pkg-config is at least version $ntp_pkgconfig_min_version" >&5
+$as_echo_n "checking if pkg-config is at least version $ntp_pkgconfig_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $ntp_pkgconfig_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+ ;;
+esac
+
+
+
+
# Check whether --enable-local-libevent was given.
if test "${enable_local_libevent+set}" = set; then :
enableval=$enable_local_libevent; ntp_use_local_libevent=$enableval
@@ -19249,6 +19552,91 @@ fi
+ntp_libevent_min_version=2
+ntp_libevent_tearoff=sntp/libevent
+
+
+
+
+case "$ntp_use_local_libevent" in
+ yes)
+ ;;
+ *) # If we have (a good enough) pkg-config, see if it can find libevent
+ case "$PKG_CONFIG" in
+ /*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libevent $ntp_libevent_min_version or later is installed" >&5
+$as_echo_n "checking if libevent $ntp_libevent_min_version or later is installed... " >&6; }
+ if $PKG_CONFIG --atleast-version=$ntp_libevent_min_version libevent
+ then
+ ntp_use_local_libevent=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Using the installed libevent" >&5
+$as_echo "$as_me: Using the installed libevent" >&6;}
+ CPPFLAGS_LIBEVENT=`$PKG_CONFIG --cflags-only-I libevent`
+ # HMS: I hope the following is accurate.
+ # We don't need -levent, we only need -levent_core.
+ # While we could grab only the -L stuff, there *might* be
+ # other flags there we want. Originally we just removed -levent
+ # but then somebody decided to install -levent-2.0
+ # LDADD_LIBEVENT=`$PKG_CONFIG --libs libevent | sed 's:-levent::'`
+ # So now we dance...
+ LDADD_LIBEVENT=
+ for i in `$PKG_CONFIG --libs libevent`
+ do
+ case "$i" in
+ -levent*) ;;
+ *) case "$LDADD_LIBEVENT" in
+ '') LDADD_LIBEVENT="$i" ;;
+ *) LDADD_LIBEVENT="$LDADD_LIBEVENT $i" ;;
+ esac
+ ;;
+ esac
+ done
+ case "$LIBISC_PTHREADS_NOTHREADS" in
+ pthreads)
+ LDADD_LIBEVENT="$LDADD_LIBEVENT -levent_pthreads"
+ esac
+ LDADD_LIBEVENT="$LDADD_LIBEVENT -levent_core"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ ntp_use_local_libevent=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ *)
+ ntp_use_local_libevent=yes
+ ;;
+ esac
+ ;;
+esac
+
+case "$ntp_use_local_libevent" in
+ yes)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Using libevent tearoff" >&5
+$as_echo "$as_me: Using libevent tearoff" >&6;}
+ CPPFLAGS_LIBEVENT="-I\$(top_builddir)/$ntp_libevent_tearoff/include -I\$(top_srcdir)/$ntp_libevent_tearoff/include"
+ case "$LIBISC_PTHREADS_NOTHREADS" in
+ pthreads)
+ LDADD_LIBEVENT="\$(top_builddir)/$ntp_libevent_tearoff/libevent_pthreads.la \$(top_builddir)/$ntp_libevent_tearoff/libevent_core.la"
+ ;;
+ *)
+ LDADD_LIBEVENT="\$(top_builddir)/$ntp_libevent_tearoff/libevent_core.la"
+ esac
+esac
+
+ if test "x$ntp_use_local_libevent" = "xyes"; then
+ BUILD_LIBEVENT_TRUE=
+ BUILD_LIBEVENT_FALSE='#'
+else
+ BUILD_LIBEVENT_TRUE='#'
+ BUILD_LIBEVENT_FALSE=
+fi
+
+
+
+
+
# Expose a cross-compilation indicator to makefiles
if test $build != $host; then
@@ -21078,6 +21466,73 @@ fi
done
+# Bug 2713
+LDADD_LIBUTIL=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing snprintb" >&5
+$as_echo_n "checking for library containing snprintb... " >&6; }
+if ${ac_cv_search_snprintb+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char snprintb ();
+int
+main ()
+{
+return snprintb ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' util; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_snprintb=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_snprintb+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_snprintb+:} false; then :
+
+else
+ ac_cv_search_snprintb=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_snprintb" >&5
+$as_echo "$ac_cv_search_snprintb" >&6; }
+ac_res=$ac_cv_search_snprintb
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+ case "$ac_cv_search_snprintb" in
+ 'none required') ;;
+ no) ;;
+ *) LDADD_LIBUTIL="$ac_cv_search_snprintb $LDADD_LIBUTIL" ;;
+ esac
+
+$as_echo "#define USE_SNPRINTB 1" >>confdefs.h
+
+fi
+
+
#
for ac_header in errno.h sys/socket.h sys/types.h time.h
do :
@@ -29950,6 +30405,20 @@ fi
esac
+####
+
+for ac_func in arc4random_buf
+do :
+ ac_fn_c_check_func "$LINENO" "arc4random_buf" "ac_cv_func_arc4random_buf"
+if test "x$ac_cv_func_arc4random_buf" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_ARC4RANDOM_BUF 1
+_ACEOF
+
+fi
+done
+
+
####
saved_LIBS="$LIBS"
@@ -33046,126 +33515,6 @@ $as_echo "$ans" >&6; }
-ntp_pkgconfig_min_version='0.15.0'
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PKG_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
- ac_pt_PKG_CONFIG=$PKG_CONFIG
- # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $ac_pt_PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
-$as_echo "$ac_pt_PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_pt_PKG_CONFIG" = x; then
- PKG_CONFIG=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- PKG_CONFIG=$ac_pt_PKG_CONFIG
- fi
-else
- PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
-
-{ ac_cv_path_PKG_CONFIG=; unset ac_cv_path_PKG_CONFIG;}
-{ ac_cv_path_ac_pt_PKG_CONFIG=; unset ac_cv_path_ac_pt_PKG_CONFIG;}
-
-case "$PKG_CONFIG" in
- /*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pkg-config is at least version $ntp_pkgconfig_min_version" >&5
-$as_echo_n "checking if pkg-config is at least version $ntp_pkgconfig_min_version... " >&6; }
- if $PKG_CONFIG --atleast-pkgconfig-version $ntp_pkgconfig_min_version; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- PKG_CONFIG=""
- fi
- ;;
-esac
-
-
-
-
VER_SUFFIX=
@@ -36327,6 +36676,10 @@ if test -z "${NEED_LIBOPTS_TRUE}" && test -z "${NEED_LIBOPTS_FALSE}"; then
as_fn_error $? "conditional \"NEED_LIBOPTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${BUILD_LIBEVENT_TRUE}" && test -z "${BUILD_LIBEVENT_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_LIBEVENT\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${NTP_CROSSCOMPILE_TRUE}" && test -z "${NTP_CROSSCOMPILE_FALSE}"; then
as_fn_error $? "conditional \"NTP_CROSSCOMPILE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -36756,7 +37109,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 ntp4 $as_me 4.2.8, which was
+This file was extended by ntp $as_me 4.2.8p1, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -36817,13 +37170,13 @@ Configuration commands:
$config_commands
Report bugs to .
-ntp4 home page: ."
+ntp home page: ."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ntp4 config.status 4.2.8
+ntp config.status 4.2.8p1
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index a7d344a21568..6942ceb5333f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ dnl
m4_include([sntp/m4/version.m4])
AC_PREREQ([2.61])
AC_INIT(
- [ntp4],
+ [ntp],
[VERSION_NUMBER],
[http://bugs.ntp.org./],
[],
@@ -102,7 +102,7 @@ esac
enable_nls=no
LIBOPTS_CHECK_NOBUILD([sntp/libopts])
-NTP_ENABLE_LOCAL_LIBEVENT
+NTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
NTP_LIBNTP
@@ -771,6 +771,10 @@ esac
####
+AC_CHECK_FUNCS([arc4random_buf])
+
+####
+
saved_LIBS="$LIBS"
LIBS="$LIBS $LDADD_LIBNTP"
AC_CHECK_FUNCS([daemon])
diff --git a/html/confopt.html b/html/confopt.html
index 8c8ae372c7ed..b964d245b3d8 100644
--- a/html/confopt.html
+++ b/html/confopt.html
@@ -91,11 +91,13 @@ outgoing NTP packets. Versions 1-4 are the choices, with version 4 the default.<
Auxiliary Commands
broadcastclient
-
Enable reception of broadcast server messages to any local interface (type b address). Ordinarily, upon receiving a broadcast message for the first time, the broadcast client measures the nominal server propagation delay using a brief client/server exchange, after which it continues in listen-only mode. If a nonzero value is specified in the broadcastdelay command, the value becomes the delay and the volley is not executed. Note: the novolley option has been deprecated for future enhancements. Note that, in order to avoid accidental or malicious disruption in this mode, both the server and client should operate using symmetric key or public key authentication as described in the Authentication Options page. Note that the volley is required with public key authentication in order to run the Autokey protocol..
+
Enable reception of broadcast server messages to any local interface (type b address). Ordinarily, upon receiving a broadcast message for the first time, the broadcast client measures the nominal server propagation delay using a brief client/server exchange, after which it continues in listen-only mode. If a nonzero value is specified in the broadcastdelay command, the value becomes the delay and the volley is not executed. Note: the novolley option has been deprecated for future enhancements. Note that, in order to avoid accidental or malicious disruption in this mode, both the server and client should operate using symmetric key or public key authentication as described in the Authentication Options page. Note that the volley is required with public key authentication in order to run the Autokey protocol.
manycastserver address [...]
Enable reception of manycast client messages (type m) to the multicasts group address(es) (type m) specified. At least one address is required. Note that, in order to avoid accidental or malicious disruption, both the server and client should operate using symmetric key or public key authentication as described in the Authentication Options page.
multicastclient address [...]
Enable reception of multicast server messages to the multicast group address(es) (type m) specified. Upon receiving a message for the first time, the multicast client measures the nominal server propagation delay using a brief client/server exchange with the server, then enters the broadcast client mode, in which it synchronizes to succeeding multicast messages. Note that, in order to avoid accidental or malicious disruption in this mode, both the server and client should operate using symmetric key or public key authentication as described in the Authentication Options page.
+
mdnstriesnumber
+
If we are participating in mDNS, after we have synched for the first time we attempt to register with the mDNS system. If that registration attempt fails, we try again at one minute intervals for up to mdnstries times. After all, ntpd may be starting before mDNS. The default value for mdnstries is 5.
Last update:
- 9-Aug-2014 07:56
+ 17-Jan-2015 00:16
UTC
-
The following copyright notice applies to all files collectively called the Network Time Protocol Version 4 Distribution. Unless specifically declared otherwise in an individual file, this notice applies as if the text was explicitly included in the file.
+
The following copyright notice applies to all files collectively called the Network Time Protocol Version 4 Distribution. Unless specifically declared otherwise in an individual file, this entire notice applies as if the text was explicitly included in the file.
***********************************************************************
* *
-* Copyright (c) University of Delaware 1992-2014 *
+* Copyright (c) University of Delaware 1992-2015 *
* *
* Permission to use, copy, modify, and distribute this software and *
* its documentation for any purpose with or without fee is hereby *
@@ -35,6 +35,38 @@
* *
***********************************************************************
+
Content starting in 2011 from Harlan Stenn, Danny Mayer, and Martin Burnicki is:
+
+***********************************************************************
+* *
+* Copyright (c) Network Time Foundation 2011-2015 *
+* *
+* All Rights Reserved *
+* *
+* Redistribution and use in source and binary forms, with or without *
+* modification, are permitted provided that the following conditions *
+* are met: *
+* 1. Redistributions of source code must retain the above copyright *
+* notice, this list of conditions and the following disclaimer. *
+* 2. Redistributions in binary form must reproduce the above *
+* copyright notice, this list of conditions and the following *
+* disclaimer in the documentation and/or other materials provided *
+* with the distribution. *
+* *
+* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS *
+* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
+* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE *
+* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
+* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
+* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
+* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
+* DAMAGE. *
+***********************************************************************
+
The following individuals contributed in part to the Network Time Protocol Distribution Version 4 and are acknowledged as authors of this work.
This driver receives its reference clock info from a shared memory-segment. The shared memory-segment is created with owner-only access for unit 0 and 1, and world access for unit 2 and 3
+
This driver receives its reference clock info from a shared
+ memory-segment. The shared memory-segment is created with owner-only
+ access by default, unless otherwise requested by the mode word for units
+ ≥2. Units 0 and 1 are always created with owner-only access for
+ backward compatibility.
+
+
Structure of shared memory-segment
struct shmTime {
@@ -49,14 +59,14 @@
Operation mode=0
Each second, the value of valid of the shared memory-segment is checked:
-
If set, the values in the record (clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec, receiveTimeStampUSec, leap, precision) are passed to ntp, and valid is cleared and count is bumped.
+
If set, the values in the record (clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec, receiveTimeStampUSec, leap, precision) are passed to NTPD, and valid is cleared and count is bumped.
If not set, count is bumped.
Operation mode=1
Each second, valid in the shared memory-segment is checked:
-
If set, the count field of the record is remembered, and the values in the record (clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec, receiveTimeStampUSec, leap, precision) are read. Then, the remembered count is compared to current value of count now in the record. If both are equal, the values read from the record are passed to ntp. If they differ, another process has modified the record while it was read out (was not able to produce this case), and failure is reported to ntp. The valid flag is cleared and count is bumped.
+
If set, the count field of the record is remembered, and the values in the record (clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec, receiveTimeStampUSec, leap, precision) are read. Then, the remembered count is compared to current value of count now in the record. If both are equal, the values read from the record are passed to NTPD. If they differ, another process has modified the record while it was read out (was not able to produce this case), and failure is reported to NTPD. The valid flag is cleared and count is bumped.
If not set, count is bumped
-
Mode-independent postprocessing
+
Mode-independent post-processing
After the time stamps have been successfully plucked from the SHM
segment, some sanity checks take place:
@@ -69,30 +79,38 @@ segment, some sanity checks take place:
set to 1.
-
gpsd
+
GPSD
-gpsd
+GPSD
knows how to talk to many GPS devices.
-It can work with ntpd through the SHM driver.
+It can work with NTPD through the SHM driver.
-The gpsd man page suggests setting minpoll and maxpoll to 4.
+The GPSD man page suggests setting minpoll and maxpoll to 4.
That was an attempt to reduce jitter.
The SHM driver was fixed (ntp-4.2.5p138) to collect data each second rather than
once per polling interval so that suggestion is no longer reasonable.
- Note: The GPSD client driver (type 46) uses the gpsd
- client protocol to connect and talk to gpsd, but using the
- SHM driver is the ancient way to have gpsd talk to ntpd.
+ Note: The GPSD client driver (type 46) uses the GPSD
+ client protocol to connect and talk to GPSD, but using the
+ SHM driver is the ancient way to have GPSD talk to NTPD. There
+ are some tricky points when using the SHM interface to interface
+ with GPSD, because GPSD will use two SHM clocks, one for the
+ serial data stream and one for the PPS information when
+ available. Receivers with a loose/sloppy timing between PPS and serial data
+ can easily cause trouble here because NTPD has no way to join the two
+ data streams and correlate the serial data with the PPS events.
+
+
Clockstats
If flag4 is set when the driver is polled, a clockstats record is written.
The first 3 fields are the normal date, time, and IP address common to all clockstats records.
The 4th field is the number of second ticks since the last poll.
-The 5th field is the number of good data samples found. The last 64 will be used by ntpd.
+The 5th field is the number of good data samples found. The last 64 will be used by NTPD.
The 6th field is the number of sample that didn't have valid data ready.
The 7th field is the number of bad samples.
-The 8th field is the number of times the the mode 1 info was update while nptd was trying to grab a sample.
+The 8th field is the number of times the the mode 1 info was update while NTPD was trying to grab a sample.
Here is a sample showing the GPS reception fading out:
@@ -112,6 +130,39 @@ Here is a sample showing the GPS reception fading out:
54364 85700.160 127.127.28.0 65 0 65 0 0
+
The 'mode' word
+
+
+ Some aspects of the driver behavior can be adjusted by setting bits of
+ the 'mode' word in the server configuration line:
+ server 127.127.28.x mode Y
+
+
+
+
mode word bits and bit groups
+
+
Bit
+
Dec
+
Hex
+
Meaning
+
+
+
+
0
+
1
+
1
+
The SHM segment is private (mode 0600). This is the fixed
+ default for clock units 0 and 1; clock units >1 are mode
+ 0666 unless this bit is set for the specific unit.
+
+
1-31
+
-
+
-
+
reserved -- do not use
+
+
+
+
Fudge Factors
time1 time
@@ -136,9 +187,64 @@ Here is a sample showing the GPS reception fading out:
Not used by this driver.
flag4 0 | 1
If flag4 is set, clockstats records will be written when the driver is polled.
-
The driver attempts to create a shared memory segment with an
+ identifier depending on the unit number. This identifier (which can be
+ a numeric value or a string) clearly depends on the method used, which
+ in turn depends on the host operating system:
+
+
+
+ Windows uses a file mapping to the page file with the
+ name 'Global\NTPu' for public accessible
+ mappings, where u is the clock unit. Private /
+ non-public mappings are created as
+ 'Local\NTPu'.
+
+ Public access assigns a NULL DACL to the memory mapping, while
+ private access just uses the default DACL of the process creating
+ the mapping.
+
+
+
+ SYSV IPC creates a shared memory segment with a key value
+ of 0x4E545030 + u, where u is again
+ the clock unit. (This value could be hex-decoded as 'NTP0',
+ 'NTP1',..., with funny characters for units > 9.)
+
+ Public access means a permission set of 0666, while private access
+ creates the mapping with a permission set of 0600.
+
+
+
+
+
There's no support for POSIX shared memory yet.
+
+
NTPD is started as root on most POSIX-like operating systems
+ and uses the setuid/setgid system API to run under reduced rights once
+ the initial setup of the process is done. One consequence out of this
+ is that the allocation of SHM segments must be done early during the
+ clock setup. The actual polling of the clock is done as the run-time
+ user; deferring the creation of the SHM segment to this point will
+ create a SHM segment owned by the runtime-user account. The internal
+ structure of NTPD does not permit the use of a fudge flag if
+ this is to be avoided; this is the reason why a mode bit is used for
+ the configuration of a public segment.
+
+
+
When running under Windows, the chosen user account must be able to
+ create a SHM segment in the global object name space for SHM clocks with
+ public access. Otherwise the session isolation used by Windows kernels
+ after WinXP will get into the way if the client program does not run in
+ the same session.
+
+
diff --git a/html/pic/9400n.jpg b/html/pic/9400n.jpg
new file mode 100644
index 000000000000..9209b90f3d0d
Binary files /dev/null and b/html/pic/9400n.jpg differ
diff --git a/html/pic/alice11.gif b/html/pic/alice11.gif
new file mode 100644
index 000000000000..62d0c9ba0094
Binary files /dev/null and b/html/pic/alice11.gif differ
diff --git a/html/pic/alice13.gif b/html/pic/alice13.gif
new file mode 100644
index 000000000000..c928ff75bb42
Binary files /dev/null and b/html/pic/alice13.gif differ
diff --git a/html/pic/alice15.gif b/html/pic/alice15.gif
new file mode 100644
index 000000000000..e17b5fdf11e1
Binary files /dev/null and b/html/pic/alice15.gif differ
diff --git a/html/pic/alice23.gif b/html/pic/alice23.gif
new file mode 100644
index 000000000000..bc258a0f7916
Binary files /dev/null and b/html/pic/alice23.gif differ
diff --git a/html/pic/alice31.gif b/html/pic/alice31.gif
new file mode 100644
index 000000000000..ea3d20cd9c83
Binary files /dev/null and b/html/pic/alice31.gif differ
diff --git a/html/pic/alice32.gif b/html/pic/alice32.gif
new file mode 100644
index 000000000000..db7cc40c655f
Binary files /dev/null and b/html/pic/alice32.gif differ
diff --git a/html/pic/alice35.gif b/html/pic/alice35.gif
new file mode 100644
index 000000000000..aa0ca4335db9
Binary files /dev/null and b/html/pic/alice35.gif differ
diff --git a/html/pic/alice38.gif b/html/pic/alice38.gif
new file mode 100644
index 000000000000..e40adba1b70c
Binary files /dev/null and b/html/pic/alice38.gif differ
diff --git a/html/pic/alice44.gif b/html/pic/alice44.gif
new file mode 100644
index 000000000000..953387edc444
Binary files /dev/null and b/html/pic/alice44.gif differ
diff --git a/html/pic/alice47.gif b/html/pic/alice47.gif
new file mode 100644
index 000000000000..6b27160454d0
Binary files /dev/null and b/html/pic/alice47.gif differ
diff --git a/html/pic/alice51.gif b/html/pic/alice51.gif
new file mode 100644
index 000000000000..1e9082a554b6
Binary files /dev/null and b/html/pic/alice51.gif differ
diff --git a/html/pic/alice61.gif b/html/pic/alice61.gif
new file mode 100644
index 000000000000..5687c38e8731
Binary files /dev/null and b/html/pic/alice61.gif differ
diff --git a/html/pic/barnstable.gif b/html/pic/barnstable.gif
new file mode 100644
index 000000000000..17d9cdd5de92
Binary files /dev/null and b/html/pic/barnstable.gif differ
diff --git a/html/pic/beaver.gif b/html/pic/beaver.gif
new file mode 100644
index 000000000000..3d0c8eb9b5c4
Binary files /dev/null and b/html/pic/beaver.gif differ
diff --git a/html/pic/boom3.gif b/html/pic/boom3.gif
new file mode 100644
index 000000000000..1a95d4088121
Binary files /dev/null and b/html/pic/boom3.gif differ
diff --git a/html/pic/boom3a.gif b/html/pic/boom3a.gif
new file mode 100644
index 000000000000..14bfe5bf8890
Binary files /dev/null and b/html/pic/boom3a.gif differ
diff --git a/html/pic/boom4.gif b/html/pic/boom4.gif
new file mode 100644
index 000000000000..0661ac41031f
Binary files /dev/null and b/html/pic/boom4.gif differ
diff --git a/html/pic/broad.gif b/html/pic/broad.gif
new file mode 100644
index 000000000000..b372bb5c14dc
Binary files /dev/null and b/html/pic/broad.gif differ
diff --git a/html/pic/bustardfly.gif b/html/pic/bustardfly.gif
new file mode 100644
index 000000000000..b5c6e91a75ad
Binary files /dev/null and b/html/pic/bustardfly.gif differ
diff --git a/html/pic/c51.jpg b/html/pic/c51.jpg
new file mode 100644
index 000000000000..d90ad551d2c6
Binary files /dev/null and b/html/pic/c51.jpg differ
diff --git a/html/pic/description.jpg b/html/pic/description.jpg
new file mode 100644
index 000000000000..2153180a899c
Binary files /dev/null and b/html/pic/description.jpg differ
diff --git a/html/pic/discipline.gif b/html/pic/discipline.gif
new file mode 100644
index 000000000000..3280d1460e65
Binary files /dev/null and b/html/pic/discipline.gif differ
diff --git a/html/pic/dogsnake.gif b/html/pic/dogsnake.gif
new file mode 100644
index 000000000000..1f9755dcd976
Binary files /dev/null and b/html/pic/dogsnake.gif differ
diff --git a/html/pic/driver29.gif b/html/pic/driver29.gif
new file mode 100644
index 000000000000..b0415ae41ed9
Binary files /dev/null and b/html/pic/driver29.gif differ
diff --git a/html/pic/driver43_1.gif b/html/pic/driver43_1.gif
new file mode 100644
index 000000000000..f1ff7c79ee63
Binary files /dev/null and b/html/pic/driver43_1.gif differ
diff --git a/html/pic/driver43_2.jpg b/html/pic/driver43_2.jpg
new file mode 100644
index 000000000000..c53639c5daaa
Binary files /dev/null and b/html/pic/driver43_2.jpg differ
diff --git a/html/pic/fg6021.gif b/html/pic/fg6021.gif
new file mode 100644
index 000000000000..e6e3071262da
Binary files /dev/null and b/html/pic/fg6021.gif differ
diff --git a/html/pic/fg6039.jpg b/html/pic/fg6039.jpg
new file mode 100644
index 000000000000..25fc7c421113
Binary files /dev/null and b/html/pic/fg6039.jpg differ
diff --git a/html/pic/fig_3_1.gif b/html/pic/fig_3_1.gif
new file mode 100644
index 000000000000..a280a89032e5
Binary files /dev/null and b/html/pic/fig_3_1.gif differ
diff --git a/html/pic/flatheads.gif b/html/pic/flatheads.gif
new file mode 100644
index 000000000000..707cb8cc3d4b
Binary files /dev/null and b/html/pic/flatheads.gif differ
diff --git a/html/pic/flt1.gif b/html/pic/flt1.gif
new file mode 100644
index 000000000000..d08c5ac74688
Binary files /dev/null and b/html/pic/flt1.gif differ
diff --git a/html/pic/flt2.gif b/html/pic/flt2.gif
new file mode 100644
index 000000000000..d4909cb54cef
Binary files /dev/null and b/html/pic/flt2.gif differ
diff --git a/html/pic/flt3.gif b/html/pic/flt3.gif
new file mode 100644
index 000000000000..1eefbe13946a
Binary files /dev/null and b/html/pic/flt3.gif differ
diff --git a/html/pic/flt4.gif b/html/pic/flt4.gif
new file mode 100644
index 000000000000..3f8b67134748
Binary files /dev/null and b/html/pic/flt4.gif differ
diff --git a/html/pic/flt5.gif b/html/pic/flt5.gif
new file mode 100644
index 000000000000..52714ac0826e
Binary files /dev/null and b/html/pic/flt5.gif differ
diff --git a/html/pic/flt6.gif b/html/pic/flt6.gif
new file mode 100644
index 000000000000..0451e86f6641
Binary files /dev/null and b/html/pic/flt6.gif differ
diff --git a/html/pic/flt7.gif b/html/pic/flt7.gif
new file mode 100644
index 000000000000..55f07d83bb9f
Binary files /dev/null and b/html/pic/flt7.gif differ
diff --git a/html/pic/flt8.gif b/html/pic/flt8.gif
new file mode 100644
index 000000000000..04bd32b78c41
Binary files /dev/null and b/html/pic/flt8.gif differ
diff --git a/html/pic/flt9.gif b/html/pic/flt9.gif
new file mode 100644
index 000000000000..e107c482a494
Binary files /dev/null and b/html/pic/flt9.gif differ
diff --git a/html/pic/freq1211.gif b/html/pic/freq1211.gif
new file mode 100644
index 000000000000..2a564168376d
Binary files /dev/null and b/html/pic/freq1211.gif differ
diff --git a/html/pic/gadget.jpg b/html/pic/gadget.jpg
new file mode 100644
index 000000000000..6289911e226f
Binary files /dev/null and b/html/pic/gadget.jpg differ
diff --git a/html/pic/gps167.jpg b/html/pic/gps167.jpg
new file mode 100644
index 000000000000..8a87a75f996c
Binary files /dev/null and b/html/pic/gps167.jpg differ
diff --git a/html/pic/group.gif b/html/pic/group.gif
new file mode 100644
index 000000000000..26aff0674136
Binary files /dev/null and b/html/pic/group.gif differ
diff --git a/html/pic/hornraba.gif b/html/pic/hornraba.gif
new file mode 100644
index 000000000000..3077d75ecc93
Binary files /dev/null and b/html/pic/hornraba.gif differ
diff --git a/html/pic/igclock.gif b/html/pic/igclock.gif
new file mode 100644
index 000000000000..940f330c7ebb
Binary files /dev/null and b/html/pic/igclock.gif differ
diff --git a/html/pic/neoclock4x.gif b/html/pic/neoclock4x.gif
new file mode 100755
index 000000000000..4df95af54ffe
Binary files /dev/null and b/html/pic/neoclock4x.gif differ
diff --git a/html/pic/offset1211.gif b/html/pic/offset1211.gif
new file mode 100644
index 000000000000..8a73287a9cb3
Binary files /dev/null and b/html/pic/offset1211.gif differ
diff --git a/html/pic/oncore_evalbig.gif b/html/pic/oncore_evalbig.gif
new file mode 100644
index 000000000000..931a7f14d52c
Binary files /dev/null and b/html/pic/oncore_evalbig.gif differ
diff --git a/html/pic/oncore_remoteant.jpg b/html/pic/oncore_remoteant.jpg
new file mode 100644
index 000000000000..0f1d04891c6f
Binary files /dev/null and b/html/pic/oncore_remoteant.jpg differ
diff --git a/html/pic/oncore_utplusbig.gif b/html/pic/oncore_utplusbig.gif
new file mode 100644
index 000000000000..dec7e71fd7be
Binary files /dev/null and b/html/pic/oncore_utplusbig.gif differ
diff --git a/html/pic/oz2.gif b/html/pic/oz2.gif
new file mode 100644
index 000000000000..d4982f02b2a8
Binary files /dev/null and b/html/pic/oz2.gif differ
diff --git a/html/pic/panda.gif b/html/pic/panda.gif
new file mode 100644
index 000000000000..6feb74365ee4
Binary files /dev/null and b/html/pic/panda.gif differ
diff --git a/html/pic/pd_om006.gif b/html/pic/pd_om006.gif
new file mode 100644
index 000000000000..3266285eac56
Binary files /dev/null and b/html/pic/pd_om006.gif differ
diff --git a/html/pic/pd_om011.gif b/html/pic/pd_om011.gif
new file mode 100644
index 000000000000..06566b9525d2
Binary files /dev/null and b/html/pic/pd_om011.gif differ
diff --git a/html/pic/peer.gif b/html/pic/peer.gif
new file mode 100644
index 000000000000..35bd36f7fb98
Binary files /dev/null and b/html/pic/peer.gif differ
diff --git a/html/pic/pogo.gif b/html/pic/pogo.gif
new file mode 100644
index 000000000000..68dacbe856dc
Binary files /dev/null and b/html/pic/pogo.gif differ
diff --git a/html/pic/pogo1a.gif b/html/pic/pogo1a.gif
new file mode 100644
index 000000000000..433e467d9194
Binary files /dev/null and b/html/pic/pogo1a.gif differ
diff --git a/html/pic/pogo3a.gif b/html/pic/pogo3a.gif
new file mode 100644
index 000000000000..49f1359fefaa
Binary files /dev/null and b/html/pic/pogo3a.gif differ
diff --git a/html/pic/pogo4.gif b/html/pic/pogo4.gif
new file mode 100644
index 000000000000..e0a3b178160b
Binary files /dev/null and b/html/pic/pogo4.gif differ
diff --git a/html/pic/pogo5.gif b/html/pic/pogo5.gif
new file mode 100644
index 000000000000..87ad8e490d6b
Binary files /dev/null and b/html/pic/pogo5.gif differ
diff --git a/html/pic/pogo6.gif b/html/pic/pogo6.gif
new file mode 100644
index 000000000000..3f98c52cdf63
Binary files /dev/null and b/html/pic/pogo6.gif differ
diff --git a/html/pic/pogo7.gif b/html/pic/pogo7.gif
new file mode 100644
index 000000000000..36befe7a692c
Binary files /dev/null and b/html/pic/pogo7.gif differ
diff --git a/html/pic/pogo8.gif b/html/pic/pogo8.gif
new file mode 100644
index 000000000000..6860efbba879
Binary files /dev/null and b/html/pic/pogo8.gif differ
diff --git a/html/pic/pzf509.jpg b/html/pic/pzf509.jpg
new file mode 100644
index 000000000000..b51303bfe667
Binary files /dev/null and b/html/pic/pzf509.jpg differ
diff --git a/html/pic/pzf511.jpg b/html/pic/pzf511.jpg
new file mode 100644
index 000000000000..c470af2f6daa
Binary files /dev/null and b/html/pic/pzf511.jpg differ
diff --git a/html/pic/rabbit.gif b/html/pic/rabbit.gif
new file mode 100644
index 000000000000..ab6ec5ff56fa
Binary files /dev/null and b/html/pic/rabbit.gif differ
diff --git a/html/pic/radio2.jpg b/html/pic/radio2.jpg
new file mode 100644
index 000000000000..ceb7c76e36fa
Binary files /dev/null and b/html/pic/radio2.jpg differ
diff --git a/html/pic/sheepb.jpg b/html/pic/sheepb.jpg
new file mode 100644
index 000000000000..1b3323ee4c04
Binary files /dev/null and b/html/pic/sheepb.jpg differ
diff --git a/html/pic/stack1a.jpg b/html/pic/stack1a.jpg
new file mode 100644
index 000000000000..1e023cb4af5c
Binary files /dev/null and b/html/pic/stack1a.jpg differ
diff --git a/html/pic/stats.gif b/html/pic/stats.gif
new file mode 100644
index 000000000000..b0d0aaa31e8d
Binary files /dev/null and b/html/pic/stats.gif differ
diff --git a/html/pic/sx5.gif b/html/pic/sx5.gif
new file mode 100644
index 000000000000..504e38b73287
Binary files /dev/null and b/html/pic/sx5.gif differ
diff --git a/html/pic/thunderbolt.jpg b/html/pic/thunderbolt.jpg
new file mode 100644
index 000000000000..49253ab543e8
Binary files /dev/null and b/html/pic/thunderbolt.jpg differ
diff --git a/html/pic/time1.gif b/html/pic/time1.gif
new file mode 100644
index 000000000000..88e70420f302
Binary files /dev/null and b/html/pic/time1.gif differ
diff --git a/html/pic/tonea.gif b/html/pic/tonea.gif
new file mode 100644
index 000000000000..195a3df6c4da
Binary files /dev/null and b/html/pic/tonea.gif differ
diff --git a/html/pic/tribeb.gif b/html/pic/tribeb.gif
new file mode 100644
index 000000000000..59e8a7c48706
Binary files /dev/null and b/html/pic/tribeb.gif differ
diff --git a/html/pic/wingdorothy.gif b/html/pic/wingdorothy.gif
new file mode 100644
index 000000000000..3f2e0be66330
Binary files /dev/null and b/html/pic/wingdorothy.gif differ
diff --git a/include/Makefile.in b/include/Makefile.in
index 0a6a65d4da3c..36c9b865f481 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -151,6 +151,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -185,7 +186,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/include/audio.h b/include/audio.h
index 1b969bd49ebd..0d7422666685 100644
--- a/include/audio.h
+++ b/include/audio.h
@@ -9,6 +9,6 @@
/*
* Function prototypes
*/
-int audio_init (char *, int, int);
+int audio_init (const char *, int, int);
int audio_gain (int, int, int);
void audio_show (void);
diff --git a/include/icom.h b/include/icom.h
index 66d12e51f1cc..b271afbec54a 100755
--- a/include/icom.h
+++ b/include/icom.h
@@ -83,5 +83,5 @@
/*
* Function prototypes
*/
-int icom_init (char *, int, int);
+int icom_init (const char *, int, int);
int icom_freq (int, int, double);
diff --git a/include/isc/Makefile.in b/include/isc/Makefile.in
index cdb34ec0902b..f29d1454b9a9 100644
--- a/include/isc/Makefile.in
+++ b/include/isc/Makefile.in
@@ -113,6 +113,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -147,7 +148,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/include/ntp_config.h b/include/ntp_config.h
index 900688cef4ee..a74cd552b85d 100644
--- a/include/ntp_config.h
+++ b/include/ntp_config.h
@@ -239,6 +239,7 @@ struct config_tree_tag {
int_fifo * reset_counters;
sim_fifo * sim_details;
+ int mdnstries;
};
@@ -286,7 +287,7 @@ attr_val *create_attr_dval(int attr, double value);
attr_val *create_attr_ival(int attr, int value);
attr_val *create_attr_uval(int attr, u_int value);
attr_val *create_attr_rangeval(int attr, int first, int last);
-attr_val *create_attr_sval(int attr, char *s);
+attr_val *create_attr_sval(int attr, const char *s);
filegen_node *create_filegen_node(int filegen_token,
attr_val_fifo *options);
string_node *create_string_node(char *str);
@@ -316,7 +317,7 @@ int dump_all_config_trees(FILE *df, int comment);
#endif
#if defined(HAVE_SETRLIMIT)
-void ntp_rlimit(int, rlim_t, int, char *);
+void ntp_rlimit(int, rlim_t, int, const char *);
#endif
#endif /* !defined(NTP_CONFIG_H) */
diff --git a/include/ntp_filegen.h b/include/ntp_filegen.h
index f5ba8afe9ed8..549bedbc8522 100644
--- a/include/ntp_filegen.h
+++ b/include/ntp_filegen.h
@@ -52,5 +52,5 @@ extern void filegen_statsdir(void);
extern FILEGEN *filegen_get (const char *);
extern void filegen_register (const char *, const char *, FILEGEN *);
#ifdef DEBUG
-extern void filegen_unregister(char *);
+extern void filegen_unregister(const char *);
#endif
diff --git a/include/ntp_stdlib.h b/include/ntp_stdlib.h
index 7c884fc3274c..38180f0d78f2 100644
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -96,14 +96,14 @@ extern int ymd2yd (int, int, int);
/* a_md5encrypt.c */
extern int MD5authdecrypt (int, u_char *, u_int32 *, int, int);
extern int MD5authencrypt (int, u_char *, u_int32 *, int);
-extern void MD5auth_setkey (keyid_t, int, const u_char *, int);
+extern void MD5auth_setkey (keyid_t, int, const u_char *, size_t);
extern u_int32 addr2refid (sockaddr_u *);
/* emalloc.c */
#ifndef EREALLOC_CALLSITE /* ntp_malloc.h defines */
extern void * ereallocz (void *, size_t, size_t, int);
#define erealloczsite(p, n, o, z, f, l) ereallocz(p, n, o, (z))
-extern void * emalloc (size_t);
+#define emalloc(n) ereallocz(NULL, n, 0, FALSE)
#define emalloc_zero(c) ereallocz(NULL, (c), 0, TRUE)
#define erealloc(p, c) ereallocz(p, (c), 0, FALSE)
#define erealloc_zero(p, n, o) ereallocz(p, n, (o), TRUE)
@@ -129,11 +129,11 @@ extern char * estrdup_impl (const char *, const char *, int);
extern int atoint (const char *, long *);
extern int atouint (const char *, u_long *);
extern int hextoint (const char *, u_long *);
-extern char * humanlogtime (void);
-extern char * humantime (time_t);
+extern const char * humanlogtime (void);
+extern const char * humantime (time_t);
extern char * mfptoa (u_int32, u_int32, short);
extern char * mfptoms (u_int32, u_int32, short);
-extern const char * modetoa (int);
+extern const char * modetoa (size_t);
extern const char * eventstr (int);
extern const char * ceventstr (int);
extern const char * res_match_flags(u_short);
diff --git a/include/ntpd.h b/include/ntpd.h
index 51d8f2accd3e..77fe4843a654 100644
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -78,7 +78,7 @@ extern int mprintf_event (int, struct peer *, const char *, ...)
struct ctl_var {
u_short code;
u_short flags;
- char *text;
+ const char *text;
};
/*
* Flag values
@@ -218,7 +218,7 @@ extern struct value tai_leap;
/* ntp_proto.c */
extern void transmit (struct peer *);
extern void receive (struct recvbuf *);
-extern void peer_clear (struct peer *, char *);
+extern void peer_clear (struct peer *, const char *);
extern void process_packet (struct peer *, struct pkt *, u_int);
extern void clock_select (void);
@@ -285,7 +285,7 @@ extern void record_loop_stats (double, double, double, double, int);
extern void record_clock_stats (sockaddr_u *, const char *);
extern int mprintf_clock_stats(sockaddr_u *, const char *, ...)
NTP_PRINTF(2, 3);
-extern void record_raw_stats (sockaddr_u *srcadr, sockaddr_u *dstadr, l_fp *t1, l_fp *t2, l_fp *t3, l_fp *t4, int leap, int version, int mode, int stratum, int poll, int precision, double root_delay, double root_dispersion, u_int32 refid);
+extern void record_raw_stats (sockaddr_u *srcadr, sockaddr_u *dstadr, l_fp *t1, l_fp *t2, l_fp *t3, l_fp *t4, int leap, int version, int mode, int stratum, int ppoll, int precision, double root_delay, double root_dispersion, u_int32 refid);
extern void check_leap_file (int is_daily_check, u_int32 ntptime, const time_t * systime);
extern void record_crypto_stats (sockaddr_u *, const char *);
#ifdef DEBUG
diff --git a/include/timepps-Solaris.h b/include/timepps-Solaris.h
index a2b1fbe3b677..bcae382fe47f 100644
--- a/include/timepps-Solaris.h
+++ b/include/timepps-Solaris.h
@@ -413,7 +413,7 @@ time_pps_getparams(
}
punit = (pps_unit_t *)handle;
- memcpy(params, &punit->params, sizeof(params));
+ memcpy(params, &punit->params, sizeof(*params));
return (0);
}
diff --git a/kernel/Makefile.in b/kernel/Makefile.in
index 0fce65b1e0b3..5c85def062fd 100644
--- a/kernel/Makefile.in
+++ b/kernel/Makefile.in
@@ -148,6 +148,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -182,7 +183,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/kernel/sys/Makefile.in b/kernel/sys/Makefile.in
index 2260c858fa5a..83334765ee47 100644
--- a/kernel/sys/Makefile.in
+++ b/kernel/sys/Makefile.in
@@ -113,6 +113,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -147,7 +148,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/lib/isc/backtrace.c b/lib/isc/backtrace.c
index d2f044cb8c4c..4274da31b463 100644
--- a/lib/isc/backtrace.c
+++ b/lib/isc/backtrace.c
@@ -211,17 +211,17 @@ isc_backtrace_gettrace(void **addrs, int maxaddrs, int *nframes) {
#endif
isc_result_t
-isc_backtrace_getsymbolfromindex(int index, const void **addrp,
+isc_backtrace_getsymbolfromindex(int idx, const void **addrp,
const char **symbolp)
{
REQUIRE(addrp != NULL && *addrp == NULL);
REQUIRE(symbolp != NULL && *symbolp == NULL);
- if (index < 0 || index >= isc__backtrace_nsymbols)
+ if (idx < 0 || idx >= isc__backtrace_nsymbols)
return (ISC_R_RANGE);
- *addrp = isc__backtrace_symtable[index].addr;
- *symbolp = isc__backtrace_symtable[index].symbol;
+ *addrp = isc__backtrace_symtable[idx].addr;
+ *symbolp = isc__backtrace_symtable[idx].symbol;
return (ISC_R_SUCCESS);
}
diff --git a/lib/isc/event.c b/lib/isc/event.c
index 8ab75240dca9..e97961682656 100644
--- a/lib/isc/event.c
+++ b/lib/isc/event.c
@@ -34,9 +34,7 @@
static void
destroy(isc_event_t *event) {
- isc_mem_t *mctx = event->ev_destroy_arg;
-
- isc_mem_put(mctx, event, event->ev_size);
+ isc_mem_put(event->ev_destroy_arg, event, event->ev_size);
}
isc_event_t *
diff --git a/lib/isc/include/isc/backtrace.h b/lib/isc/include/isc/backtrace.h
index c0e98c0b7530..7d7fc3217212 100644
--- a/lib/isc/include/isc/backtrace.h
+++ b/lib/isc/include/isc/backtrace.h
@@ -85,12 +85,12 @@ isc_backtrace_gettrace(void **addrs, int maxaddrs, int *nframes);
*/
isc_result_t
-isc_backtrace_getsymbolfromindex(int index, const void **addrp,
+isc_backtrace_getsymbolfromindex(int idx, const void **addrp,
const char **symbolp);
/*%<
* Returns the content of the internal symbol table of the given index.
* On success, *addrsp and *symbolp point to the address and the symbol of
- * the 'index'th entry of the table, respectively. If 'index' is not in the
+ * the 'index'th entry of the table, respectively. If 'idx' is not in the
* range of the symbol table, ISC_R_RANGE will be returned.
*
* Requires
diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h
index 38f6f78025df..46e05a077492 100644
--- a/lib/isc/include/isc/socket.h
+++ b/lib/isc/include/isc/socket.h
@@ -274,7 +274,7 @@ typedef struct isc_socketmgrmethods {
} isc_socketmgrmethods_t;
typedef struct isc_socketmethods {
- void (*attach)(isc_socket_t *socket,
+ void (*attach)(isc_socket_t *sock,
isc_socket_t **socketp);
void (*detach)(isc_socket_t **socketp);
isc_result_t (*bind)(isc_socket_t *sock, isc_sockaddr_t *sockaddr,
@@ -296,9 +296,9 @@ typedef struct isc_socketmethods {
isc_sockettype_t (*gettype)(isc_socket_t *sock);
void (*ipv6only)(isc_socket_t *sock, isc_boolean_t yes);
isc_result_t (*fdwatchpoke)(isc_socket_t *sock, int flags);
- isc_result_t (*dup)(isc_socket_t *socket,
+ isc_result_t (*dup)(isc_socket_t *sock,
isc_socket_t **socketp);
- int (*getfd)(isc_socket_t *socket);
+ int (*getfd)(isc_socket_t *sock);
} isc_socketmethods_t;
/*%
@@ -1094,24 +1094,24 @@ isc_socket_permunix(isc_sockaddr_t *sockaddr, isc_uint32_t perm,
* \li #ISC_R_FAILURE
*/
-void isc_socket_setname(isc_socket_t *socket, const char *name, void *tag);
+void isc_socket_setname(isc_socket_t *sock, const char *name, void *tag);
/*%<
* Set the name and optional tag for a socket. This allows tracking of the
* owner or purpose for this socket, and is useful for tracing and statistics
* reporting.
*/
-const char *isc_socket_getname(isc_socket_t *socket);
+const char *isc_socket_getname(isc_socket_t *sock);
/*%<
* Get the name associated with a socket, if any.
*/
-void *isc_socket_gettag(isc_socket_t *socket);
+void *isc_socket_gettag(isc_socket_t *sock);
/*%<
* Get the tag associated with a socket, if any.
*/
-int isc_socket_getfd(isc_socket_t *socket);
+int isc_socket_getfd(isc_socket_t *sock);
/*%<
* Get the file descriptor associated with a socket
*/
diff --git a/lib/isc/log.c b/lib/isc/log.c
index 0c142ce7707a..ce98303fecaf 100644
--- a/lib/isc/log.c
+++ b/lib/isc/log.c
@@ -1521,10 +1521,11 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
level_string[0] == '\0') {
if (level < ISC_LOG_CRITICAL)
snprintf(level_string, sizeof(level_string),
+ "%s %d: ",
isc_msgcat_get(isc_msgcat,
ISC_MSGSET_LOG,
ISC_MSG_LEVEL,
- "level %d: "),
+ "level"),
level);
else if (level > ISC_LOG_DYNAMIC)
snprintf(level_string, sizeof(level_string),
diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c
index d6928c10df8b..457576b77dd8 100644
--- a/lib/isc/netaddr.c
+++ b/lib/isc/netaddr.c
@@ -202,9 +202,10 @@ isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size) {
if (result != ISC_R_SUCCESS) {
snprintf(array, size,
+ "<%s %u>",
isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR,
ISC_MSG_UNKNOWNADDR,
- ""),
+ "unknown address, family"),
na->family);
array[size - 1] = '\0';
}
diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c
index 2a7268f96131..1ae5e7c91697 100644
--- a/lib/isc/sockaddr.c
+++ b/lib/isc/sockaddr.c
@@ -192,9 +192,10 @@ isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size) {
* The message is the same as in netaddr.c.
*/
snprintf(array, size,
+ "<%s %u>",
isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR,
ISC_MSG_UNKNOWNADDR,
- ""),
+ "unknown address, family"),
sa->type.sa.sa_family);
array[size - 1] = '\0';
}
@@ -230,10 +231,11 @@ isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) {
break;
default:
UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "%s: %d",
isc_msgcat_get(isc_msgcat,
ISC_MSGSET_SOCKADDR,
ISC_MSG_UNKNOWNFAMILY,
- "unknown address family: %d"),
+ "unknown address family"),
(int)sockaddr->type.sa.sa_family);
s = (const unsigned char *)&sockaddr->type;
length = sockaddr->length;
@@ -410,9 +412,10 @@ isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port) {
break;
default:
FATAL_ERROR(__FILE__, __LINE__,
+ "%s: %d",
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
ISC_MSG_UNKNOWNFAMILY,
- "unknown address family: %d"),
+ "unknown address family"),
(int)sockaddr->type.sa.sa_family);
}
}
@@ -430,9 +433,10 @@ isc_sockaddr_getport(const isc_sockaddr_t *sockaddr) {
break;
default:
FATAL_ERROR(__FILE__, __LINE__,
+ "%s: %d",
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
ISC_MSG_UNKNOWNFAMILY,
- "unknown address family: %d"),
+ "unknown address family"),
(int)sockaddr->type.sa.sa_family);
}
diff --git a/lib/isc/unix/ifiter_getifaddrs.c b/lib/isc/unix/ifiter_getifaddrs.c
index 547a83f07937..c2e4044ac008 100644
--- a/lib/isc/unix/ifiter_getifaddrs.c
+++ b/lib/isc/unix/ifiter_getifaddrs.c
@@ -96,9 +96,13 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
}
if (ret < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__, isc_msgcat_get(isc_msgcat,
- ISC_MSGSET_IFITERGETIFADDRS, ISC_MSG_GETIFADDRS,
- "getting interface addresses: getifaddrs: %s"), strbuf);
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "getting interface addresses: %s: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_IFITERGETIFADDRS,
+ ISC_MSG_GETIFADDRS,
+ "getifaddrs"),
+ strbuf);
result = ISC_R_UNEXPECTED;
goto failure;
}
diff --git a/libjsmn/jsmn.c b/libjsmn/jsmn.c
index 4f70adb0db24..aa8b12b8020d 100644
--- a/libjsmn/jsmn.c
+++ b/libjsmn/jsmn.c
@@ -9,7 +9,7 @@
static jsmntok_t *jsmn_alloc_token(jsmn_parser *parser,
jsmntok_t *tokens, size_t num_tokens) {
jsmntok_t *tok;
- if (parser->toknext >= num_tokens) {
+ if ((size_t)parser->toknext >= num_tokens) {
return NULL;
}
tok = &tokens[parser->toknext++];
@@ -108,6 +108,8 @@ static jsmnerr_t jsmn_parse_string(jsmn_parser *parser, const char *js,
/* Backslash: Quoted symbol expected */
if (c == '\\') {
+ int i = 0;
+
parser->pos++;
switch (js[parser->pos]) {
/* Allowed escaped symbols */
@@ -117,7 +119,6 @@ static jsmnerr_t jsmn_parse_string(jsmn_parser *parser, const char *js,
/* Allows escaped symbol \uXXXX */
case 'u':
parser->pos++;
- int i = 0;
for(; i < 4 && js[parser->pos] != '\0'; i++) {
/* If it isn't a hex character we have an error */
if(!((js[parser->pos] >= 48 && js[parser->pos] <= 57) || /* 0-9 */
diff --git a/libntp/Makefile.in b/libntp/Makefile.in
index 39f287521e15..ca8b13c50ba6 100644
--- a/libntp/Makefile.in
+++ b/libntp/Makefile.in
@@ -268,6 +268,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -302,7 +303,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/libntp/atoint.c b/libntp/atoint.c
index 1064b366af16..9da8c13c32d6 100644
--- a/libntp/atoint.c
+++ b/libntp/atoint.c
@@ -35,7 +35,7 @@ atoint(
u = 0;
while (*cp != '\0') {
- if (!isdigit((int)*cp))
+ if (!isdigit((unsigned char)*cp))
return 0;
if (u > 214748364 || (u == 214748364 && *cp > oflow_digit))
return 0; /* overflow */
diff --git a/libntp/atolfp.c b/libntp/atolfp.c
index 4afeb23d33aa..3a65f6bcb2f7 100644
--- a/libntp/atolfp.c
+++ b/libntp/atolfp.c
@@ -52,7 +52,7 @@ atolfp(
*
* [spaces][-|+][digits][.][digits][spaces|\n|\0]
*/
- while (isspace((int)*cp))
+ while (isspace((unsigned char)*cp))
cp++;
if (*cp == '-') {
@@ -63,7 +63,7 @@ atolfp(
if (*cp == '+')
cp++;
- if (*cp != '.' && !isdigit((int)*cp))
+ if (*cp != '.' && !isdigit((unsigned char)*cp))
return 0;
while (*cp != '\0' && (ind = strchr(digits, *cp)) != NULL) {
@@ -72,7 +72,7 @@ atolfp(
cp++;
}
- if (*cp != '\0' && !isspace((int)*cp)) {
+ if (*cp != '\0' && !isspace((unsigned char)*cp)) {
if (*cp++ != '.')
return 0;
@@ -84,10 +84,10 @@ atolfp(
cp++;
}
- while (isdigit((int)*cp))
+ while (isdigit((unsigned char)*cp))
cp++;
- if (*cp != '\0' && !isspace((int)*cp))
+ if (*cp != '\0' && !isspace((unsigned char)*cp))
return 0;
}
diff --git a/libntp/atouint.c b/libntp/atouint.c
index ab86130dfcdc..0a6163907a51 100644
--- a/libntp/atouint.c
+++ b/libntp/atouint.c
@@ -28,7 +28,7 @@ atouint(
u = 0;
while ('\0' != *cp) {
- if (!isdigit(*cp))
+ if (!isdigit((unsigned char)*cp))
return 0;
if (u > 429496729 || (u == 429496729 && *cp >= '6'))
return 0; /* overflow */
diff --git a/libntp/audio.c b/libntp/audio.c
index 2a56619827f4..6f2262c991f3 100644
--- a/libntp/audio.c
+++ b/libntp/audio.c
@@ -67,7 +67,7 @@ static struct audio_info info; /* audio device info */
static int ctl_fd; /* audio control file descriptor */
#ifdef PCM_STYLE_SOUND
-static void audio_config_read (int, char **, char **);
+static void audio_config_read (int, const char **, const char **);
static int mixer_name (const char *, int);
@@ -114,8 +114,8 @@ mixer_name(
static void
audio_config_read(
int unit,
- char **c_dev, /* Control device */
- char **i_dev /* input device */
+ const char **c_dev, /* Control device */
+ const char **i_dev /* input device */
)
{
FILE *fd;
@@ -148,12 +148,12 @@ audio_config_read(
/* Remove any trailing spaces */
for (i = strlen(line);
- i > 0 && isascii((int)line[i - 1]) && isspace((int)line[i - 1]);
+ i > 0 && isascii((unsigned char)line[i - 1]) && isspace((unsigned char)line[i - 1]);
)
line[--i] = '\0';
/* Remove leading space */
- for (cc = line; *cc && isascii((int)*cc) && isspace((int)*cc); cc++)
+ for (cc = line; *cc && isascii((unsigned char)*cc) && isspace((unsigned char)*cc); cc++)
continue;
/* Stop if nothing left */
@@ -162,16 +162,16 @@ audio_config_read(
/* Uppercase the command and find the arg */
for (ca = cc; *ca; ca++) {
- if (isascii((int)*ca)) {
- if (islower((int)*ca)) {
- *ca = toupper(*ca);
- } else if (isspace((int)*ca) || (*ca == '='))
+ if (isascii((unsigned char)*ca)) {
+ if (islower((unsigned char)*ca)) {
+ *ca = toupper((unsigned char)*ca);
+ } else if (isspace((unsigned char)*ca) || (*ca == '='))
break;
}
}
/* Remove space (and possible =) leading the arg */
- for (; *ca && isascii((int)*ca) && (isspace((int)*ca) || (*ca == '=')); ca++)
+ for (; *ca && isascii((unsigned char)*ca) && (isspace((unsigned char)*ca) || (*ca == '=')); ca++)
continue;
if (!strncmp(cc, "IDEV", 4) &&
@@ -210,7 +210,7 @@ audio_config_read(
*/
int
audio_init(
- char *dname, /* device name */
+ const char *dname, /* device name */
int bufsiz, /* buffer size */
int unit /* device unit (0-3) */
)
@@ -227,7 +227,7 @@ audio_init(
#endif
int fd;
int rval;
- char *actl =
+ const char *actl =
#ifdef PCM_STYLE_SOUND
actl_dev
#else
diff --git a/libntp/authkeys.c b/libntp/authkeys.c
index 7b4427cd2f40..68771ffb339f 100644
--- a/libntp/authkeys.c
+++ b/libntp/authkeys.c
@@ -517,7 +517,7 @@ MD5auth_setkey(
keyid_t keyno,
int keytype,
const u_char *key,
- int len
+ size_t len
)
{
symkey * sk;
@@ -527,7 +527,6 @@ MD5auth_setkey(
DEBUG_ENSURE(keytype <= USHRT_MAX);
DEBUG_ENSURE(len < 4 * 1024);
- len = max(0, len);
/*
* See if we already have the key. If so just stick in the
* new value.
diff --git a/libntp/authreadkeys.c b/libntp/authreadkeys.c
index 9b02119d169a..e8ddc942a665 100644
--- a/libntp/authreadkeys.c
+++ b/libntp/authreadkeys.c
@@ -77,8 +77,8 @@ authreadkeys(
int keytype;
char buf[512]; /* lots of room for line */
u_char keystr[32]; /* Bug 2537 */
- int len;
- int j;
+ size_t len;
+ size_t j;
/*
* Open file. Complain and return if it can't be opened.
@@ -181,11 +181,11 @@ authreadkeys(
char hex[] = "0123456789abcdef";
u_char temp;
char *ptr;
- int jlim;
+ size_t jlim;
jlim = min(len, 2 * sizeof(keystr));
for (j = 0; j < jlim; j++) {
- ptr = strchr(hex, tolower(token[j]));
+ ptr = strchr(hex, tolower((unsigned char)token[j]));
if (ptr == NULL)
break; /* abort decoding */
temp = (u_char)(ptr - hex);
diff --git a/libntp/emalloc.c b/libntp/emalloc.c
index c49c5c1e1781..6c1c6787ea41 100644
--- a/libntp/emalloc.c
+++ b/libntp/emalloc.c
@@ -86,6 +86,7 @@ estrdup_impl(
}
+#if 0
#ifndef EREALLOC_CALLSITE
void *
emalloc(size_t newsz)
@@ -93,4 +94,5 @@ emalloc(size_t newsz)
return ereallocz(NULL, newsz, 0, FALSE);
}
#endif
+#endif
diff --git a/libntp/hextoint.c b/libntp/hextoint.c
index d24b5a0bf8a5..980a43f9d899 100644
--- a/libntp/hextoint.c
+++ b/libntp/hextoint.c
@@ -23,7 +23,7 @@ hextoint(
u = 0;
while (*cp != '\0') {
- if (!isxdigit(*cp))
+ if (!isxdigit((unsigned char)*cp))
return 0;
if (u & 0xF0000000)
return 0; /* overflow */
diff --git a/libntp/hextolfp.c b/libntp/hextolfp.c
index 8fbce2e5b863..2bff929dc388 100644
--- a/libntp/hextolfp.c
+++ b/libntp/hextolfp.c
@@ -30,7 +30,7 @@ hextolfp(
*
* [spaces]8_hex_digits[.]8_hex_digits[spaces|\n|\0]
*/
- while (isspace((int)*cp))
+ while (isspace((unsigned char)*cp))
cp++;
cpstart = cp;
@@ -59,7 +59,7 @@ hextolfp(
if ((cp - cpstart) < 8 || ind == NULL)
return 0;
- if (*cp != '\0' && !isspace((int)*cp))
+ if (*cp != '\0' && !isspace((unsigned char)*cp))
return 0;
lfp->l_ui = dec_i;
diff --git a/libntp/humandate.c b/libntp/humandate.c
index f88d8d24cb4d..d9d5e89df017 100644
--- a/libntp/humandate.c
+++ b/libntp/humandate.c
@@ -13,7 +13,7 @@
/* This is used in msyslog.c; we don't want to clutter up the log with
the year and day of the week, etc.; just the minimal date and time. */
-char *
+const char *
humanlogtime(void)
{
char * bp;
@@ -39,7 +39,7 @@ humanlogtime(void)
* humantime() -- like humanlogtime() but without date, and with the
* time to display given as an argument.
*/
-char *
+const char *
humantime(
time_t cursec
)
diff --git a/libntp/icom.c b/libntp/icom.c
index c981d8548418..80700114255e 100644
--- a/libntp/icom.c
+++ b/libntp/icom.c
@@ -121,17 +121,15 @@ doublefreq( /* returns void */
*/
int
icom_init(
- char *device, /* device name/link */
+ const char *device, /* device name/link */
int speed, /* line speed */
int trace /* trace flags */ )
{
TTY ttyb;
int fd;
- int flags;
int rc;
int saved_errno;
- flags = trace;
fd = tty_open(device, O_RDWR, 0777);
if (fd < 0)
return -1;
diff --git a/libntp/modetoa.c b/libntp/modetoa.c
index b476bc9e90f2..6f13d20580bf 100644
--- a/libntp/modetoa.c
+++ b/libntp/modetoa.c
@@ -9,7 +9,7 @@
const char *
modetoa(
- int mode
+ size_t mode
)
{
char *bp;
@@ -25,9 +25,9 @@ modetoa(
"bclient",
};
- if (mode < 0 || mode >= COUNTOF(modestrings)) {
+ if (mode >= COUNTOF(modestrings)) {
LIB_GETBUF(bp);
- snprintf(bp, LIB_BUFLENGTH, "mode#%d", mode);
+ snprintf(bp, LIB_BUFLENGTH, "mode#%zu", mode);
return bp;
}
diff --git a/libntp/mstolfp.c b/libntp/mstolfp.c
index 1a1a02b5fc46..828b14cfbca8 100644
--- a/libntp/mstolfp.c
+++ b/libntp/mstolfp.c
@@ -32,7 +32,7 @@ mstolfp(
*/
bp = buf;
cp = str;
- while (isspace((int)*cp))
+ while (isspace((unsigned char)*cp))
cp++;
if (*cp == '-') {
@@ -40,7 +40,7 @@ mstolfp(
cp++;
}
- if (*cp != '.' && !isdigit((int)*cp))
+ if (*cp != '.' && !isdigit((unsigned char)*cp))
return 0;
@@ -48,7 +48,7 @@ mstolfp(
* Search forward for the decimal point or the end of the string.
*/
cpdec = cp;
- while (isdigit((int)*cpdec))
+ while (isdigit((unsigned char)*cpdec))
cpdec++;
/*
@@ -86,7 +86,7 @@ mstolfp(
if (*cp == '.') {
cp++;
- while (isdigit((int)*cp))
+ while (isdigit((unsigned char)*cp))
*bp++ = (char)*cp++;
}
*bp = '\0';
@@ -95,7 +95,7 @@ mstolfp(
* Check to make sure the string is properly terminated. If
* so, give the buffer to the decoding routine.
*/
- if (*cp != '\0' && !isspace((int)*cp))
+ if (*cp != '\0' && !isspace((unsigned char)*cp))
return 0;
return atolfp(buf, lfp);
}
diff --git a/libntp/ntp_calendar.c b/libntp/ntp_calendar.c
index e557f4ec682e..94ca0e9ee154 100644
--- a/libntp/ntp_calendar.c
+++ b/libntp/ntp_calendar.c
@@ -153,7 +153,11 @@ ntpcal_get_build_date(
* problem.
*
*/
+#ifdef MKREPRO_DATE
+ static const char build[] = MKREPRO_TIME "/" MKREPRO_DATE;
+#else
static const char build[] = __TIME__ "/" __DATE__;
+#endif
static const char mlist[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
char monstr[4];
@@ -1561,7 +1565,7 @@ isocal_ntp64_to_date(
id->year = (uint16_t)ds.hi + 1; /* shift to current */
id->week = (uint8_t )ds.lo + 1;
- return (ds.hi >= 0 && ds.hi < 0xFFFFU);
+ return (ds.hi >= 0 && ds.hi < 0x0000FFFF);
}
int
diff --git a/libntp/ntp_crypto_rnd.c b/libntp/ntp_crypto_rnd.c
index 62a808db3447..96348f2e8696 100644
--- a/libntp/ntp_crypto_rnd.c
+++ b/libntp/ntp_crypto_rnd.c
@@ -22,6 +22,22 @@
#include
int crypto_rand_init = 0;
+#else
+
+# ifndef HAVE_ARC4RANDOM_BUF
+static void
+arc4random_buf(void *buf, size_t nbytes);
+
+void
+evutil_secure_rng_get_bytes(void *buf, size_t nbytes);
+
+static void
+arc4random_buf(void *buf, size_t nbytes)
+{
+ evutil_secure_rng_get_bytes(buf, nbytes);
+ return;
+}
+# endif
#endif
/*
@@ -85,6 +101,7 @@ ntp_crypto_random_buf(
err = ERR_get_error();
err_str = ERR_error_string(err, NULL);
/* XXX: Log the error */
+ (void)&err_str;
return -1;
}
diff --git a/libntp/ntp_intres.c b/libntp/ntp_intres.c
index 2ac70c1a416d..eea88a127378 100644
--- a/libntp/ntp_intres.c
+++ b/libntp/ntp_intres.c
@@ -684,11 +684,11 @@ blocking_getnameinfo(
blocking_gni_resp * gni_resp;
size_t octets;
size_t resp_octets;
- char * host;
char * service;
char * cp;
int rc;
time_t time_now;
+ char host[1024];
gni_req = (void *)((char *)req + sizeof(*req));
@@ -699,19 +699,7 @@ blocking_getnameinfo(
* large allocations. We only need room for the host
* and service names.
*/
- NTP_REQUIRE(octets < 1024);
-
-#ifndef HAVE_ALLOCA
- host = emalloc(octets);
-#else
- host = alloca(octets);
- if (NULL == host) {
- msyslog(LOG_ERR,
- "blocking_getnameinfo unable to allocate %lu octets on stack",
- (u_long)octets);
- exit(1);
- }
-#endif
+ NTP_REQUIRE(octets < sizeof(host));
service = host + gni_req->hostoctets;
worker_ctx = get_worker_context(c, gni_req->dns_idx);
@@ -793,9 +781,6 @@ blocking_getnameinfo(
rc = queue_blocking_response(c, resp, resp_octets, req);
if (rc)
msyslog(LOG_ERR, "blocking_getnameinfo unable to queue response");
-#ifndef HAVE_ALLOCA
- free(host);
-#endif
return rc;
}
diff --git a/libntp/ntp_lineedit.c b/libntp/ntp_lineedit.c
index c5aad3108614..e3bc0022a292 100644
--- a/libntp/ntp_lineedit.c
+++ b/libntp/ntp_lineedit.c
@@ -178,23 +178,22 @@ ntp_readline(
if (NULL != line) {
if (*line) {
add_history(line);
- *pcount = strlen(line);
- } else {
- free(line);
- line = NULL;
}
+ *pcount = strlen(line);
}
#endif /* LE_READLINE */
#ifdef LE_EDITLINE
cline = el_gets(ntp_el, pcount);
- if (NULL != cline && *cline) {
+ if (NULL != cline) {
history(ntp_hist, &hev, H_ENTER, cline);
- *pcount = strlen(cline);
line = estrdup(cline);
- } else
+ } else if (*pcount == -1) {
line = NULL;
+ } else {
+ line = estrdup("");
+ }
#endif /* LE_EDITLINE */
#ifdef LE_NONE
diff --git a/libntp/octtoint.c b/libntp/octtoint.c
index d189e40c494d..e519601d067e 100644
--- a/libntp/octtoint.c
+++ b/libntp/octtoint.c
@@ -24,7 +24,7 @@ octtoint(
u = 0;
while (*cp != '\0') {
- if (!isdigit((int)*cp) || *cp == '8' || *cp == '9')
+ if (!isdigit((unsigned char)*cp) || *cp == '8' || *cp == '9')
return 0;
if (u >= 0x20000000)
return 0; /* overflow */
diff --git a/libntp/prettydate.c b/libntp/prettydate.c
index f12129716199..5da5ecc50a69 100644
--- a/libntp/prettydate.c
+++ b/libntp/prettydate.c
@@ -133,7 +133,7 @@ get_struct_tm(
if (--folds < MINFOLD)
return NULL;
ts += SOLAR_CYCLE_SECS;
- } else if (ts >= SOLAR_CYCLE_SECS) {
+ } else if (ts >= (time_t)SOLAR_CYCLE_SECS) {
if (++folds > MAXFOLD)
return NULL;
ts -= SOLAR_CYCLE_SECS;
@@ -157,10 +157,10 @@ common_prettydate(
int local
)
{
- static const char* pfmt[2] = {
- "%08lx.%08lx %s, %s %2d %4d %2d:%02d:%02d.%03u",
- "%08lx.%08lx [%s, %s %2d %4d %2d:%02d:%02d.%03u UTC]"
- };
+ static const char pfmt0[] =
+ "%08lx.%08lx %s, %s %2d %4d %2d:%02d:%02d.%03u";
+ static const char pfmt1[] =
+ "%08lx.%08lx [%s, %s %2d %4d %2d:%02d:%02d.%03u UTC]";
char *bp;
struct tm *tm;
@@ -186,13 +186,13 @@ common_prettydate(
*/
struct calendar jd;
ntpcal_time_to_date(&jd, &sec);
- snprintf(bp, LIB_BUFLENGTH, pfmt[local != 0],
+ snprintf(bp, LIB_BUFLENGTH, local ? pfmt1 : pfmt0,
(u_long)ts->l_ui, (u_long)ts->l_uf,
daynames[jd.weekday], months[jd.month-1],
jd.monthday, jd.year, jd.hour,
jd.minute, jd.second, msec);
} else
- snprintf(bp, LIB_BUFLENGTH, pfmt[0],
+ snprintf(bp, LIB_BUFLENGTH, pfmt0,
(u_long)ts->l_ui, (u_long)ts->l_uf,
daynames[tm->tm_wday], months[tm->tm_mon],
tm->tm_mday, 1900 + tm->tm_year, tm->tm_hour,
diff --git a/libntp/ssl_init.c b/libntp/ssl_init.c
index 7f1e9a096b20..a9d1d546dfb8 100644
--- a/libntp/ssl_init.c
+++ b/libntp/ssl_init.c
@@ -96,13 +96,13 @@ keytype_from_text(
LIB_GETBUF(upcased);
strlcpy(upcased, text, LIB_BUFLENGTH);
for (pch = upcased; '\0' != *pch; pch++)
- *pch = (char)toupper(*pch);
+ *pch = (char)toupper((unsigned char)*pch);
key_type = OBJ_sn2nid(upcased);
#else
key_type = 0;
#endif
- if (!key_type && 'm' == tolower(text[0]))
+ if (!key_type && 'm' == tolower((unsigned char)text[0]))
key_type = NID_md5;
if (!key_type)
diff --git a/libntp/timetoa.c b/libntp/timetoa.c
index c04d34ea0639..f294e16107f9 100644
--- a/libntp/timetoa.c
+++ b/libntp/timetoa.c
@@ -57,14 +57,12 @@ format_time_fraction(
u_int u;
long fraclimit;
int notneg; /* flag for non-negative value */
- const char * fmt;
ldiv_t qr;
DEBUG_REQUIRE(prec != 0);
LIB_GETBUF(cp);
secs_u = (u_time)secs;
- fmt = "-%" UTIME_FORMAT ".%0*ld";
/* check if we need signed or unsigned mode */
notneg = (prec < 0);
@@ -92,9 +90,7 @@ format_time_fraction(
/* Get the absolute value of the split representation time. */
notneg = notneg || ((time_t)secs_u >= 0);
- if (notneg) {
- fmt++; /* skip '-' */
- } else {
+ if (!notneg) {
secs_u = ~secs_u;
if (0 == frac)
secs_u++;
@@ -103,7 +99,8 @@ format_time_fraction(
}
/* finally format the data and return the result */
- snprintf(cp, LIB_BUFLENGTH, fmt, secs_u, prec_u, frac);
+ snprintf(cp, LIB_BUFLENGTH, "%s%" UTIME_FORMAT ".%0*ld",
+ notneg? "" : "-", secs_u, prec_u, frac);
return cp;
}
diff --git a/libparse/Makefile.am b/libparse/Makefile.am
index a92db1546cbf..2988e08e2bc2 100644
--- a/libparse/Makefile.am
+++ b/libparse/Makefile.am
@@ -1,5 +1,5 @@
NULL=
-BUILT_SOURCES =
+BUILT_SOURCES = $(VPHACK) info_trimble.c $(VPHACK_AFTER)
CLEANFILES =
noinst_LIBRARIES = @MAKE_LIBPARSE@ @MAKE_LIBPARSE_KERNEL@
EXTRA_LIBRARIES = libparse.a libparse_kernel.a
@@ -12,6 +12,29 @@ K_CFLAGS = -DPARSESTREAM -DNTP_NEED_BOPS
# previously. It is located in $(srcdir) and any updates must
# end up there.
+#
+# VPHACK and VPHACK_AFTER are enabled on non-GNU makes (such as
+# BSD make) to work around build/dependency issues where we want
+# built source files to live in srcdir, as opposed to builddir.
+#
+
+if VPATH_HACK
+VPHACK= vphack
+VPHACK_AFTER= vphack_after
+else
+VPHACK=
+VPHACK_AFTER=
+endif
+
+vphack:
+ test -e info_trimble.c || ln -s $(srcdir)/info_trimble.c .
+
+vphack_after:
+ test -L info_trimble.c || ( \
+ mv info_trimble.c $(srcdir)/info_trimble.c && \
+ ln -s $(srcdir)/info_trimble.c . \
+ )
+
libparse_a_SOURCES = parse.c \
parse_conf.c \
clk_meinberg.c \
@@ -65,11 +88,16 @@ AM_CPPFLAGS += $(CPPFLAGS_NTP)
EXTRA_DIST = parsesolaris.c parsestreams.c mkinfo_scmd.sed mkinfo_rcmd.sed info_trimble.c
-$(srcdir)/info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
+info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.new
sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.new
mv -f info_trimble.new $@
+#$(srcdir)/info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
+# sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.new
+# sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.new
+# mv -f info_trimble.new $@
+
kieee754io.o: $(srcdir)/ieee754io.c
$(COMPILE) $(K_CFLAGS) -c $(srcdir)/ieee754io.c -o $@
diff --git a/libparse/Makefile.in b/libparse/Makefile.in
index 606763edf963..15a989b318fd 100644
--- a/libparse/Makefile.in
+++ b/libparse/Makefile.in
@@ -176,6 +176,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -210,7 +211,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
@@ -408,16 +411,27 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
NULL =
-BUILT_SOURCES = check-libntp .deps-ver
+BUILT_SOURCES = $(VPHACK) info_trimble.c $(VPHACK_AFTER) check-libntp \
+ .deps-ver
CLEANFILES = check-libntp .deps-ver
noinst_LIBRARIES = @MAKE_LIBPARSE@ @MAKE_LIBPARSE_KERNEL@
EXTRA_LIBRARIES = libparse.a libparse_kernel.a
noinst_PROGRAMS = @MAKE_PARSEKMODULE@
K_CFLAGS = -DPARSESTREAM -DNTP_NEED_BOPS
+@VPATH_HACK_FALSE@VPHACK =
# info_trimble.c was mistakenly created in the build directory
# previously. It is located in $(srcdir) and any updates must
# end up there.
+
+#
+# VPHACK and VPHACK_AFTER are enabled on non-GNU makes (such as
+# BSD make) to work around build/dependency issues where we want
+# built source files to live in srcdir, as opposed to builddir.
+#
+@VPATH_HACK_TRUE@VPHACK = vphack
+@VPATH_HACK_FALSE@VPHACK_AFTER =
+@VPATH_HACK_TRUE@VPHACK_AFTER = vphack_after
libparse_a_SOURCES = parse.c \
parse_conf.c \
clk_meinberg.c \
@@ -794,11 +808,25 @@ uninstall-am:
tags uninstall uninstall-am
-$(srcdir)/info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
+vphack:
+ test -e info_trimble.c || ln -s $(srcdir)/info_trimble.c .
+
+vphack_after:
+ test -L info_trimble.c || ( \
+ mv info_trimble.c $(srcdir)/info_trimble.c && \
+ ln -s $(srcdir)/info_trimble.c . \
+ )
+
+info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.new
sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.new
mv -f info_trimble.new $@
+#$(srcdir)/info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
+# sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.new
+# sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.new
+# mv -f info_trimble.new $@
+
kieee754io.o: $(srcdir)/ieee754io.c
$(COMPILE) $(K_CFLAGS) -c $(srcdir)/ieee754io.c -o $@
diff --git a/libparse/clk_meinberg.c b/libparse/clk_meinberg.c
index bc0ac0e8170a..a94c3f7a2edd 100644
--- a/libparse/clk_meinberg.c
+++ b/libparse/clk_meinberg.c
@@ -157,7 +157,7 @@ mbg_csum(
)
{
unsigned long sum = 0;
- short i;
+ unsigned int i;
for ( i = 0; i < n; i++ )
sum += *p++;
diff --git a/libparse/clk_rawdcf.c b/libparse/clk_rawdcf.c
index 98848bee8fb0..d6e4b184c050 100644
--- a/libparse/clk_rawdcf.c
+++ b/libparse/clk_rawdcf.c
@@ -125,12 +125,12 @@ clockformat_t clock_rawdcf =
static struct dcfparam
{
- unsigned char *onebits;
- unsigned char *zerobits;
+ const unsigned char *onebits;
+ const unsigned char *zerobits;
} dcfparameter =
{
- (unsigned char *)"###############RADMLS1248124P124812P1248121241248112481248P??", /* 'ONE' representation */
- (unsigned char *)"--------------------s-------p------p----------------------p__" /* 'ZERO' representation */
+ (const unsigned char *)"###############RADMLS1248124P124812P1248121241248112481248P??", /* 'ONE' representation */
+ (const unsigned char *)"--------------------s-------p------p----------------------p__" /* 'ZERO' representation */
};
static struct rawdcfcode
@@ -182,7 +182,7 @@ static u_long
ext_bf(
unsigned char *buf,
int idx,
- unsigned char *zero
+ const unsigned char *zero
)
{
u_long sum = 0;
@@ -202,7 +202,7 @@ static unsigned
pcheck(
unsigned char *buf,
int idx,
- unsigned char *zero
+ const unsigned char *zero
)
{
int i,last;
@@ -225,8 +225,8 @@ convert_rawdcf(
)
{
unsigned char *s = buffer;
- unsigned char *b = dcfprm->onebits;
- unsigned char *c = dcfprm->zerobits;
+ const unsigned char *b = dcfprm->onebits;
+ const unsigned char *c = dcfprm->zerobits;
int i;
parseprintf(DD_RAWDCF,("parse: convert_rawdcf: \"%s\"\n", buffer));
@@ -342,8 +342,8 @@ cvt_rawdcf(
last_tcode_t *t = (last_tcode_t *)local;
unsigned char *s = (unsigned char *)buffer;
unsigned char *e = s + size;
- unsigned char *b = dcfparameter.onebits;
- unsigned char *c = dcfparameter.zerobits;
+ const unsigned char *b = dcfparameter.onebits;
+ const unsigned char *c = dcfparameter.zerobits;
u_long rtc = CVT_NONE;
unsigned int i, lowmax, highmax, cutoff, span;
#define BITS 9
diff --git a/libparse/data_mbg.c b/libparse/data_mbg.c
index 97bef35c4479..23ca75509180 100644
--- a/libparse/data_mbg.c
+++ b/libparse/data_mbg.c
@@ -266,8 +266,8 @@ mbg_tm_str(
tmp->year, tmp->month, tmp->mday,
tmp->hour, tmp->minute, tmp->second, tmp->frac,
(tmp->offs_from_utc < 0) ? '-' : '+',
- abs(tmp->offs_from_utc) / 3600,
- (abs(tmp->offs_from_utc) / 60) % 60);
+ abs((int)tmp->offs_from_utc) / 3600,
+ (abs((int)tmp->offs_from_utc) / 60) % 60);
*buffpp += strlen(*buffpp);
mbg_time_status_str(buffpp, tmp->status, size - (*buffpp - s));
@@ -383,7 +383,7 @@ get_mbg_comparam(
COM_PARM *comparamp
)
{
- int i;
+ size_t i;
comparamp->baud_rate = get_lsb_long(buffpp);
for (i = 0; i < sizeof(comparamp->framing); i++)
diff --git a/libparse/info_trimble.c b/libparse/info_trimble.c
index eea6cbd3f52c..53b2e32c1ac5 100644
--- a/libparse/info_trimble.c
+++ b/libparse/info_trimble.c
@@ -2,6 +2,7 @@
* Automatically generated - do not modify
*/
+#include
#include "ntp_types.h"
#include "ntpd.h"
#include "trimble.h"
@@ -47,7 +48,7 @@ cmd_info_t trimble_scmds[] = {
{ CMD_CHIGH8CNT, "CMD_CHIGH8CNT", "high-8 (best 4) / high-6 (overdetermined) control (0x75)", "", 0 },
{ CMD_CMAXDGPSCOR, "CMD_CMAXDGPSCOR", "maximum rate of DGPS corrections (0x77)", "", 0 },
{ CMD_CSUPER, "CMD_CSUPER", "super paket (0x8E)", "", 0 },
- { 0xFF, "", "" }
+ { 0xFF, "", "", "", 0 }
};
@@ -89,6 +90,5 @@ cmd_info_t trimble_rcmds[] = {
{ CMD_RDOUBLELLA, "CMD_RDOUBLELLA", "double precision LLA (0x84)", "gps_position_ext(LLA)", RO|DEF },
{ CMD_RDGPSSTAT, "CMD_RDGPSSTAT", "differential correction status (0x85)", "trimble_dgpsstatus", RO },
{ CMD_RSUPER, "CMD_RSUPER", "super paket (0x8F)", "", 0 },
- { 0xFF, "", "" }
+ { 0xFF, "", "", "", 0 }
};
-
diff --git a/libparse/mkinfo_rcmd.sed b/libparse/mkinfo_rcmd.sed
index 5238d5c4eb13..b8ed6232e615 100644
--- a/libparse/mkinfo_rcmd.sed
+++ b/libparse/mkinfo_rcmd.sed
@@ -4,5 +4,5 @@
cmd_info_t trimble_rcmds[] = {
s!^#define[ \ ][ \ ]*\(CMD_R[^ \ ]*\)[ \ ][ \ ]*\([^ \ ]*\)[ \ ][ \ ]*/\*[ \ ][ \ ]*\(.*\)[ \ ]*:\([^:]*\):\([^:]*\)[ \ ][ \ ]*\*/!\ { \1, "\1", "\3 (\2)", "\4", \5 },!p
$a\
-\ { 0xFF, "", "" }\
+\ { 0xFF, "", "", "", 0 }\
};
diff --git a/libparse/mkinfo_scmd.sed b/libparse/mkinfo_scmd.sed
index 9c17f39ed703..fb58d32db5d3 100644
--- a/libparse/mkinfo_scmd.sed
+++ b/libparse/mkinfo_scmd.sed
@@ -11,5 +11,5 @@
cmd_info_t trimble_scmds[] = {
s!^#define[ ][ ]*\(CMD_C[^ ]*\)[ ][ ]*\([^ ]*\)[ ][ ]*/\*[ ][ ]*\(.*\)[ ][ ]*\*/! { \1, "\1", "\3 (\2)", "", 0 },!p
$a\
-\ { 0xFF, "", "" }\
+\ { 0xFF, "", "", "", 0 }\
};
diff --git a/ntpd/Makefile.am b/ntpd/Makefile.am
index b3af52738c12..344ac8eb2ce7 100644
--- a/ntpd/Makefile.am
+++ b/ntpd/Makefile.am
@@ -90,7 +90,7 @@ man_MANS= ntpd.$(NTPD_MS)
LDADD_NTPD_COMMON = $(LDADD_LIBNTP) $(LIBOPTS_LDADD) $(PTHREAD_LIBS)
LDADD_NTPD_COMMON += $(LIBM) $(LDADD_NTP) $(LSCF)
-ntpd_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(LDADD_NTPD_COMMON)
+ntpd_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_NTPD_COMMON) $(LDADD_LIBUTIL)
ntpdsim_LDADD = $(LDADD) ../libntp/libntpsim.a $(LDADD_NTPD_COMMON)
ntpdsim_CPPFLAGS = $(AM_CPPFLAGS) -DSIM
check_y2k_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(LDADD_LIBNTP) $(PTHREAD_LIBS)
diff --git a/ntpd/Makefile.in b/ntpd/Makefile.in
index ae050114fd53..5ba1cbf6c2ad 100644
--- a/ntpd/Makefile.in
+++ b/ntpd/Makefile.in
@@ -158,8 +158,7 @@ am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
ntpd_DEPENDENCIES = $(am__DEPENDENCIES_2) ../libntp/libntp.a \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_3)
+ $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1)
am__objects_2 = ntpdsim-ntp_config.$(OBJEXT) ntpdsim-ntp_io.$(OBJEXT) \
ntpdsim-ntp_parser.$(OBJEXT) ntpdsim-ntp_scanner.$(OBJEXT) \
ntpdsim-ntpd.$(OBJEXT) ntpdsim-ntpd-opts.$(OBJEXT) \
@@ -256,6 +255,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -290,7 +290,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
@@ -537,7 +539,7 @@ man_MANS = ntpd.$(NTPD_MS)
# longer a reason to have ntpdbase-opts.def split off of ntpd-opts.def.
LDADD_NTPD_COMMON = $(LDADD_LIBNTP) $(LIBOPTS_LDADD) $(PTHREAD_LIBS) \
$(LIBM) $(LDADD_NTP) $(LSCF)
-ntpd_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(LDADD_NTPD_COMMON)
+ntpd_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_NTPD_COMMON) $(LDADD_LIBUTIL)
ntpdsim_LDADD = $(LDADD) ../libntp/libntpsim.a $(LDADD_NTPD_COMMON)
ntpdsim_CPPFLAGS = $(AM_CPPFLAGS) -DSIM
check_y2k_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(LDADD_LIBNTP) $(PTHREAD_LIBS)
diff --git a/ntpd/invoke-ntp.conf.texi b/ntpd/invoke-ntp.conf.texi
index 2678c189270e..23569fc52f6f 100644
--- a/ntpd/invoke-ntp.conf.texi
+++ b/ntpd/invoke-ntp.conf.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp.conf.texi)
#
-# It has been AutoGen-ed December 19, 2014 at 07:49:02 AM by AutoGen 5.18.5pre4
+# It has been AutoGen-ed February 4, 2015 at 02:41:59 AM by AutoGen 5.18.5pre4
# From the definitions ntp.conf.def
# and the template file agtexi-file.tpl
@end ignore
@@ -365,6 +365,20 @@ in order to avoid accidental or malicious disruption in this mode,
both the server and client should operate using symmetric-key or
public-key authentication as described in
@ref{Authentication Options}.
+@item @code{mdnstries} @kbd{number}
+If we are participating in mDNS,
+after we have synched for the first time
+we attempt to register with the mDNS system.
+If that registration attempt fails,
+we try again at one minute intervals for up to
+@code{mdnstries}
+times.
+After all,
+@code{ntpd}
+may be starting before mDNS.
+The default value for
+@code{mdnstries}
+is 5.
@end table
@node Authentication Support
@subsection Authentication Support
diff --git a/ntpd/invoke-ntp.keys.texi b/ntpd/invoke-ntp.keys.texi
index c8dc904d122a..dbafe1c733e9 100644
--- a/ntpd/invoke-ntp.keys.texi
+++ b/ntpd/invoke-ntp.keys.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp.keys.texi)
#
-# It has been AutoGen-ed December 19, 2014 at 07:49:05 AM by AutoGen 5.18.5pre4
+# It has been AutoGen-ed February 4, 2015 at 02:42:02 AM by AutoGen 5.18.5pre4
# From the definitions ntp.keys.def
# and the template file agtexi-file.tpl
@end ignore
diff --git a/ntpd/invoke-ntpd.texi b/ntpd/invoke-ntpd.texi
index e59b72f785eb..75a525702309 100644
--- a/ntpd/invoke-ntpd.texi
+++ b/ntpd/invoke-ntpd.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpd.texi)
#
-# It has been AutoGen-ed December 19, 2014 at 07:49:06 AM by AutoGen 5.18.5pre4
+# It has been AutoGen-ed February 4, 2015 at 02:42:04 AM by AutoGen 5.18.5pre4
# From the definitions ntpd-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -141,7 +141,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpd - NTP daemon program - Ver. 4.2.8
+ntpd - NTP daemon program - Ver. 4.2.8p1
Usage: ntpd [ - [] | --[@{=| @}] ]... \
[ ... ]
Flg Arg Option-Name Description
diff --git a/ntpd/keyword-gen-utd b/ntpd/keyword-gen-utd
index 7474a56ed7b6..0485feecca0c 100644
--- a/ntpd/keyword-gen-utd
+++ b/ntpd/keyword-gen-utd
@@ -1 +1 @@
- * Generated 2013-08-04 04:56:14 UTC diff_ignore_line
+ * Generated 2015-01-03 23:51:10 UTC diff_ignore_line
diff --git a/ntpd/keyword-gen.c b/ntpd/keyword-gen.c
index d4f77588d60c..bb593aba2e20 100644
--- a/ntpd/keyword-gen.c
+++ b/ntpd/keyword-gen.c
@@ -97,6 +97,7 @@ struct key_tok ntp_keywords[] = {
{ "iburst", T_Iburst, FOLLBY_TOKEN },
{ "key", T_Key, FOLLBY_TOKEN },
{ "maxpoll", T_Maxpoll, FOLLBY_TOKEN },
+{ "mdnstries", T_Mdnstries, FOLLBY_TOKEN },
{ "minpoll", T_Minpoll, FOLLBY_TOKEN },
{ "mode", T_Mode, FOLLBY_TOKEN },
{ "noselect", T_Noselect, FOLLBY_TOKEN },
@@ -357,7 +358,7 @@ generate_fsm(void)
fprintf(stderr,
"keyword-gen sst[%u] too small "
"for keyword '%s' id %d\n",
- COUNTOF(sst),
+ (int)COUNTOF(sst),
ntp_keywords[i].key,
token);
exit(4);
diff --git a/ntpd/ntp.conf.5man b/ntpd/ntp.conf.5man
index 95e9348cc55b..1e9ba668fe4d 100644
--- a/ntpd/ntp.conf.5man
+++ b/ntpd/ntp.conf.5man
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp.conf 5man "19 Dec 2014" "4.2.8" "File Formats"
+.TH ntp.conf 5man "04 Feb 2015" "4.2.8p1" "File Formats"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-eCaa6b/ag-rCai4b)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-sPaOCn/ag-RPaGBn)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:48:49 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:41:46 AM by AutoGen 5.18.5pre4
.\" From the definitions ntp.conf.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -415,6 +415,21 @@ in order to avoid accidental or malicious disruption in this mode,
both the server and client should operate using symmetric-key or
public-key authentication as described in
\fIAuthentication\f[] \fIOptions\f[].
+.TP 7
+.NOP \f\*[B-Font]mdnstries\f[] \f\*[I-Font]number\f[]
+If we are participating in mDNS,
+after we have synched for the first time
+we attempt to register with the mDNS system.
+If that registration attempt fails,
+we try again at one minute intervals for up to
+\f\*[B-Font]mdnstries\f[]
+times.
+After all,
+\f\*[B-Font]ntpd\f[]
+may be starting before mDNS.
+The default value for
+\f\*[B-Font]mdnstries\f[]
+is 5.
.PP
.SH Authentication Support
Authentication support allows the NTP client to verify that the
@@ -2974,9 +2989,9 @@ RFC5905
.PP
.SH "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.SH BUGS
The syntax checking is not picky; some combinations of
diff --git a/ntpd/ntp.conf.5mdoc b/ntpd/ntp.conf.5mdoc
index 3358d0c0b066..069a543cf2ea 100644
--- a/ntpd/ntp.conf.5mdoc
+++ b/ntpd/ntp.conf.5mdoc
@@ -1,9 +1,9 @@
-.Dd December 19 2014
+.Dd February 4 2015
.Dt NTP_CONF 5mdoc File Formats
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:49:09 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:42:07 AM by AutoGen 5.18.5pre4
.\" From the definitions ntp.conf.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -402,6 +402,20 @@ in order to avoid accidental or malicious disruption in this mode,
both the server and client should operate using symmetric\-key or
public\-key authentication as described in
.Sx Authentication Options .
+.It Ic mdnstries Ar number
+If we are participating in mDNS,
+after we have synched for the first time
+we attempt to register with the mDNS system.
+If that registration attempt fails,
+we try again at one minute intervals for up to
+.Ic mdnstries
+times.
+After all,
+.Ic ntpd
+may be starting before mDNS.
+The default value for
+.Ic mdnstries
+is 5.
.El
.Sh Authentication Support
Authentication support allows the NTP client to verify that the
@@ -2784,9 +2798,9 @@ A snapshot of this documentation is available in HTML format in
.%O RFC5905
.Re
.Sh "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.Sh BUGS
The syntax checking is not picky; some combinations of
diff --git a/ntpd/ntp.conf.def b/ntpd/ntp.conf.def
index 5a5af21f21d0..6f0bae12b3f5 100644
--- a/ntpd/ntp.conf.def
+++ b/ntpd/ntp.conf.def
@@ -404,6 +404,20 @@ in order to avoid accidental or malicious disruption in this mode,
both the server and client should operate using symmetric-key or
public-key authentication as described in
.Sx Authentication Options .
+.It Ic mdnstries Ar number
+If we are participating in mDNS,
+after we have synched for the first time
+we attempt to register with the mDNS system.
+If that registration attempt fails,
+we try again at one minute intervals for up to
+.Ic mdnstries
+times.
+After all,
+.Ic ntpd
+may be starting before mDNS.
+The default value for
+.Ic mdnstries
+is 5.
.El
.Sh Authentication Support
Authentication support allows the NTP client to verify that the
diff --git a/ntpd/ntp.conf.html b/ntpd/ntp.conf.html
index a57560a9a21e..b237cc025085 100644
--- a/ntpd/ntp.conf.html
+++ b/ntpd/ntp.conf.html
@@ -33,7 +33,7 @@ Up: (dir)
This document describes the configuration file for the NTP Project's
ntpd program.
-
This document applies to version 4.2.8 of ntp.conf.
+
This document applies to version 4.2.8p1 of ntp.conf.
Short Contents
@@ -403,6 +403,19 @@ in order to avoid accidental or malicious disruption in this mode,
both the server and client should operate using symmetric-key or
public-key authentication as described in
Authentication Options.
+
mdnstriesnumber
If we are participating in mDNS,
+after we have synched for the first time
+we attempt to register with the mDNS system.
+If that registration attempt fails,
+we try again at one minute intervals for up to
+mdnstries
+times.
+After all,
+ntpd
+may be starting before mDNS.
+The default value for
+mdnstries
+is 5.
diff --git a/ntpd/ntp.conf.man.in b/ntpd/ntp.conf.man.in
index eff1e4347ce6..ec2c866c750a 100644
--- a/ntpd/ntp.conf.man.in
+++ b/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 "19 Dec 2014" "4.2.8" "File Formats"
+.TH ntp.conf 5 "04 Feb 2015" "4.2.8p1" "File Formats"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-eCaa6b/ag-rCai4b)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-sPaOCn/ag-RPaGBn)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:48:49 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:41:46 AM by AutoGen 5.18.5pre4
.\" From the definitions ntp.conf.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -415,6 +415,21 @@ in order to avoid accidental or malicious disruption in this mode,
both the server and client should operate using symmetric-key or
public-key authentication as described in
\fIAuthentication\f[] \fIOptions\f[].
+.TP 7
+.NOP \f\*[B-Font]mdnstries\f[] \f\*[I-Font]number\f[]
+If we are participating in mDNS,
+after we have synched for the first time
+we attempt to register with the mDNS system.
+If that registration attempt fails,
+we try again at one minute intervals for up to
+\f\*[B-Font]mdnstries\f[]
+times.
+After all,
+\f\*[B-Font]ntpd\f[]
+may be starting before mDNS.
+The default value for
+\f\*[B-Font]mdnstries\f[]
+is 5.
.PP
.SH Authentication Support
Authentication support allows the NTP client to verify that the
@@ -2974,9 +2989,9 @@ RFC5905
.PP
.SH "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.SH BUGS
The syntax checking is not picky; some combinations of
diff --git a/ntpd/ntp.conf.mdoc.in b/ntpd/ntp.conf.mdoc.in
index 01e5901b321c..ec45a749c3a0 100644
--- a/ntpd/ntp.conf.mdoc.in
+++ b/ntpd/ntp.conf.mdoc.in
@@ -1,9 +1,9 @@
-.Dd December 19 2014
+.Dd February 4 2015
.Dt NTP_CONF 5 File Formats
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:49:09 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:42:07 AM by AutoGen 5.18.5pre4
.\" From the definitions ntp.conf.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -402,6 +402,20 @@ in order to avoid accidental or malicious disruption in this mode,
both the server and client should operate using symmetric\-key or
public\-key authentication as described in
.Sx Authentication Options .
+.It Ic mdnstries Ar number
+If we are participating in mDNS,
+after we have synched for the first time
+we attempt to register with the mDNS system.
+If that registration attempt fails,
+we try again at one minute intervals for up to
+.Ic mdnstries
+times.
+After all,
+.Ic ntpd
+may be starting before mDNS.
+The default value for
+.Ic mdnstries
+is 5.
.El
.Sh Authentication Support
Authentication support allows the NTP client to verify that the
@@ -2784,9 +2798,9 @@ A snapshot of this documentation is available in HTML format in
.%O RFC5905
.Re
.Sh "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.Sh BUGS
The syntax checking is not picky; some combinations of
diff --git a/ntpd/ntp.keys.5man b/ntpd/ntp.keys.5man
index e6e57f7f0205..7ba8b5815f04 100644
--- a/ntpd/ntp.keys.5man
+++ b/ntpd/ntp.keys.5man
@@ -1,8 +1,8 @@
-.TH ntp.keys 5man "19 Dec 2014" "4.2.8" "File Formats"
+.TH ntp.keys 5man "04 Feb 2015" "4.2.8p1" "File Formats"
.\"
.\" EDIT THIS FILE WITH CAUTION (ntp.man)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:48:54 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:41:51 AM by AutoGen 5.18.5pre4
.\" From the definitions ntp.keys.def
.\" and the template file agman-file.tpl
.Sh NAME
@@ -158,9 +158,9 @@ the default name of the configuration file
\fCntpdc\fR(1ntpdcmdoc)\f[],
\fCsntp\fR(1sntpmdoc)\f[]
.SH "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.SH "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpd/ntp.keys.5mdoc b/ntpd/ntp.keys.5mdoc
index f67c3198f2f6..8d7dacc0f1b1 100644
--- a/ntpd/ntp.keys.5mdoc
+++ b/ntpd/ntp.keys.5mdoc
@@ -1,9 +1,9 @@
-.Dd December 19 2014
+.Dd February 4 2015
.Dt NTP_KEYS 5mdoc File Formats
.Os SunOS 5.10
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:49:12 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:42:10 AM by AutoGen 5.18.5pre4
.\" From the definitions ntp.keys.def
.\" and the template file agmdoc-file.tpl
.Sh NAME
@@ -145,9 +145,9 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Xr ntpdc 1ntpdcmdoc ,
.Xr sntp 1sntpmdoc
.Sh "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.Sh "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpd/ntp.keys.html b/ntpd/ntp.keys.html
index cbeee1961053..2329476e15ff 100644
--- a/ntpd/ntp.keys.html
+++ b/ntpd/ntp.keys.html
@@ -33,7 +33,7 @@ Up: (dir)
This document describes the symmetric key file for the NTP Project's
ntpd program.
-
This document applies to version 4.2.8 of ntp.keys.
+
This document applies to version 4.2.8p1 of ntp.keys.
ntpd Description: Description
@@ -219,7 +219,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to more. Both will exit
with a status code of 0.
-
ntpd - NTP daemon program - Ver. 4.2.8-x
+
ntpd - NTP daemon program - Ver. 4.2.8p1-RC2
Usage: ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
[ <server1> ... <serverN> ]
Flg Arg Option-Name Description
diff --git a/ntpd/ntpd.man.in b/ntpd/ntpd.man.in
index c115a4d8a55d..a5403086ae83 100644
--- a/ntpd/ntpd.man.in
+++ b/ntpd/ntpd.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpd @NTPD_MS@ "19 Dec 2014" "4.2.8" "User Commands"
+.TH ntpd @NTPD_MS@ "04 Feb 2015" "4.2.8p1" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-WBaqpd/ag-9Baiod)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-YYaqWo/ag-.YaiVo)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:48:58 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:41:54 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -959,9 +959,9 @@ RFC5908
.PP
.SH "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.SH BUGS
The
diff --git a/ntpd/ntpd.mdoc.in b/ntpd/ntpd.mdoc.in
index bb24d02685e3..3017dc8d54d4 100644
--- a/ntpd/ntpd.mdoc.in
+++ b/ntpd/ntpd.mdoc.in
@@ -1,9 +1,9 @@
-.Dd December 19 2014
+.Dd February 4 2015
.Dt NTPD @NTPD_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:49:14 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:42:12 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -867,9 +867,9 @@ A snapshot of this documentation is available in HTML format in
.%O RFC5908
.Re
.Sh "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.Sh BUGS
The
diff --git a/ntpd/refclock_acts.c b/ntpd/refclock_acts.c
index 36322fd91a25..f62cc466b25c 100644
--- a/ntpd/refclock_acts.c
+++ b/ntpd/refclock_acts.c
@@ -343,7 +343,7 @@ acts_receive(
up->bufptr = up->buf;
acts_message(peer, up->buf);
}
- } else if (!iscntrl(*tptr)) {
+ } else if (!iscntrl((unsigned char)*tptr)) {
*up->bufptr++ = *tptr;
if (*tptr == '*' || *tptr == '#') {
up->tstamp = pp->lastrec;
@@ -515,7 +515,7 @@ acts_timeout(
up->unit);
fd = refclock_open(device, SPEED232, LDISC_ACTS |
LDISC_RAW | LDISC_REMOTE);
- if (fd <= 0) {
+ if (fd < 0) {
msyslog(LOG_ERR, "acts: open fails %m");
return;
}
diff --git a/ntpd/refclock_arc.c b/ntpd/refclock_arc.c
index b2c063e432ec..e5d4cb44086c 100644
--- a/ntpd/refclock_arc.c
+++ b/ntpd/refclock_arc.c
@@ -843,7 +843,7 @@ send_slow(
static int
get2(char *p, int *val)
{
- if (!isdigit((int)p[0]) || !isdigit((int)p[1])) return 0;
+ if (!isdigit((unsigned char)p[0]) || !isdigit((unsigned char)p[1])) return 0;
*val = (p[0] - '0') * 10 + p[1] - '0';
return 1;
}
@@ -851,7 +851,7 @@ get2(char *p, int *val)
static int
get1(char *p, int *val)
{
- if (!isdigit((int)p[0])) return 0;
+ if (!isdigit((unsigned char)p[0])) return 0;
*val = p[0] - '0';
return 1;
}
@@ -943,7 +943,7 @@ arc_receive(
#ifdef DEBUG
if(debug) { /* Show \r as `R', other non-printing char as `?'. */
printf("arc: stamp -->%c<-- (%d chars rcvd)\n",
- ((c == '\r') ? 'R' : (isgraph((int)c) ? c : '?')),
+ ((c == '\r') ? 'R' : (isgraph((unsigned char)c) ? c : '?')),
rbufp->recv_length);
}
#endif
diff --git a/ntpd/refclock_chu.c b/ntpd/refclock_chu.c
index 9c7093d2c212..6b1ae5554adf 100644
--- a/ntpd/refclock_chu.c
+++ b/ntpd/refclock_chu.c
@@ -967,15 +967,11 @@ chu_serial_receive(
struct recvbuf *rbufp /* receive buffer structure pointer */
)
{
- struct chuunit *up;
- struct refclockproc *pp;
struct peer *peer;
u_char *dpt; /* receive buffer pointer */
peer = rbufp->recv_peer;
- pp = peer->procptr;
- up = pp->unitptr;
dpt = (u_char *)&rbufp->recv_space;
chu_decode(peer, *dpt, rbufp->recv_time);
diff --git a/ntpd/refclock_gpsdjson.c b/ntpd/refclock_gpsdjson.c
index 615098271e3b..2171a4fff788 100644
--- a/ntpd/refclock_gpsdjson.c
+++ b/ntpd/refclock_gpsdjson.c
@@ -52,7 +52,7 @@
#if defined(HAVE_SYS_POLL_H)
# include
-#elif defined(HAVE_SYS_SLECET_H)
+#elif defined(HAVE_SYS_SELECT_H)
# include
#else
# error need poll() or select()
@@ -204,8 +204,8 @@ static int syslogok(clockprocT * const pp, gpsd_unitT * const up);
* data and selecting the GPS device name we created from our unit
* number. [Note: This is a format string!]
*/
-static const char * s_logon =
- "?WATCH={\"enable\":true,\"json\":true,\"device\":\"%s\"};\r\n";
+#define s_logon \
+ "?WATCH={\"enable\":true,\"json\":true,\"device\":\"%s\"};\r\n"
/* We keep a static list of network addresses for 'localhost:gpsd', and
* we try to connect to them in round-robin fashion.
@@ -854,7 +854,7 @@ process_tpv(
const char * gps_time;
int gps_mode;
double ept, epp, epx, epy, epv;
- int log2;
+ int xlog2;
gps_mode = (int)json_object_lookup_int_default(
jctx, 0, "mode", 0);
@@ -920,9 +920,9 @@ process_tpv(
ept = min(ept, epp );
ept = min(ept, 0.5 );
ept = max(ept, 1.0-9);
- ept = frexp(ept, &log2);
+ ept = frexp(ept, &xlog2);
- peer->precision = log2;
+ peer->precision = xlog2;
}
/* ------------------------------------------------------------------ */
@@ -1270,7 +1270,7 @@ convert_ascii_time(
ep = strptime(gps_time, "%Y-%m-%dT%H:%M:%S", &gd);
if (*ep == '.') {
dw = 100000000;
- while (isdigit(*++ep)) {
+ while (isdigit((unsigned char)*++ep)) {
ts.tv_nsec += (*ep - '0') * dw;
dw /= 10;
}
diff --git a/ntpd/refclock_heath.c b/ntpd/refclock_heath.c
index 435d8f6c4ffb..aed056c91497 100644
--- a/ntpd/refclock_heath.c
+++ b/ntpd/refclock_heath.c
@@ -379,7 +379,7 @@ heath_receive(
/*
* Determine synchronization and last update
*/
- if (!isdigit((int)dsec))
+ if (!isdigit((unsigned char)dsec))
pp->leap = LEAP_NOTINSYNC;
else {
pp->nsec = (dsec - '0') * 100000000;
diff --git a/ntpd/refclock_irig.c b/ntpd/refclock_irig.c
index 46c01fbb7931..abc94f62e8fb 100644
--- a/ntpd/refclock_irig.c
+++ b/ntpd/refclock_irig.c
@@ -762,7 +762,7 @@ irig_baud(
* persist for lots of samples.
*/
up->exing = -up->yxing;
- if (fabs(up->envxing - up->envphase) <= 1) {
+ if (abs(up->envxing - up->envphase) <= 1) {
up->tcount++;
if (up->tcount > 20 * up->tc) {
up->tc++;
@@ -980,10 +980,8 @@ irig_poll(
)
{
struct refclockproc *pp;
- struct irigunit *up;
pp = peer->procptr;
- up = pp->unitptr;
if (pp->coderecv == pp->codeproc) {
refclock_report(peer, CEVNT_TIMEOUT);
diff --git a/ntpd/refclock_jjy.c b/ntpd/refclock_jjy.c
index d8ec6b7446c1..e279ee307d73 100644
--- a/ntpd/refclock_jjy.c
+++ b/ntpd/refclock_jjy.c
@@ -297,9 +297,9 @@ struct refclock refclock_jjy = {
static struct
{
- char commandNumber ;
- char *commandLog ;
- char *command ;
+ const char commandNumber ;
+ const char *commandLog ;
+ const char *command ;
int commandLength ;
} tristate_jjy01_command_sequence[] =
{
@@ -337,8 +337,8 @@ static struct
static struct
{
char commandNumber ;
- char *commandLog ;
- char *command ;
+ const char *commandLog ;
+ const char *command ;
int commandLength ;
} tristate_gpsclock01_command_sequence[] =
{
@@ -741,7 +741,7 @@ static int
jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
{
#ifdef DEBUG
- static char *sFunctionName = "jjy_receive_tristate_jjy01" ;
+ static const char *sFunctionName = "jjy_receive_tristate_jjy01" ;
#endif
struct jjyunit *up ;
@@ -756,7 +756,7 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp )
char sLogText [ MAX_LOGTEXT ], sReplyText [ MAX_LOGTEXT ] ;
- char *pCmd ;
+ const char *pCmd ;
int iCmdLen ;
/*
@@ -930,7 +930,7 @@ static int
jjy_receive_cdex_jst2000 ( struct recvbuf *rbufp )
{
#ifdef DEBUG
- static char *sFunctionName = "jjy_receive_cdex_jst2000" ;
+ static const char *sFunctionName = "jjy_receive_cdex_jst2000" ;
#endif
struct jjyunit *up ;
@@ -1010,7 +1010,7 @@ static int
jjy_receive_echokeisokuki_lt2000 ( struct recvbuf *rbufp )
{
#ifdef DEBUG
- static char *sFunctionName = "jjy_receive_echokeisokuki_lt2000" ;
+ static const char *sFunctionName = "jjy_receive_echokeisokuki_lt2000" ;
#endif
struct jjyunit *up ;
@@ -1052,7 +1052,7 @@ jjy_receive_echokeisokuki_lt2000 ( struct recvbuf *rbufp )
if ( up->operationmode == 1 ) {
#ifdef DEBUG
if ( debug ) {
- printf ( "%s (refclock_jjy.c) : send '#'\n", sFunctionName ) ;
+ printf ( "%s (refclock_jjy.c) : send '#'\n", __func__ ) ;
}
#endif
if ( write ( pp->io.fd, "#",1 ) != 1 ) {
@@ -1169,7 +1169,7 @@ static int
jjy_receive_citizentic_jjy200 ( struct recvbuf *rbufp )
{
#ifdef DEBUG
- static char *sFunctionName = "jjy_receive_citizentic_jjy200" ;
+ static const char *sFunctionName = "jjy_receive_citizentic_jjy200" ;
#endif
struct jjyunit *up ;
@@ -1264,7 +1264,7 @@ static int
jjy_receive_tristate_gpsclock01 ( struct recvbuf *rbufp )
{
#ifdef DEBUG
- static char *sFunctionName = "jjy_receive_tristate_gpsclock01" ;
+ static const char *sFunctionName = "jjy_receive_tristate_gpsclock01" ;
#endif
struct jjyunit *up ;
@@ -1279,7 +1279,7 @@ jjy_receive_tristate_gpsclock01 ( struct recvbuf *rbufp )
char sLogText [ MAX_LOGTEXT ], sReplyText [ MAX_LOGTEXT ] ;
- char *pCmd ;
+ const char *pCmd ;
int iCmdLen ;
/*
@@ -1519,13 +1519,13 @@ static void
jjy_poll_tristate_jjy01 ( int unit, struct peer *peer )
{
#ifdef DEBUG
- static char *sFunctionName = "jjy_poll_tristate_jjy01" ;
+ static const char *sFunctionName = "jjy_poll_tristate_jjy01" ;
#endif
struct jjyunit *up;
struct refclockproc *pp;
- char *pCmd ;
+ const char *pCmd ;
int iCmdLen ;
pp = peer->procptr;
@@ -1641,13 +1641,13 @@ static void
jjy_poll_tristate_gpsclock01 ( int unit, struct peer *peer )
{
#ifdef DEBUG
- static char *sFunctionName = "jjy_poll_tristate_gpsclock01" ;
+ static const char *sFunctionName = "jjy_poll_tristate_gpsclock01" ;
#endif
struct jjyunit *up;
struct refclockproc *pp;
- char *pCmd ;
+ const char *pCmd ;
int iCmdLen ;
pp = peer->procptr;
@@ -1690,7 +1690,7 @@ jjy_poll_tristate_gpsclock01 ( int unit, struct peer *peer )
static void
printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen )
{
- char *printableControlChar[] = {
+ const char *printableControlChar[] = {
"", "", "", "",
"", "", "", "",
"" , "" , "" , "" ,
@@ -1700,16 +1700,15 @@ printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen )
"", "" , "", "",
"" , "" , "" , "" ,
" " } ;
+
+ size_t i, j, n ;
size_t InputLen;
size_t OutputLen;
- size_t i;
- size_t j;
- size_t n;
InputLen = (size_t)iInputLen;
OutputLen = (size_t)iOutputLen;
for ( i = j = 0 ; i < InputLen && j < OutputLen ; i ++ ) {
- if ( isprint( sInput[i] ) ) {
+ if ( isprint( (unsigned char)sInput[i] ) ) {
n = 1 ;
if ( j + 1 >= OutputLen )
break ;
@@ -1732,7 +1731,7 @@ printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen )
j += n ;
}
- sOutput[min(j, iOutputLen - 1)] = '\0' ;
+ sOutput[min(j, (size_t)iOutputLen - 1)] = '\0' ;
}
diff --git a/ntpd/refclock_jupiter.c b/ntpd/refclock_jupiter.c
index 377fc563229a..02b33dfb338d 100644
--- a/ntpd/refclock_jupiter.c
+++ b/ntpd/refclock_jupiter.c
@@ -136,8 +136,8 @@ static int jupiter_config (struct instance *);
static void jupiter_debug (struct peer *, const char *,
const char *, ...)
__attribute__ ((format (printf, 3, 4)));
-static char * jupiter_parse_t (struct instance *, u_short *);
-static char * jupiter_parse_gpos (struct instance *, u_short *);
+static const char * jupiter_parse_t (struct instance *, u_short *);
+static const char * jupiter_parse_gpos (struct instance *, u_short *);
static void jupiter_platform (struct instance *, u_int);
static void jupiter_poll (int, struct peer *);
static void jupiter_control (int, const struct refclockstat *,
@@ -275,7 +275,7 @@ jupiter_shutdown(int unit, struct peer *peer)
static int
jupiter_config(struct instance *instance)
{
- jupiter_debug(instance->peer, "jupiter_config", "init receiver");
+ jupiter_debug(instance->peer, __func__, "init receiver");
/*
* Initialize the unit variables
@@ -283,8 +283,7 @@ jupiter_config(struct instance *instance)
instance->sloppyclockflag = instance->peer->procptr->sloppyclockflag;
instance->moving = !!(instance->sloppyclockflag & CLK_FLAG2);
if (instance->moving)
- jupiter_debug(instance->peer, "jupiter_config",
- "mobile platform");
+ jupiter_debug(instance->peer, __func__, "mobile platform");
instance->pollcnt = 2;
instance->polled = 0;
@@ -368,7 +367,7 @@ jupiter_ppsapi(
#if DEBUG
if (debug) {
time_pps_getparams(instance->pps_handle, &instance->pps_params);
- jupiter_debug(instance->peer, "refclock_jupiter",
+ jupiter_debug(instance->peer, __func__,
"pps capability 0x%x version %d mode 0x%x kern %d",
capability, instance->pps_params.api_version,
instance->pps_params.mode, instance->hardpps);
@@ -498,8 +497,7 @@ jupiter_control(
instance->sloppyclockflag = pp->sloppyclockflag;
if ((instance->sloppyclockflag & CLK_FLAG2) !=
(sloppyclockflag & CLK_FLAG2)) {
- jupiter_debug(peer,
- "jupiter_control",
+ jupiter_debug(peer, __func__,
"mode switch: reset receiver");
jupiter_config(instance);
return;
@@ -513,10 +511,11 @@ jupiter_control(
static void
jupiter_receive(struct recvbuf *rbufp)
{
- int bpcnt, cc, size, ppsret;
+ size_t bpcnt;
+ int cc, size, ppsret;
time_t last_timecode;
u_int32 laststime;
- char *cp;
+ const char *cp;
u_char *bp;
u_short *sp;
struct jid *ip;
@@ -535,7 +534,7 @@ jupiter_receive(struct recvbuf *rbufp)
bpcnt = rbufp->recv_length;
/* This shouldn't happen */
- if (bpcnt > (int)sizeof(instance->sbuf) - instance->ssize)
+ if (bpcnt > sizeof(instance->sbuf) - instance->ssize)
bpcnt = sizeof(instance->sbuf) - instance->ssize;
/* Append to input buffer */
@@ -543,7 +542,7 @@ jupiter_receive(struct recvbuf *rbufp)
instance->ssize += bpcnt;
/* While there's at least a header and we parse an intact message */
- while (instance->ssize > sizeof(*hp) && (cc = jupiter_recv(instance)) > 0) {
+ while (instance->ssize > (int)sizeof(*hp) && (cc = jupiter_recv(instance)) > 0) {
instance->pollcnt = 2;
tstamp = rbufp->recv_time;
@@ -554,8 +553,8 @@ jupiter_receive(struct recvbuf *rbufp)
case JUPITER_O_PULSE:
if (size != sizeof(struct jpulse)) {
- jupiter_debug(peer,
- "jupiter_receive", "pulse: len %d != %u",
+ jupiter_debug(peer, __func__,
+ "pulse: len %d != %u",
size, (int)sizeof(struct jpulse));
refclock_report(peer, CEVNT_BADREPLY);
break;
@@ -574,7 +573,7 @@ jupiter_receive(struct recvbuf *rbufp)
laststime = instance->stime;
instance->stime = DS2UI(((struct jpulse *)sp)->stime);
if (laststime != 0 && instance->stime - laststime <= 21) {
- jupiter_debug(peer, "jupiter_receive",
+ jupiter_debug(peer, __func__,
"avoided firmware bug (stime %.2f, laststime %.2f)",
(double)instance->stime * 0.01, (double)laststime * 0.01);
break;
@@ -595,8 +594,8 @@ jupiter_receive(struct recvbuf *rbufp)
/* Parse timecode (even when there's no pps) */
last_timecode = instance->timecode;
if ((cp = jupiter_parse_t(instance, sp)) != NULL) {
- jupiter_debug(peer,
- "jupiter_receive", "pulse: %s", cp);
+ jupiter_debug(peer, __func__,
+ "pulse: %s", cp);
break;
}
@@ -645,24 +644,24 @@ jupiter_receive(struct recvbuf *rbufp)
case JUPITER_O_GPOS:
if (size != sizeof(struct jgpos)) {
- jupiter_debug(peer,
- "jupiter_receive", "gpos: len %d != %u",
+ jupiter_debug(peer, __func__,
+ "gpos: len %d != %u",
size, (int)sizeof(struct jgpos));
refclock_report(peer, CEVNT_BADREPLY);
break;
}
if ((cp = jupiter_parse_gpos(instance, sp)) != NULL) {
- jupiter_debug(peer,
- "jupiter_receive", "gpos: %s", cp);
+ jupiter_debug(peer, __func__,
+ "gpos: %s", cp);
break;
}
break;
case JUPITER_O_ID:
if (size != sizeof(struct jid)) {
- jupiter_debug(peer,
- "jupiter_receive", "id: len %d != %u",
+ jupiter_debug(peer, __func__,
+ "id: len %d != %u",
size, (int)sizeof(struct jid));
refclock_report(peer, CEVNT_BADREPLY);
break;
@@ -672,8 +671,8 @@ jupiter_receive(struct recvbuf *rbufp)
* just powered instance, it needs to be reconfigured.
*/
ip = (struct jid *)sp;
- jupiter_debug(peer,
- "jupiter_receive", "%s chan ver %s, %s (%s)",
+ jupiter_debug(peer, __func__,
+ "%s chan ver %s, %s (%s)",
ip->chans, ip->vers, ip->date, ip->opts);
msyslog(LOG_DEBUG,
"jupiter_receive: %s chan ver %s, %s (%s)",
@@ -681,8 +680,7 @@ jupiter_receive(struct recvbuf *rbufp)
if (instance->wantid)
instance->wantid = 0;
else {
- jupiter_debug(peer,
- "jupiter_receive", "reset receiver");
+ jupiter_debug(peer, __func__, "reset receiver");
jupiter_config(instance);
/*
* Restore since jupiter_config() just
@@ -693,8 +691,7 @@ jupiter_receive(struct recvbuf *rbufp)
break;
default:
- jupiter_debug(peer,
- "jupiter_receive", "unknown message id %d",
+ jupiter_debug(peer, __func__, "unknown message id %d",
getshort(hp->id));
break;
}
@@ -707,7 +704,7 @@ jupiter_receive(struct recvbuf *rbufp)
}
}
-static char *
+static const char *
jupiter_parse_t(struct instance *instance, u_short *sp)
{
struct tm *tm;
@@ -757,8 +754,8 @@ jupiter_parse_t(struct instance *instance, u_short *sp)
}
else if (sweek == 0 && instance->lastsweek == WEEKSECS - 1) {
++instance->gweek;
- jupiter_debug(instance->peer,
- "jupiter_parse_t", "NEW gps week %u", instance->gweek);
+ jupiter_debug(instance->peer, __func__,
+ "NEW gps week %u", instance->gweek);
}
/*
@@ -774,14 +771,14 @@ jupiter_parse_t(struct instance *instance, u_short *sp)
* Then we warped.
*/
if (instance->lastsweek == sweek)
- jupiter_debug(instance->peer,
- "jupiter_parse_t", "gps sweek not incrementing (%d)",
+ jupiter_debug(instance->peer, __func__,
+ "gps sweek not incrementing (%d)",
sweek);
else if (instance->lastsweek != 2 * WEEKSECS &&
instance->lastsweek + 1 != sweek &&
!(sweek == 0 && instance->lastsweek == WEEKSECS - 1))
- jupiter_debug(instance->peer,
- "jupiter_parse_t", "gps sweek jumped (was %d, now %d)",
+ jupiter_debug(instance->peer, __func__,
+ "gps sweek jumped (was %d, now %d)",
instance->lastsweek, sweek);
instance->lastsweek = sweek;
@@ -792,16 +789,16 @@ jupiter_parse_t(struct instance *instance, u_short *sp)
if (last_timecode == 0)
/* XXX debugging */
- jupiter_debug(instance->peer,
- "jupiter_parse_t", "UTC (gweek/sweek %u/%u)",
+ jupiter_debug(instance->peer, __func__,
+ "UTC (gweek/sweek %u/%u)",
instance->gweek, sweek);
else {
/* XXX debugging */
tm = gmtime(&last_timecode);
cp = asctime(tm);
- jupiter_debug(instance->peer,
- "jupiter_parse_t", "UTC %.24s (gweek/sweek %u/%u)",
+ jupiter_debug(instance->peer, __func__,
+ "UTC %.24s (gweek/sweek %u/%u)",
cp, instance->gweek, sweek);
/* Billboard last_timecode (which is now the current time) */
@@ -829,7 +826,7 @@ jupiter_parse_t(struct instance *instance, u_short *sp)
return (NULL);
}
-static char *
+static const char *
jupiter_parse_gpos(struct instance *instance, u_short *sp)
{
struct jgpos *jg;
@@ -861,8 +858,8 @@ jupiter_parse_gpos(struct instance *instance, u_short *sp)
tm = gmtime(&t);
cp = asctime(tm);
- jupiter_debug(instance->peer,
- "jupiter_parse_g", "GPS %.24s (gweek/sweek %u/%u)",
+ jupiter_debug(instance->peer, __func__,
+ "GPS %.24s (gweek/sweek %u/%u)",
cp, instance->gpos_gweek, instance->gpos_sweek);
return (NULL);
}
@@ -903,7 +900,7 @@ static char *
jupiter_send(struct instance *instance, struct jheader *hp)
{
u_int len, size;
- int cc;
+ ssize_t cc;
u_short *sp;
static char errstr[132];
@@ -921,7 +918,7 @@ jupiter_send(struct instance *instance, struct jheader *hp)
msnprintf(errstr, sizeof(errstr), "write: %m");
return (errstr);
} else if (cc != (int)size) {
- snprintf(errstr, sizeof(errstr), "short write (%d != %u)", cc, size);
+ snprintf(errstr, sizeof(errstr), "short write (%zd != %u)", cc, size);
return (errstr);
}
return (NULL);
@@ -954,7 +951,7 @@ jupiter_reqmsg(struct instance *instance, u_int id,
rp->trigger = putshort(interval == 0);
rp->interval = putshort(interval);
if ((cp = jupiter_send(instance, hp)) != NULL)
- jupiter_debug(instance->peer, "jupiter_reqmsg", "%u: %s", id, cp);
+ jupiter_debug(instance->peer, __func__, "%u: %s", id, cp);
}
/* Cancel periodic message output */
@@ -973,7 +970,7 @@ jupiter_canmsg(struct instance *instance, u_int id)
hp = &canmsg;
hp->id = putshort(id);
if ((cp = jupiter_send(instance, hp)) != NULL)
- jupiter_debug(instance->peer, "jupiter_canmsg", "%u: %s", id, cp);
+ jupiter_debug(instance->peer, __func__, "%u: %s", id, cp);
}
/* Request a single message output */
@@ -992,7 +989,7 @@ jupiter_reqonemsg(struct instance *instance, u_int id)
hp = &reqonemsg;
hp->id = putshort(id);
if ((cp = jupiter_send(instance, hp)) != NULL)
- jupiter_debug(instance->peer, "jupiter_reqonemsg", "%u: %s", id, cp);
+ jupiter_debug(instance->peer, __func__, "%u: %s", id, cp);
}
/* Set the platform dynamics */
@@ -1017,7 +1014,7 @@ jupiter_platform(struct instance *instance, u_int platform)
pp = &platmsg.jplat;
pp->platform = putshort(platform);
if ((cp = jupiter_send(instance, hp)) != NULL)
- jupiter_debug(instance->peer, "jupiter_platform", "%u: %s", platform, cp);
+ jupiter_debug(instance->peer, __func__, "%u: %s", platform, cp);
}
/* Checksum "len" shorts */
@@ -1054,13 +1051,14 @@ jupiter_recv(struct instance *instance)
hp = (struct jheader *)sp;
if (getshort(hp->sync) != JUPITER_SYNC) {
/* Wasn't at the front, sync up */
- jupiter_debug(instance->peer, "jupiter_recv", "syncing");
+ jupiter_debug(instance->peer, __func__, "syncing");
bp = (u_char *)sp;
n = size;
while (n >= 2) {
if (bp[0] != (JUPITER_SYNC & 0xff)) {
/*
- jupiter_debug(instance->peer, "{0x%x}", bp[0]);
+ jupiter_debug(instance->peer, __func__,
+ "{0x%x}", bp[0]);
*/
++bp;
--n;
@@ -1069,13 +1067,14 @@ jupiter_recv(struct instance *instance)
if (bp[1] == ((JUPITER_SYNC >> 8) & 0xff))
break;
/*
- jupiter_debug(instance->peer, "{0x%x 0x%x}", bp[0], bp[1]);
+ jupiter_debug(instance->peer, __func__,
+ "{0x%x 0x%x}", bp[0], bp[1]);
*/
bp += 2;
n -= 2;
}
/*
- jupiter_debug(instance->peer, "\n");
+ jupiter_debug(instance->peer, __func__, "\n");
*/
/* Shuffle data to front of input buffer */
if (n > 0)
@@ -1088,7 +1087,7 @@ jupiter_recv(struct instance *instance)
if (jupiter_cksum(sp, (cc / sizeof(u_short) - 1)) !=
getshort(hp->hsum)) {
- jupiter_debug(instance->peer, "jupiter_recv", "bad header checksum!");
+ jupiter_debug(instance->peer, __func__, "bad header checksum!");
/* This is drastic but checksum errors should be rare */
instance->ssize = 0;
return (0);
@@ -1106,7 +1105,7 @@ jupiter_recv(struct instance *instance)
sp = (u_short *)(hp + 1);
if (jupiter_cksum(sp, len) != getshort(sp[len])) {
jupiter_debug(instance->peer,
- "jupiter_recv", "bad payload checksum!");
+ __func__, "bad payload checksum!");
/* This is drastic but checksum errors should be rare */
instance->ssize = 0;
return (0);
diff --git a/ntpd/refclock_mx4200.c b/ntpd/refclock_mx4200.c
index 16f83f0c91e8..c9422290d39a 100644
--- a/ntpd/refclock_mx4200.c
+++ b/ntpd/refclock_mx4200.c
@@ -1572,7 +1572,7 @@ mx4200_debug(struct peer *peer, char *fmt, ...)
* Print debug message to stdout
* In the future, we may want to get get more creative...
*/
- vprintf(fmt, ap);
+ mvprintf(fmt, ap);
va_end(ap);
}
@@ -1613,11 +1613,11 @@ mx4200_send(peer, fmt, va_alist)
cp = buf;
*cp++ = '$';
- n = vsnprintf(cp, sizeof(buf) - 1, fmt, ap);
+ n = VSNPRINTF((cp, sizeof(buf) - 1, fmt, ap));
ck = mx4200_cksum(cp, n);
cp += n;
++n;
- n += snprintf(cp, sizeof(buf) - n - 5, "*%02X\r\n", ck);
+ n += SNPRINTF((cp, sizeof(buf) - n - 5, "*%02X\r\n", ck));
m = write(pp->io.fd, buf, (unsigned)n);
if (m < 0)
diff --git a/ntpd/refclock_neoclock4x.c b/ntpd/refclock_neoclock4x.c
index a0067e9c4675..6fda0f0785be 100644
--- a/ntpd/refclock_neoclock4x.c
+++ b/ntpd/refclock_neoclock4x.c
@@ -143,7 +143,7 @@ static void neol_jdn_to_ymd (unsigned long, int *, int *, int *);
static void neol_localtime (unsigned long, int* , int*, int*, int*, int*, int*);
static unsigned long neol_mktime (int, int, int, int, int, int);
#if !defined(NEOCLOCK4X_FIRMWARE)
-static int neol_query_firmware (int, int, char *, int);
+static int neol_query_firmware (int, int, char *, size_t);
static int neol_check_firmware (int, const char*, char *);
#endif
@@ -785,9 +785,9 @@ neol_hexatoi_len(const char str[],
int i;
int n = 0;
- for(i=0; isxdigit((int)str[i]) && i < maxlen; i++)
+ for(i=0; isxdigit((unsigned char)str[i]) && i < maxlen; i++)
{
- hexdigit = isdigit((int)str[i]) ? toupper(str[i]) - '0' : toupper(str[i]) - 'A' + 10;
+ hexdigit = isdigit((unsigned char)str[i]) ? toupper((unsigned char)str[i]) - '0' : toupper((unsigned char)str[i]) - 'A' + 10;
n = 16 * n + hexdigit;
}
*result = n;
@@ -803,7 +803,7 @@ neol_atoi_len(const char str[],
int i;
int n = 0;
- for(i=0; isdigit((int)str[i]) && i < maxlen; i++)
+ for(i=0; isdigit((unsigned char)str[i]) && i < maxlen; i++)
{
digit = str[i] - '0';
n = 10 * n + digit;
@@ -898,10 +898,10 @@ static int
neol_query_firmware(int fd,
int unit,
char *firmware,
- int maxlen)
+ size_t maxlen)
{
char tmpbuf[256];
- int len;
+ size_t len;
int lastsearch;
unsigned char c;
int last_c_was_crlf;
@@ -1001,7 +1001,7 @@ neol_query_firmware(int fd,
tmpbuf[len++] = (char) c;
}
tmpbuf[len] = '\0';
- if(len > sizeof(tmpbuf)-5)
+ if (len > sizeof(tmpbuf)-5)
break;
}
}
diff --git a/ntpd/refclock_nmea.c b/ntpd/refclock_nmea.c
index 58867f47b3d5..126b53026a9e 100644
--- a/ntpd/refclock_nmea.c
+++ b/ntpd/refclock_nmea.c
@@ -29,6 +29,9 @@
#include
#include
#include
+#ifdef HAVE_SYS_SOCKET_H
+#include
+#endif
#include "ntpd.h"
#include "ntp_io.h"
@@ -311,7 +314,7 @@ static int unfold_century (struct calendar * jd, u_int32 rec_ui);
static int gpsfix_century (struct calendar * jd, const gps_weektm * wd,
u_short * ccentury);
static l_fp eval_gps_time (struct peer * peer, const struct calendar * gpst,
- const struct timespec * gpso, const l_fp * recv);
+ const struct timespec * gpso, const l_fp * xrecv);
static int nmead_open (const char * device);
static void save_ltc (struct refclockproc * const, const char * const,
@@ -406,7 +409,7 @@ nmea_start(
size_t devlen;
u_int32 rate;
int baudrate;
- char * baudtext;
+ const char * baudtext;
/* Get baudrate choice from mode byte bits 4/5/6 */
@@ -1145,7 +1148,7 @@ nmea_poll(
*/
if (peer->ttl & NMEA_EXTLOG_MASK) {
/* Log & reset counters with extended logging */
- char *nmea = pp->a_lastcode;
+ const char *nmea = pp->a_lastcode;
if (*nmea == '\0') nmea = "(none)";
mprintf_clock_stats(
&peer->srcadr, "%s %u %u %u %u %u %u",
@@ -1779,7 +1782,7 @@ eval_gps_time(
struct peer * peer, /* for logging etc */
const struct calendar * gpst, /* GPS time stamp */
const struct timespec * tofs, /* GPS frac second & offset */
- const l_fp * recv /* receive time stamp */
+ const l_fp * xrecv /* receive time stamp */
)
{
struct refclockproc * const pp = peer->procptr;
@@ -1835,7 +1838,7 @@ eval_gps_time(
}
/* - get unfold base: day of full recv time - 512 weeks */
- vi64 = ntpcal_ntp_to_ntp(recv->l_ui, NULL);
+ vi64 = ntpcal_ntp_to_ntp(xrecv->l_ui, NULL);
rs64 = ntpcal_daysplit(&vi64);
rcv_sec = rs64.lo;
rcv_day = rs64.hi - 512 * 7;
@@ -1845,7 +1848,7 @@ eval_gps_time(
* fractional day of the receive time, we shift the base day for
* the unfold by 1. */
if ( gps_sec < rcv_sec
- || (gps_sec == rcv_sec && retv.l_uf < recv->l_uf))
+ || (gps_sec == rcv_sec && retv.l_uf < xrecv->l_uf))
rcv_day += 1;
/* - don't warp ahead of GPS invention! */
diff --git a/ntpd/refclock_oncore.c b/ntpd/refclock_oncore.c
index 3bc60bf50321..30924b8bbc2d 100644
--- a/ntpd/refclock_oncore.c
+++ b/ntpd/refclock_oncore.c
@@ -328,7 +328,7 @@ struct instance {
u_char printed;
u_char polled;
u_long ev_serial;
- int Rcvptr;
+ unsigned Rcvptr;
u_char Rcvbuf[500];
u_char BEHa[160]; /* Ba, Ea or Ha */
u_char BEHn[80]; /* Bn , En , or Hn */
@@ -436,47 +436,47 @@ static struct msg_desc {
int shmem;
} oncore_messages[] = {
/* Ea and En first since they're most common */
- { "Ea", 76, oncore_msg_BaEaHa, "mdyyhmsffffaaaaoooohhhhmmmmvvhhddtntimsdimsdimsdimsdimsdimsdimsdimsdsC" },
- { "Ba", 68, oncore_msg_BaEaHa, "mdyyhmsffffaaaaoooohhhhmmmmvvhhddtntimsdimsdimsdimsdimsdimsdsC" },
- { "Ha", 154, oncore_msg_BaEaHa, "mdyyhmsffffaaaaoooohhhhmmmmaaaaoooohhhhmmmmVVvvhhddntimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddssrrccooooTTushmvvvvvvC" },
- { "Bn", 59, oncore_msg_BnEnHn, "otaapxxxxxxxxxxpysreensffffsffffsffffsffffsffffsffffC" },
- { "En", 69, oncore_msg_BnEnHn, "otaapxxxxxxxxxxpysreensffffsffffsffffsffffsffffsffffsffffsffffC" },
- { "Hn", 78, oncore_msg_BnEnHn, "" },
- { "Ab", 10, 0, "" },
- { "Ac", 11, 0, "" },
- { "Ad", 11, oncore_msg_Adef, "" },
- { "Ae", 11, oncore_msg_Adef, "" },
- { "Af", 15, oncore_msg_Adef, "" },
- { "Ag", 8, oncore_msg_Ag, "" }, /* Satellite mask angle */
- { "As", 20, oncore_msg_As, "" },
- { "At", 8, oncore_msg_At, "" },
- { "Au", 12, 0, "" },
- { "Av", 8, 0, "" },
- { "Aw", 8, 0, "" },
- { "Ay", 11, oncore_msg_Ay, "" },
- { "Az", 11, oncore_msg_Az, "" },
- { "AB", 8, 0, "" },
- { "Bb", 92, 0, "" },
- { "Bd", 23, oncore_msg_Bd, "" },
- { "Bj", 8, oncore_msg_Bj, "" },
- { "Bl", 41, oncore_msg_Bl, "" },
- { "Ca", 9, oncore_msg_CaFaIa, "" },
- { "Cb", 33, oncore_msg_Cb, "" },
- { "Cf", 7, oncore_msg_Cf, "" },
- { "Cg", 8, 0, "" },
- { "Ch", 9, 0, "" },
- { "Cj", 294, oncore_msg_Cj, "" },
- { "Ek", 71, 0, "" },
- { "Fa", 9, oncore_msg_CaFaIa, "" },
- { "Ga", 20, oncore_msg_Ga, "" },
- { "Gb", 17, oncore_msg_Gb, "" },
- { "Gc", 8, oncore_msg_Gc, "" },
- { "Gd", 8, 0, "" },
- { "Ge", 8, 0, "" },
- { "Gj", 21, oncore_msg_Gj, "" },
- { "Ia", 10, oncore_msg_CaFaIa, "" },
- { "Sz", 8, oncore_msg_Sz, "" },
- { {0}, 7, 0, "" }
+ { "Ea", 76, oncore_msg_BaEaHa, "mdyyhmsffffaaaaoooohhhhmmmmvvhhddtntimsdimsdimsdimsdimsdimsdimsdimsdsC", 0 },
+ { "Ba", 68, oncore_msg_BaEaHa, "mdyyhmsffffaaaaoooohhhhmmmmvvhhddtntimsdimsdimsdimsdimsdimsdsC", 0 },
+ { "Ha", 154, oncore_msg_BaEaHa, "mdyyhmsffffaaaaoooohhhhmmmmaaaaoooohhhhmmmmVVvvhhddntimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddssrrccooooTTushmvvvvvvC", 0 },
+ { "Bn", 59, oncore_msg_BnEnHn, "otaapxxxxxxxxxxpysreensffffsffffsffffsffffsffffsffffC", 0 },
+ { "En", 69, oncore_msg_BnEnHn, "otaapxxxxxxxxxxpysreensffffsffffsffffsffffsffffsffffsffffsffffC", 0 },
+ { "Hn", 78, oncore_msg_BnEnHn, "", 0 },
+ { "Ab", 10, 0, "", 0 },
+ { "Ac", 11, 0, "", 0 },
+ { "Ad", 11, oncore_msg_Adef, "", 0 },
+ { "Ae", 11, oncore_msg_Adef, "", 0 },
+ { "Af", 15, oncore_msg_Adef, "", 0 },
+ { "Ag", 8, oncore_msg_Ag, "", 0 }, /* Satellite mask angle */
+ { "As", 20, oncore_msg_As, "", 0 },
+ { "At", 8, oncore_msg_At, "", 0 },
+ { "Au", 12, 0, "", 0 },
+ { "Av", 8, 0, "", 0 },
+ { "Aw", 8, 0, "", 0 },
+ { "Ay", 11, oncore_msg_Ay, "", 0 },
+ { "Az", 11, oncore_msg_Az, "", 0 },
+ { "AB", 8, 0, "", 0 },
+ { "Bb", 92, 0, "", 0 },
+ { "Bd", 23, oncore_msg_Bd, "", 0 },
+ { "Bj", 8, oncore_msg_Bj, "", 0 },
+ { "Bl", 41, oncore_msg_Bl, "", 0 },
+ { "Ca", 9, oncore_msg_CaFaIa, "", 0 },
+ { "Cb", 33, oncore_msg_Cb, "", 0 },
+ { "Cf", 7, oncore_msg_Cf, "", 0 },
+ { "Cg", 8, 0, "", 0 },
+ { "Ch", 9, 0, "", 0 },
+ { "Cj", 294, oncore_msg_Cj, "", 0 },
+ { "Ek", 71, 0, "", 0 },
+ { "Fa", 9, oncore_msg_CaFaIa, "", 0 },
+ { "Ga", 20, oncore_msg_Ga, "", 0 },
+ { "Gb", 17, oncore_msg_Gb, "", 0 },
+ { "Gc", 8, oncore_msg_Gc, "", 0 },
+ { "Gd", 8, 0, "", 0 },
+ { "Ge", 8, 0, "", 0 },
+ { "Gj", 21, oncore_msg_Gj, "", 0 },
+ { "Ia", 10, oncore_msg_CaFaIa, "", 0 },
+ { "Sz", 8, oncore_msg_Sz, "", 0 },
+ { {0}, 7, 0, "", 0 }
};
@@ -848,7 +848,7 @@ oncore_ppsapi(
)
{
int cap, mode, mode1;
- char *cp;
+ const char *cp;
if (time_pps_getcap(instance->pps_h, &cap) < 0) {
oncore_log_f(instance, LOG_ERR, "time_pps_getcap failed: %m");
@@ -932,11 +932,11 @@ oncore_init_shmem(
struct instance *instance
)
{
- int i, l, n, fd, shmem_old_size, n1;
+ int l, fd;
u_char *cp, *cp1, *buf, *shmem_old;
struct msg_desc *mp;
struct stat sbuf;
- size_t shmem_length;
+ size_t i, n, n1, shmem_length, shmem_old_size;
/*
* The first thing we do is see if there is an instance->shmem_fname file (still)
@@ -1210,8 +1210,9 @@ oncore_read_config(
*/
FILE *fd;
- char *cp, *cc, *ca, line[100], units[2], device[64], **cpp;
- char *dirs[] = { "/etc/ntp", "/etc", 0 };
+ char *cc, *ca, line[100], units[2], device[64];
+ const char *dirs[] = { "/etc/ntp", "/etc", 0 };
+ const char *cp, **cpp;
int i, sign, lat_flg, long_flg, ht_flg, mode, mask;
double f1, f2, f3;
@@ -1239,19 +1240,20 @@ oncore_read_config(
mode = mask = 0;
lat_flg = long_flg = ht_flg = 0;
while (fgets(line, 100, fd)) {
+ char *cpw;
/* Remove comments */
- if ((cp = strchr(line, '#')))
- *cp = '\0';
+ if ((cpw = strchr(line, '#')))
+ *cpw = '\0';
/* Remove trailing space */
for (i = strlen(line);
- i > 0 && isascii((int)line[i - 1]) && isspace((int)line[i - 1]);
+ i > 0 && isascii((unsigned char)line[i - 1]) && isspace((unsigned char)line[i - 1]);
)
line[--i] = '\0';
/* Remove leading space */
- for (cc = line; *cc && isascii((int)*cc) && isspace((int)*cc); cc++)
+ for (cc = line; *cc && isascii((unsigned char)*cc) && isspace((unsigned char)*cc); cc++)
continue;
/* Stop if nothing left */
@@ -1260,16 +1262,16 @@ oncore_read_config(
/* Uppercase the command and find the arg */
for (ca = cc; *ca; ca++) {
- if (isascii((int)*ca)) {
- if (islower((int)*ca)) {
- *ca = toupper(*ca);
- } else if (isspace((int)*ca) || (*ca == '='))
+ if (isascii((unsigned char)*ca)) {
+ if (islower((unsigned char)*ca)) {
+ *ca = toupper((unsigned char)*ca);
+ } else if (isspace((unsigned char)*ca) || (*ca == '='))
break;
}
}
/* Remove space (and possible =) leading the arg */
- for (; *ca && isascii((int)*ca) && (isspace((int)*ca) || (*ca == '=')); ca++)
+ for (; *ca && isascii((unsigned char)*ca) && (isspace((unsigned char)*ca) || (*ca == '=')); ca++)
continue;
if (!strncmp(cc, "STATUS", (size_t) 6) || !strncmp(cc, "SHMEM", (size_t) 5)) {
@@ -1278,9 +1280,9 @@ oncore_read_config(
}
/* Uppercase argument as well */
- for (cp = ca; *cp; cp++)
- if (isascii((int)*cp) && islower((int)*cp))
- *cp = toupper(*cp);
+ for (cpw = ca; *cpw; cpw++)
+ if (isascii((unsigned char)*cpw) && islower((unsigned char)*cpw))
+ *cpw = toupper((unsigned char)*cpw);
if (!strncmp(cc, "LAT", (size_t) 3)) {
f1 = f2 = f3 = 0;
@@ -1477,8 +1479,7 @@ oncore_consume(
struct instance *instance
)
{
- int i, m;
- unsigned l;
+ unsigned i, m, l;
while (rcvptr >= 7) {
if (rcvbuf[0] != '@' || rcvbuf[1] != '@') {
@@ -1984,7 +1985,7 @@ oncore_msg_Ag(
size_t len
)
{
- char *cp;
+ const char *cp;
cp = "set to";
if (instance->o_state == ONCORE_RUN)
@@ -2503,9 +2504,9 @@ oncore_msg_Bl(
size_t len
)
{
- int chan, id, subframe, valid, page, i, j, tow;
+ int subframe, valid, page, i, j, tow;
int day_now, day_lsf;
- char *cp;
+ const char *cp;
enum {
WARN_NOT_YET,
WARN_0,
@@ -2516,8 +2517,6 @@ oncore_msg_Bl(
day_now = day_lsf = 0;
cp = NULL; /* keep gcc happy */
- chan = buf[4] & 0377;
- id = buf[5] & 0377;
subframe = buf[6] & 017;
valid = (buf[6] >> 4) & 017;
page = buf[7];
@@ -2889,19 +2888,20 @@ oncore_msg_Cj_id(
size_t len
)
{
- char *cp, *cp1, *cp2, Model[21];
+ char *cp2, Model[21];
+ const char *cp, *cp1;
/* Write Receiver ID message to clockstats file */
instance->Cj[294] = '\0';
- for (cp=(char *)instance->Cj; cp< (char *) &instance->Cj[294]; ) {
- cp1 = strchr(cp, '\r');
- if (!cp1)
- cp1 = (char *)&instance->Cj[294];
- *cp1 = '\0';
+ for (cp= (char *)instance->Cj; cp< (char *) &instance->Cj[294]; ) {
+ char *cpw = strchr(cp, '\r');
+ if (!cpw)
+ cpw = (char *)&instance->Cj[294];
+ *cpw = '\0';
oncore_log(instance, LOG_NOTICE, cp);
- *cp1 = '\r';
- cp = cp1+2;
+ *cpw = '\r';
+ cp = cpw+2;
}
/* next, the Firmware Version and Revision numbers */
@@ -2916,7 +2916,7 @@ oncore_msg_Cj_id(
;
cp1 = cp;
cp2 = Model;
- for (; !isspace((int)*cp) && cp-cp1 < 20; cp++, cp2++)
+ for (; !isspace((unsigned char)*cp) && cp-cp1 < 20; cp++, cp2++)
*cp2 = *cp;
*cp2 = '\0';
@@ -3046,7 +3046,7 @@ oncore_msg_Cj_init(
if (mode != 0) {
/* cable delay in ns */
memcpy(Cmd, oncore_cmd_Az, (size_t) sizeof(oncore_cmd_Az));
- w32_buf(&Cmd[-2+4], instance->delay);
+ w32_buf(&Cmd[-2+4], (int)instance->delay);
oncore_sendmsg(instance, Cmd, sizeof(oncore_cmd_Az)); /* 6,8,12 */
/* PPS offset in ns */
@@ -3146,7 +3146,7 @@ oncore_msg_Gb(
size_t len
)
{
- char * gmts;
+ const char * gmts;
int mo, d, y, h, m, s, gmth, gmtm;
mo = buf[4];
@@ -3177,7 +3177,7 @@ oncore_msg_Gc(
size_t len
)
{
- char *tbl[] = {"OFF", "ON", "SATELLITE", "TRAIM" };
+ const char *tbl[] = {"OFF", "ON", "SATELLITE", "TRAIM" };
instance->pps_control_msg_seen = 1;
oncore_log_f(instance, LOG_INFO, "PPS Control set to %s",
@@ -3202,7 +3202,7 @@ oncore_msg_Gj(
};
int dt;
- char *cp;
+ const char *cp;
instance->saw_Gj = 1; /* flag, saw_Gj, dont need to try Bj in check_leap */
@@ -3282,7 +3282,7 @@ oncore_antenna_report(
struct instance *instance,
enum antenna_state new_state)
{
- char *cp;
+ const char *cp;
if (instance->ant_state == new_state)
return;
diff --git a/ntpd/refclock_parse.c b/ntpd/refclock_parse.c
index 052ec3a5ed99..aa4be6063c1d 100644
--- a/ntpd/refclock_parse.c
+++ b/ntpd/refclock_parse.c
@@ -16,7 +16,7 @@
* SunOS 4.x and SunOS5.x.
*
* Copyright (c) 1995-2009 by Frank Kardel ntp.org>
- * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1537,7 +1537,7 @@ clear_err(
{
if (lstate == ERR_ALL)
{
- int i;
+ size_t i;
for (i = 0; i < ERR_CNT; i++)
{
@@ -1638,7 +1638,7 @@ mkreadable(
if (!hex && /* no binary only */
(*src != '\\') && /* no plain \ */
(*src != '"') && /* no " */
- isprint((int)*src)) /* only printables */
+ isprint((unsigned char)*src)) /* only printables */
{ /* they are easy... */
*buffer++ = *src++;
blen--;
@@ -1771,6 +1771,16 @@ static bind_t io_bindings[] =
},
{
(char *)0,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
}
};
@@ -2452,6 +2462,31 @@ init_iobinding(
** support routines
**/
+static NTP_PRINTF(4, 5) char *
+ap(char *buffer, size_t len, char *pos, const char *fmt, ...)
+{
+ va_list va;
+ int l;
+ size_t rem = len - (pos - buffer);
+
+ if (rem == 0)
+ return pos;
+
+ va_start(va, fmt);
+ l = vsnprintf(pos, rem, fmt, va);
+ va_end(va);
+
+ if (l != -1) {
+ rem--;
+ if (rem >= (size_t)l)
+ pos += l;
+ else
+ pos += rem;
+ }
+
+ return pos;
+}
+
/*--------------------------------------------------
* convert a flag field to a string
*/
@@ -2480,7 +2515,7 @@ parsestate(
{ PARSEB_TIMECODE, "TIME CODE" },
{ PARSEB_PPS, "PPS" },
{ PARSEB_POSITION, "POSITION" },
- { 0 }
+ { 0, NULL }
};
static struct sbits
@@ -2493,12 +2528,11 @@ parsestate(
{ PARSEB_S_PPS, "PPS SIGNAL" },
{ PARSEB_S_ANTENNA, "ANTENNA" },
{ PARSEB_S_POSITION, "POSITION" },
- { 0 }
+ { 0, NULL }
};
int i;
char *s, *t;
-
*buffer = '\0';
s = t = buffer;
@@ -2508,42 +2542,37 @@ parsestate(
if (flagstrings[i].bit & lstate)
{
if (s != t)
- strlcpy(t, "; ", BUFFER_SIZES(buffer, t, size));
- if (strlcat(t, flagstrings[i].name, BUFFER_SIZES(buffer, t, size)) <
- BUFFER_SIZES(buffer, t, size))
- t += strlen(t);
+ t = ap(buffer, size, t, "; ");
+ t = ap(buffer, size, t, "%s", flagstrings[i].name);
}
i++;
}
if (lstate & (PARSEB_S_LEAP|PARSEB_S_ANTENNA|PARSEB_S_PPS|PARSEB_S_POSITION))
{
- if (s != t &&
- strlcpy(t, "; ", BUFFER_SIZES(buffer, t, size)) <
- BUFFER_SIZES(buffer, t, size))
- t += strlen(t);
+ if (s != t)
+ t = ap(buffer, size, t, "; ");
- if (strlcpy(t, "(", BUFFER_SIZES(buffer, t, size)) <
- BUFFER_SIZES(buffer, t, size))
- s = t = t + strlen(t);
+ t = ap(buffer, size, t, "(");
+
+ s = t;
i = 0;
while (sflagstrings[i].bit)
{
if (sflagstrings[i].bit & lstate)
{
- if (t != s &&
- strlcpy(t, "; ", BUFFER_SIZES(buffer, t, size)) <
- BUFFER_SIZES(buffer, t, size))
- t += 2;
+ if (t != s)
+ {
+ t = ap(buffer, size, t, "; ");
+ }
- if (strlcpy(t, sflagstrings[i].name, BUFFER_SIZES(buffer, t, size)) <
- BUFFER_SIZES(buffer, t, size))
- t += strlen(t);
+ t = ap(buffer, size, t, "%s",
+ sflagstrings[i].name);
}
i++;
}
- strlcpy(t, ")", BUFFER_SIZES(buffer, t, size));
+ t = ap(buffer, size, t, ")");
}
return buffer;
}
@@ -2571,10 +2600,12 @@ parsestatus(
{ CVT_BADDATE, "DATE ILLEGAL" },
{ CVT_BADTIME, "TIME ILLEGAL" },
{ CVT_ADDITIONAL, "ADDITIONAL DATA" },
- { 0 }
+ { 0, NULL }
};
int i;
+ char *t;
+ t = buffer;
*buffer = '\0';
i = 0;
@@ -2582,9 +2613,9 @@ parsestatus(
{
if (flagstrings[i].bit & lstate)
{
- if (buffer[0])
- strlcat(buffer, "; ", size);
- strlcat(buffer, flagstrings[i].name, size);
+ if (t != buffer)
+ t = ap(buffer, size, t, "; ");
+ t = ap(buffer, size, t, "%s", flagstrings[i].name);
}
i++;
}
@@ -2614,12 +2645,12 @@ clockstatus(
{ CEVNT_PROP, "PROPAGATION DELAY" },
{ CEVNT_BADDATE, "ILLEGAL DATE" },
{ CEVNT_BADTIME, "ILLEGAL TIME" },
- { (unsigned)~0L }
+ { (unsigned)~0L, NULL }
};
int i;
i = 0;
- while (flagstrings[i].value != ~0)
+ while (flagstrings[i].value != (u_int)~0)
{
if (flagstrings[i].value == lstate)
{
@@ -2647,10 +2678,11 @@ l_mktime(
char *t;
buffer[0] = '\0';
+ t = buffer;
if ((tmp = delta / (60*60*24)) != 0)
{
- snprintf(buffer, BUFFER_SIZE(buffer, buffer), "%ldd+", (u_long)tmp);
+ t = ap(buffer, sizeof(buffer), t, "%ldd+", (u_long)tmp);
delta -= tmp * 60*60*24;
}
@@ -2659,10 +2691,8 @@ l_mktime(
m = delta % 60;
delta /= 60;
- t = buffer + strlen(buffer);
-
- snprintf(t, BUFFER_SIZE(buffer, t), "%02d:%02d:%02d",
- (int)delta, (int)m, (int)s);
+ t = ap(buffer, sizeof(buffer), t, "%02d:%02d:%02d",
+ (int)delta, (int)m, (int)s);
return buffer;
}
@@ -2853,7 +2883,7 @@ parse_ppsapi(
)
{
int cap, mode_ppsoffset;
- char *cp;
+ const char *cp;
parse->flags &= ~PARSE_PPSCLOCK;
@@ -2961,7 +2991,7 @@ parse_start(
type = CLK_TYPE(peer);
unit = CLK_UNIT(peer);
- if ((type == ~0) || (parse_clockinfo[type].cl_description == (char *)0))
+ if ((type == (u_int)~0) || (parse_clockinfo[type].cl_description == (char *)0))
{
msyslog(LOG_ERR, "PARSE receiver #%d: parse_start: unsupported clock type %d (max %d)",
unit, CLK_REALTYPE(peer), ncltypes-1);
@@ -3233,12 +3263,9 @@ parse_start(
parse_shutdown(CLK_UNIT(parse->peer), peer); /* let our cleaning staff do the work */
return 0; /* well, ok - special initialisation broke */
}
-
- tmp_ctl.parseformat.parse_count = strlcpy(tmp_ctl.parseformat.parse_buffer,
- parse->parse_type->cl_format,
- sizeof(tmp_ctl.parseformat.parse_buffer));
- if (tmp_ctl.parseformat.parse_count >= sizeof(tmp_ctl.parseformat.parse_buffer))
- tmp_ctl.parseformat.parse_count = sizeof(tmp_ctl.parseformat.parse_buffer) - 1;
+
+ strlcpy(tmp_ctl.parseformat.parse_buffer, parse->parse_type->cl_format, sizeof(tmp_ctl.parseformat.parse_buffer));
+ tmp_ctl.parseformat.parse_count = strlen(tmp_ctl.parseformat.parse_buffer);
if (!PARSE_SETFMT(parse, &tmp_ctl))
{
@@ -3408,7 +3435,7 @@ parse_poll(
parse->generic->polls++;
if (parse->pollneeddata &&
- ((current_time - parse->pollneeddata) > (1<<(max(min(parse->peer->hpoll, parse->peer->ppoll), parse->peer->minpoll)))))
+ ((int)(current_time - parse->pollneeddata) > (1<<(max(min(parse->peer->hpoll, parse->peer->ppoll), parse->peer->minpoll)))))
{
/*
* start worrying when exceeding a poll inteval
@@ -3521,16 +3548,16 @@ parse_control(
}
start = tt = add_var(&out->kv_list, 128, RO|DEF);
- snprintf(tt, 128, "refclock_time=\"");
- tt += strlen(tt);
+ tt = ap(start, 128, tt, "refclock_time=\"");
if (parse->timedata.parse_time.fp.l_ui == 0)
{
- strlcpy(tt, "\"", BUFFER_SIZES(start, tt, 128));
+ tt = ap(start, 128, tt, "\"");
}
else
{
- snprintf(tt, 128, "%s\"", gmprettydate(&parse->timedata.parse_time.fp));
+ tt = ap(start, 128, tt, "%s\"",
+ gmprettydate(&parse->timedata.parse_time.fp));
}
if (!PARSE_GETTIMECODE(parse, &tmpctl))
@@ -3541,8 +3568,7 @@ parse_control(
else
{
start = tt = add_var(&out->kv_list, 512, RO|DEF);
- snprintf(tt, 512, "refclock_status=\"");
- tt += strlen(tt);
+ tt = ap(start, 512, tt, "refclock_status=\"");
/*
* copy PPS flags from last read transaction (informational only)
@@ -3550,9 +3576,11 @@ parse_control(
tmpctl.parsegettc.parse_state |= parse->timedata.parse_state &
(PARSEB_PPS|PARSEB_S_PPS);
- (void) parsestate(tmpctl.parsegettc.parse_state, tt, BUFFER_SIZES(start, tt, 512));
+ (void)parsestate(tmpctl.parsegettc.parse_state, tt, BUFFER_SIZES(start, tt, 512));
- strlcat(tt, "\"", BUFFER_SIZES(start, tt, 512));
+ tt += strlen(tt);
+
+ tt = ap(start, 512, tt, "\"");
if (tmpctl.parsegettc.parse_count)
mkascii(outstatus+strlen(outstatus), (int)(sizeof(outstatus)- strlen(outstatus) - 1),
@@ -3569,11 +3597,19 @@ parse_control(
}
else
{
- tt = add_var(&out->kv_list, 80, RO|DEF);
- snprintf(tt, 80, "refclock_format=\"");
+ int count = tmpctl.parseformat.parse_count - 1;
- strlcat(tt, tmpctl.parseformat.parse_buffer, 80);
- strlcat(tt,"\"", 80);
+ start = tt = add_var(&out->kv_list, 80, RO|DEF);
+ tt = ap(start, 80, tt, "refclock_format=\"");
+
+ if (count > 0) {
+ tt = ap(start, 80, tt, "%*.*s",
+ count,
+ count,
+ tmpctl.parseformat.parse_buffer);
+ }
+
+ tt = ap(start, 80, tt, "\"");
}
/*
@@ -3581,8 +3617,7 @@ parse_control(
*/
start = tt = add_var(&out->kv_list, LEN_STATES, RO|DEF);
- strlcpy(tt, "refclock_states=\"", LEN_STATES);
- tt += strlen(tt);
+ tt = ap(start, LEN_STATES, tt, "refclock_states=\"");
for (i = 0; i <= CEVNT_MAX; i++)
{
@@ -3616,14 +3651,15 @@ parse_control(
(int)(percent / 100), (int)(percent % 100));
if ((count = strlen(item)) < (LEN_STATES - 40 - (tt - start)))
{
- strlcpy(tt, item, BUFFER_SIZES(start, tt, LEN_STATES));
- tt += count;
+ tt = ap(start, LEN_STATES, tt,
+ "%s", item);
}
sum += s_time;
}
}
- snprintf(tt, BUFFER_SIZES(start, tt, LEN_STATES), "; running time: %s\"", l_mktime(sum));
+ tt = ap(start, LEN_STATES, tt,
+ "; running time: %s\"", l_mktime(sum));
tt = add_var(&out->kv_list, 32, RO);
snprintf(tt, 32, "refclock_id=\"%s\"", parse->parse_type->cl_id);
@@ -3990,7 +4026,7 @@ parse_process(
* implied on second offset
*/
off.l_uf = ~off.l_uf; /* map [0.5..1[ -> [-0.5..0[ */
- off.l_i = (off.l_uf & 0x8000000) ? -1 : 0; /* sign extend */
+ off.l_i = (off.l_uf & 0x80000000) ? -1 : 0; /* sign extend */
}
else
{
@@ -4142,20 +4178,7 @@ parse_process(
*/
if (PARSE_PPS(parsetime->parse_state) && CLK_PPS(parse->peer))
{
- /* refclock_pps includes fudgetime1 - we keep the RS232 offset in there :-( */
- double savedtime1 = parse->generic->fudgetime1;
-
- parse->generic->fudgetime1 = fudge;
-
- if (refclock_pps(parse->peer, &parse->atom,
- parse->flags & (CLK_FLAG1|CLK_FLAG2|CLK_FLAG3|CLK_FLAG4))) {
- parse->peer->flags |= FLAG_PPS;
- } else {
- parse->peer->flags &= ~FLAG_PPS;
- }
-
- parse->generic->fudgetime1 = savedtime1;
-
+ parse->peer->flags |= FLAG_PPS;
parse_hardpps(parse, PARSE_HARDPPS_ENABLE);
}
#endif
@@ -4297,32 +4320,32 @@ gps16x_message(
char *p, *b;
status = get_lsb_short(&bufp);
- snprintf(buffer, sizeof(buffer), "meinberg_gps_status=\"[0x%04x] ", status);
+ p = b = buffer;
+ p = ap(buffer, sizeof(buffer), p,
+ "meinberg_gps_status=\"[0x%04x] ",
+ status);
if (status)
{
- p = b = buffer + strlen(buffer);
+ b = p;
while (s->flag)
{
if (status & s->flag)
{
if (p != b)
{
- *p++ = ',';
- *p++ = ' ';
+ p = ap(buffer, sizeof(buffer), p, ", ");
}
- strlcat(p, (const char *)s->string, sizeof(buffer));
+ p = ap(buffer, sizeof(buffer), p, "%s", (const char *)s->string);
}
s++;
}
-
- *p++ = '"';
- *p = '\0';
+ p = ap(buffer, sizeof(buffer), p, "\"");
}
else
{
- strlcat(buffer, "\"", sizeof(buffer));
+ p = ap(buffer, sizeof(buffer), p, "\"");
}
set_var(&parse->kv, buffer, strlen(buffer)+1, RO|DEF);
@@ -4373,53 +4396,54 @@ gps16x_message(
{
ANT_INFO antinfo;
char buffer[512];
- char *p;
+ char *p, *q;
get_mbg_antinfo(&bufp, &antinfo);
- snprintf(buffer, sizeof(buffer), "meinberg_antenna_status=\"");
- p = buffer + strlen(buffer);
-
+ p = buffer;
+ p = ap(buffer, sizeof(buffer), p, "meinberg_antenna_status=\"");
switch (antinfo.status)
{
case ANT_INVALID:
- strlcat(p, "", BUFFER_SIZE(buffer, p));
- p += strlen(p);
+ p = ap(buffer, sizeof(buffer),
+ p, "");
break;
case ANT_DISCONN:
- strlcat(p, "DISCONNECTED since ", BUFFER_SIZE(buffer, p));
+ q = ap(buffer, sizeof(buffer),
+ p, "DISCONNECTED since ");
NLOG(NLOG_CLOCKSTATUS)
ERR(ERR_BADSTATUS)
msyslog(LOG_ERR,"PARSE receiver #%d: ANTENNA FAILURE: %s",
CLK_UNIT(parse->peer), p);
- p += strlen(p);
+ p = q;
mbg_tm_str(&p, &antinfo.tm_disconn, BUFFER_SIZE(buffer, p));
*p = '\0';
break;
case ANT_RECONN:
- strlcat(p, "RECONNECTED on ", BUFFER_SIZE(buffer, p));
- p += strlen(p);
+ p = ap(buffer, sizeof(buffer),
+ p, "RECONNECTED on ");
mbg_tm_str(&p, &antinfo.tm_reconn, BUFFER_SIZE(buffer, p));
- snprintf(p, BUFFER_SIZE(buffer, p), ", reconnect clockoffset %c%ld.%07ld s, disconnect time ",
+ p = ap(buffer, sizeof(buffer),
+ p, ", reconnect clockoffset %c%ld.%07ld s, disconnect time ",
(antinfo.delta_t < 0) ? '-' : '+',
ABS(antinfo.delta_t) / 10000,
ABS(antinfo.delta_t) % 10000);
- p += strlen(p);
mbg_tm_str(&p, &antinfo.tm_disconn, BUFFER_SIZE(buffer, p));
*p = '\0';
break;
default:
- snprintf(p, BUFFER_SIZE(buffer, p), "bad status 0x%04x", antinfo.status);
- p += strlen(p);
+ p = ap(buffer, sizeof(buffer),
+ p, "bad status 0x%04x",
+ antinfo.status);
break;
}
- strlcat(p, "\"", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "\"");
- set_var(&parse->kv, buffer, strlen(buffer)+1, RO|DEF);
+ set_var(&parse->kv, buffer, sizeof(buffer), RO|DEF);
}
break;
@@ -4438,102 +4462,101 @@ gps16x_message(
int i;
p = buffer;
- strlcpy(buffer, "gps_tot_51=\"", BUFFER_SIZE(buffer, p));
- p += strlen(p);
+ p = ap(buffer, sizeof(buffer),
+ p, "gps_tot_51=\"");
mbg_tgps_str(&p, &cfgh.tot_51, BUFFER_SIZE(buffer, p));
- strlcpy(p, "\"", BUFFER_SIZE(buffer, p));
- set_var(&parse->kv, buffer, strlen(buffer)+1, RO);
+ p = ap(buffer, sizeof(buffer),
+ p, "\"");
+ set_var(&parse->kv, buffer, sizeof(buffer), RO);
p = buffer;
- strlcpy(buffer, "gps_tot_63=\"", BUFFER_SIZE(buffer, p));
- p += strlen(p);
+ p = ap(buffer, sizeof(buffer),
+ p, "gps_tot_63=\"");
mbg_tgps_str(&p, &cfgh.tot_63, BUFFER_SIZE(buffer, p));
- strlcpy(p, "\"", BUFFER_SIZE(buffer, p));
- set_var(&parse->kv, buffer, strlen(buffer)+1, RO);
+ p = ap(buffer, sizeof(buffer),
+ p, "\"");
+ set_var(&parse->kv, buffer, sizeof(buffer), RO);
p = buffer;
- strlcpy(buffer, "gps_t0a=\"", BUFFER_SIZE(buffer, p));
- p += strlen(p);
+ p = ap(buffer, sizeof(buffer),
+ p, "gps_t0a=\"");
mbg_tgps_str(&p, &cfgh.t0a, BUFFER_SIZE(buffer, p));
- strlcpy(p, "\"", BUFFER_SIZE(buffer, p));
- set_var(&parse->kv, buffer, strlen(buffer)+1, RO);
+ p = ap(buffer, sizeof(buffer),
+ p, "\"");
+ set_var(&parse->kv, buffer, sizeof(buffer), RO);
for (i = MIN_SVNO; i < MAX_SVNO; i++)
{
p = buffer;
- snprintf(p, BUFFER_SIZE(buffer, p), "gps_cfg[%d]=\"[0x%x] ", i, cfgh.cfg[i]);
- p += strlen(p);
+ p = ap(buffer, sizeof(buffer), p, "gps_cfg[%d]=\"[0x%x] ", i, cfgh.cfg[i]);
switch (cfgh.cfg[i] & 0x7)
{
case 0:
- strlcpy(p, "BLOCK I", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "BLOCK I");
break;
case 1:
- strlcpy(p, "BLOCK II", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "BLOCK II");
break;
default:
- strlcpy(p, "bad CFG", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "bad CFG");
break;
}
- strlcat(p, "\"", BUFFER_SIZE(buffer, p));
- set_var(&parse->kv, buffer, strlen(buffer)+1, RO);
+ p = ap(buffer, sizeof(buffer), p, "\"");
+ set_var(&parse->kv, buffer, sizeof(buffer), RO);
p = buffer;
- snprintf(p, BUFFER_SIZE(buffer, p), "gps_health[%d]=\"[0x%x] ", i, cfgh.health[i]);
- p += strlen(p);
+ p = ap(buffer, sizeof(buffer), p, "gps_health[%d]=\"[0x%x] ", i, cfgh.health[i]);
switch ((cfgh.health[i] >> 5) & 0x7 )
{
case 0:
- strlcpy(p, "OK;", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "OK;");
break;
case 1:
- strlcpy(p, "PARITY;", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "PARITY;");
break;
case 2:
- strlcpy(p, "TLM/HOW;", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "TLM/HOW;");
break;
case 3:
- strlcpy(p, "Z-COUNT;", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "Z-COUNT;");
break;
case 4:
- strlcpy(p, "SUBFRAME 1,2,3;", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "SUBFRAME 1,2,3;");
break;
case 5:
- strlcpy(p, "SUBFRAME 4,5;", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "SUBFRAME 4,5;");
break;
case 6:
- strlcpy(p, "UPLOAD BAD;", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "UPLOAD BAD;");
break;
case 7:
- strlcpy(p, "DATA BAD;", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "DATA BAD;");
break;
}
- p += strlen(p);
-
switch (cfgh.health[i] & 0x1F)
{
case 0:
- strlcpy(p, "SIGNAL OK", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "SIGNAL OK");
break;
case 0x1C:
- strlcpy(p, "SV TEMP OUT", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "SV TEMP OUT");
break;
case 0x1D:
- strlcpy(p, "SV WILL BE TEMP OUT", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "SV WILL BE TEMP OUT");
break;
case 0x1E:
break;
case 0x1F:
- strlcpy(p, "MULTIPLE ERRS", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "MULTIPLE ERRS");
break;
default:
- strlcpy(p, "TRANSMISSION PROBLEMS", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "TRANSMISSION PROBLEMS");
break;
}
- strlcat(p, "\"", sizeof(buffer));
- set_var(&parse->kv, buffer, strlen(buffer)+1, RO);
+ p = ap(buffer, sizeof(buffer), p, "\"");
+ set_var(&parse->kv, buffer, sizeof(buffer), RO);
}
}
}
@@ -4557,16 +4580,16 @@ gps16x_message(
if (utc.valid)
{
- strlcpy(p, "gps_utc_correction=\"", sizeof(buffer));
- p += strlen(p);
+ p = ap(buffer, sizeof(buffer), p, "gps_utc_correction=\"");
mk_utcinfo(p, utc.t0t.wn, utc.WNlsf, utc.DNt, utc.delta_tls, utc.delta_tlsf, BUFFER_SIZE(buffer, p));
- strlcat(p, "\"", BUFFER_SIZE(buffer, p));
+ p += strlen(p);
+ p = ap(buffer, sizeof(buffer), p, "\"");
}
else
{
- strlcpy(p, "gps_utc_correction=\"\"", BUFFER_SIZE(buffer, p));
+ p = ap(buffer, sizeof(buffer), p, "gps_utc_correction=\"\"");
}
- set_var(&parse->kv, buffer, strlen(buffer)+1, RO|DEF);
+ set_var(&parse->kv, buffer, sizeof(buffer), RO|DEF);
}
break;
@@ -4588,9 +4611,9 @@ gps16x_message(
snprintf(buffer, sizeof(buffer), "gps_message=\"%s\"", buffer1);
}
else
- strlcpy(buffer, "gps_message=", sizeof(buffer));
+ snprintf(buffer, sizeof(buffer), "gps_message=");
- set_var(&parse->kv, buffer, strlen(buffer)+1, RO|DEF);
+ set_var(&parse->kv, buffer, sizeof(buffer), RO|DEF);
}
break;
@@ -4863,7 +4886,7 @@ trimbletaip_event(
}
else
{
- if (rtc != strlen(*iv))
+ if (rtc != (int)strlen(*iv))
{
msyslog(LOG_ERR, "PARSE receiver #%d: trimbletaip_event: failed to send cmd incomplete (%d of %d bytes sent)",
CLK_UNIT(parse->peer), rtc, (int)strlen(*iv));
@@ -5394,7 +5417,7 @@ trimbletsip_message(
{
#ifdef DEBUG
if (debug > 2) {
- int i;
+ size_t i;
printf("TRIMBLE BAD packet, size %d:\n ", size);
for (i = 0; i < size; i++) {
@@ -5417,7 +5440,7 @@ trimbletsip_message(
#ifdef DEBUG
if (debug > 3) {
- int i;
+ size_t i;
printf("TRIMBLE packet 0x%02x, size %d:\n ", cmd, size);
for (i = 0; i < size; i++) {
@@ -5435,7 +5458,7 @@ trimbletsip_message(
if (s)
{
- snprintf(t, BUFFER_SIZE(pbuffer, t), "%s=\"", s->varname);
+ t = ap(pbuffer, sizeof(pbuffer), t, "%s=\"", s->varname);
}
else
{
@@ -5445,45 +5468,41 @@ trimbletsip_message(
var_flag = s->varmode;
- t += strlen(t);
-
switch(cmd)
{
case CMD_RCURTIME:
- snprintf(t, BUFFER_SIZE(pbuffer, t), "%f, %d, %f",
+ t = ap(pbuffer, sizeof(pbuffer), t, "%f, %d, %f",
getflt((unsigned char *)&mb(0)), getshort((unsigned char *)&mb(4)),
getflt((unsigned char *)&mb(6)));
break;
case CMD_RBEST4:
- strlcpy(t, "mode: ", BUFFER_SIZE(pbuffer, t));
- t += strlen(t);
+ t = ap(pbuffer, sizeof(pbuffer), t, "mode: ");
switch (mb(0) & 0xF)
{
default:
- snprintf(t, BUFFER_SIZE(pbuffer, t), "0x%x", mb(0) & 0x7);
+ t = ap(pbuffer, sizeof(pbuffer), t,
+ "0x%x", mb(0) & 0x7);
break;
case 1:
- strlcpy(t, "0D", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "0D");
break;
case 3:
- strlcpy(t, "2D", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "2D");
break;
case 4:
- strlcpy(t, "3D", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "3D");
break;
}
- t += strlen(t);
if (mb(0) & 0x10)
- strlcpy(t, "-MANUAL, ", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "-MANUAL, ");
else
- strlcpy(t, "-AUTO, ", BUFFER_SIZE(pbuffer, t));
- t += strlen(t);
+ t = ap(pbuffer, sizeof(pbuffer), t, "-AUTO, ");
- snprintf(t, BUFFER_SIZE(pbuffer, t), "satellites %02d %02d %02d %02d, PDOP %.2f, HDOP %.2f, VDOP %.2f, TDOP %.2f",
+ t = ap(pbuffer, sizeof(pbuffer), t, "satellites %02d %02d %02d %02d, PDOP %.2f, HDOP %.2f, VDOP %.2f, TDOP %.2f",
mb(1), mb(2), mb(3), mb(4),
getflt((unsigned char *)&mb(5)),
getflt((unsigned char *)&mb(9)),
@@ -5493,7 +5512,7 @@ trimbletsip_message(
break;
case CMD_RVERSION:
- snprintf(t, BUFFER_SIZE(pbuffer, t), "%d.%d (%d/%d/%d)",
+ t = ap(pbuffer, sizeof(pbuffer), t, "%d.%d (%d/%d/%d)",
mb(0)&0xff, mb(1)&0xff, 1900+(mb(4)&0xff), mb(2)&0xff, mb(3)&0xff);
break;
@@ -5516,43 +5535,40 @@ trimbletsip_message(
switch (mb(0) & 0xFF)
{
default:
- snprintf(t, BUFFER_SIZE(pbuffer, t), "illegal value 0x%02x", mb(0) & 0xFF);
+ t = ap(pbuffer, sizeof(pbuffer), t, "illegal value 0x%02x", mb(0) & 0xFF);
break;
case 0x00:
- strlcpy(t, "doing position fixes", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "doing position fixes");
break;
case 0x01:
- strlcpy(t, "no GPS time yet", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "no GPS time yet");
break;
case 0x03:
- strlcpy(t, "PDOP too high", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "PDOP too high");
break;
case 0x08:
- strlcpy(t, "no usable satellites", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "no usable satellites");
break;
case 0x09:
- strlcpy(t, "only ONE usable satellite", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "only ONE usable satellite");
break;
case 0x0A:
- strlcpy(t, "only TWO usable satellites", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "only TWO usable satellites");
break;
case 0x0B:
- strlcpy(t, "only THREE usable satellites", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "only THREE usable satellites");
break;
case 0x0C:
- strlcpy(t, "the chosen satellite is unusable", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "the chosen satellite is unusable");
break;
}
- t += strlen(t);
-
bits = mb(1) & 0xFF;
for (i = 0; i < 8; i++)
if (bits & (0x1<", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "");
}
}
break;
case CMD_RSAT1BIAS:
- snprintf(t, BUFFER_SIZE(pbuffer, t), "%.1fm %.2fm/s at %.1fs",
+ t = ap(pbuffer, sizeof(pbuffer), t, "%.1fm %.2fm/s at %.1fs",
getflt(&mb(0)), getflt(&mb(4)), getflt(&mb(8)));
break;
case CMD_RIOOPTIONS:
{
- snprintf(t, BUFFER_SIZE(pbuffer, t), "%02x %02x %02x %02x",
+ t = ap(pbuffer, sizeof(pbuffer), t, "%02x %02x %02x %02x",
mb(0), mb(1), mb(2), mb(3));
if (mb(0) != TRIM_POS_OPT ||
mb(2) != TRIM_TIME_OPT)
@@ -5644,9 +5657,9 @@ trimbletsip_message(
double f = getflt((unsigned char *)&mb(12));
if (f > 0.0)
- snprintf(t, BUFFER_SIZE(pbuffer, t), "x= %.1fm, y= %.1fm, z= %.1fm, time_of_fix= %f sec",
- x, y, z,
- f);
+ t = ap(pbuffer, sizeof(pbuffer), t, "x= %.1fm, y= %.1fm, z= %.1fm, time_of_fix= %f sec",
+ x, y, z,
+ f);
else
return;
}
@@ -5659,10 +5672,10 @@ trimbletsip_message(
double f = getflt((unsigned char *)&mb(12));
if (f > 0.0)
- snprintf(t, BUFFER_SIZE(pbuffer, t), "lat %f %c, long %f %c, alt %.2fm",
- ((lat < 0.0) ? (-lat) : (lat))*RTOD, (lat < 0.0 ? 'S' : 'N'),
- ((lng < 0.0) ? (-lng) : (lng))*RTOD, (lng < 0.0 ? 'W' : 'E'),
- getflt((unsigned char *)&mb(8)));
+ t = ap(pbuffer, sizeof(pbuffer), t, "lat %f %c, long %f %c, alt %.2fm",
+ ((lat < 0.0) ? (-lat) : (lat))*RTOD, (lat < 0.0 ? 'S' : 'N'),
+ ((lng < 0.0) ? (-lng) : (lng))*RTOD, (lng < 0.0 ? 'W' : 'E'),
+ getflt((unsigned char *)&mb(8)));
else
return;
}
@@ -5673,8 +5686,8 @@ trimbletsip_message(
double x = getdbl((unsigned char *)&mb(0));
double y = getdbl((unsigned char *)&mb(8));
double z = getdbl((unsigned char *)&mb(16));
- snprintf(t, BUFFER_SIZE(pbuffer, t), "x= %.1fm, y= %.1fm, z= %.1fm",
- x, y, z);
+ t = ap(pbuffer, sizeof(pbuffer), t, "x= %.1fm, y= %.1fm, z= %.1fm",
+ x, y, z);
}
break;
@@ -5682,7 +5695,7 @@ trimbletsip_message(
{
double lat = getdbl((unsigned char *)&mb(0));
double lng = getdbl((unsigned char *)&mb(8));
- snprintf(t, BUFFER_SIZE(pbuffer, t), "lat %f %c, lon %f %c, alt %.2fm",
+ t = ap(pbuffer, sizeof(pbuffer), t, "lat %f %c, lon %f %c, alt %.2fm",
((lat < 0.0) ? (-lat) : (lat))*RTOD, (lat < 0.0 ? 'S' : 'N'),
((lng < 0.0) ? (-lng) : (lng))*RTOD, (lng < 0.0 ? 'W' : 'E'),
getdbl((unsigned char *)&mb(16)));
@@ -5693,43 +5706,38 @@ trimbletsip_message(
{
int i, sats;
- strlcpy(t, "mode: ", BUFFER_SIZE(pbuffer, t));
- t += strlen(t);
+ t = ap(pbuffer, sizeof(pbuffer), t, "mode: ");
switch (mb(0) & 0x7)
{
default:
- snprintf(t, BUFFER_SIZE(pbuffer, t), "0x%x", mb(0) & 0x7);
+ t = ap(pbuffer, sizeof(pbuffer), t, "0x%x", mb(0) & 0x7);
break;
case 3:
- strlcpy(t, "2D", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "2D");
break;
case 4:
- strlcpy(t, "3D", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "3D");
break;
}
- t += strlen(t);
if (mb(0) & 0x8)
- strlcpy(t, "-MANUAL, ", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "-MANUAL, ");
else
- strlcpy(t, "-AUTO, ", BUFFER_SIZE(pbuffer, t));
- t += strlen(t);
+ t = ap(pbuffer, sizeof(pbuffer), t, "-AUTO, ");
sats = (mb(0)>>4) & 0xF;
- snprintf(t, BUFFER_SIZE(pbuffer, t), "PDOP %.2f, HDOP %.2f, VDOP %.2f, TDOP %.2f, %d satellite%s in view: ",
+ t = ap(pbuffer, sizeof(pbuffer), t, "PDOP %.2f, HDOP %.2f, VDOP %.2f, TDOP %.2f, %d satellite%s in view: ",
getflt((unsigned char *)&mb(1)),
getflt((unsigned char *)&mb(5)),
getflt((unsigned char *)&mb(9)),
getflt((unsigned char *)&mb(13)),
sats, (sats == 1) ? "" : "s");
- t += strlen(t);
for (i=0; i < sats; i++)
{
- snprintf(t, BUFFER_SIZE(pbuffer, t), "%s%02d", i ? ", " : "", mb(17+i));
- t += strlen(t);
+ t = ap(pbuffer, sizeof(pbuffer), t, "%s%02d", i ? ", " : "", mb(17+i));
if (tr)
tr->ctrack |= (1 << (mb(17+i)-1));
}
@@ -5743,52 +5751,46 @@ trimbletsip_message(
case CMD_RSTATTRACK:
{
- snprintf(t-2, BUFFER_SIZE(pbuffer, t-2), "[%02d]=\"", mb(0)); /* add index to var name */
- t += strlen(t);
-
+ t = ap(pbuffer, sizeof(pbuffer), t-2, "[%02d]=\"", mb(0)); /* add index to var name */
if (getflt((unsigned char *)&mb(4)) < 0.0)
{
- strlcpy(t, "", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "");
var_flag &= ~DEF;
}
else
{
- snprintf(t, BUFFER_SIZE(pbuffer, t), "ch=%d, acq=%s, eph=%d, signal_level= %5.2f, elevation= %5.2f, azimuth= %6.2f",
+ t = ap(pbuffer, sizeof(pbuffer), t, "ch=%d, acq=%s, eph=%d, signal_level= %5.2f, elevation= %5.2f, azimuth= %6.2f",
(mb(1) & 0xFF)>>3,
mb(2) ? ((mb(2) == 1) ? "ACQ" : "SRCH") : "NEVER",
mb(3),
getflt((unsigned char *)&mb(4)),
getflt((unsigned char *)&mb(12)) * RTOD,
getflt((unsigned char *)&mb(16)) * RTOD);
- t += strlen(t);
if (mb(20))
{
var_flag &= ~DEF;
- strlcpy(t, ", OLD", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, ", OLD");
}
- t += strlen(t);
if (mb(22))
{
if (mb(22) == 1)
- strlcpy(t, ", BAD PARITY", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, ", BAD PARITY");
else
if (mb(22) == 2)
- strlcpy(t, ", BAD EPH HEALTH", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, ", BAD EPH HEALTH");
}
- t += strlen(t);
if (mb(23))
- strlcpy(t, ", collecting data", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, ", collecting data");
}
}
break;
default:
- strlcpy(t, "", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t, "");
break;
}
- t += strlen(t);
- strlcpy(t,"\"", BUFFER_SIZE(pbuffer, t));
+ t = ap(pbuffer, sizeof(pbuffer), t,"\"");
set_var(&parse->kv, pbuffer, sizeof(pbuffer), var_flag);
}
}
diff --git a/ntpd/refclock_pcf.c b/ntpd/refclock_pcf.c
index 4379832b4a7f..45b3475c0d68 100644
--- a/ntpd/refclock_pcf.c
+++ b/ntpd/refclock_pcf.c
@@ -140,7 +140,7 @@ pcf_poll(
pp = peer->procptr;
buf[0] = 0;
- if (read(pp->io.fd, buf, sizeof(buf)) < sizeof(buf) || buf[0] != 9) {
+ if (read(pp->io.fd, buf, sizeof(buf)) < (ssize_t)sizeof(buf) || buf[0] != 9) {
refclock_report(peer, CEVNT_FAULT);
return;
}
diff --git a/ntpd/refclock_shm.c b/ntpd/refclock_shm.c
index 6540e6f377da..7174abdbf4cf 100644
--- a/ntpd/refclock_shm.c
+++ b/ntpd/refclock_shm.c
@@ -50,6 +50,11 @@
#define NSAMPLES 3 /* stages of median filter */
+/*
+ * Mode flags
+ */
+#define SHM_MODE_PRIVATE 0x0001
+
/*
* Function prototypes
*/
@@ -57,7 +62,6 @@ static int shm_start (int unit, struct peer *peer);
static void shm_shutdown (int unit, struct peer *peer);
static void shm_poll (int unit, struct peer *peer);
static void shm_timer (int unit, struct peer *peer);
-static void shm_peek (int unit, struct peer *peer);
static void shm_clockstats (int unit, struct peer *peer);
static void shm_control (int unit, const struct refclockstat * in_st,
struct refclockstat * out_st, struct peer *peer);
@@ -100,6 +104,7 @@ struct shmTime {
struct shmunit {
struct shmTime *shm; /* pointer to shared memory segment */
+ int forall; /* access for all UIDs? */
/* debugging/monitoring counters - reset when printed */
int ticks; /* number of attempts to read data*/
@@ -112,76 +117,87 @@ struct shmunit {
time_t max_delay; /* age/stale limit */
};
+static struct shmTime*
+getShmTime(
+ int unit,
+ int/*BOOL*/ forall
+ )
+{
+ struct shmTime *p = NULL;
-struct shmTime *getShmTime(int);
-
-struct shmTime *getShmTime (int unit) {
#ifndef SYS_WINNT
- int shmid=0;
+
+ int shmid;
/* 0x4e545030 is NTP0.
* Big units will give non-ascii but that's OK
* as long as everybody does it the same way.
*/
- shmid=shmget (0x4e545030 + unit, sizeof (struct shmTime),
- IPC_CREAT | ((unit < 2) ? 0600 : 0666));
+ shmid=shmget(0x4e545030 + unit, sizeof (struct shmTime),
+ IPC_CREAT | (forall ? 0666 : 0600));
if (shmid == -1) { /* error */
msyslog(LOG_ERR, "SHM shmget (unit %d): %m", unit);
- return 0;
+ return NULL;
}
- else { /* no error */
- struct shmTime *p = (struct shmTime *)shmat (shmid, 0, 0);
- if (p == (struct shmTime *)-1) { /* error */
- msyslog(LOG_ERR, "SHM shmat (unit %d): %m", unit);
- return 0;
- }
- return p;
+ p = (struct shmTime *)shmat (shmid, 0, 0);
+ if (p == (struct shmTime *)-1) { /* error */
+ msyslog(LOG_ERR, "SHM shmat (unit %d): %m", unit);
+ return NULL;
}
+ return p;
+
#else
- char buf[10];
+
+ static const char * nspref[2] = { "Local", "Global" };
+ char buf[20];
LPSECURITY_ATTRIBUTES psec = 0;
HANDLE shmid = 0;
SECURITY_DESCRIPTOR sd;
SECURITY_ATTRIBUTES sa;
+ unsigned int numch;
- snprintf(buf, sizeof(buf), "NTP%d", unit);
- if (unit >= 2) { /* world access */
+ numch = snprintf(buf, sizeof(buf), "%s\\NTP%d",
+ nspref[forall != 0], (unit & 0xFF));
+ if (numch >= sizeof(buf)) {
+ msyslog(LOG_ERR, "SHM name too long (unit %d)", unit);
+ return NULL;
+ }
+ if (forall) { /* world access */
if (!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION)) {
msyslog(LOG_ERR,"SHM InitializeSecurityDescriptor (unit %d): %m", unit);
- return 0;
+ return NULL;
}
- if (!SetSecurityDescriptorDacl(&sd, 1, 0, 0)) {
+ if (!SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE)) {
msyslog(LOG_ERR, "SHM SetSecurityDescriptorDacl (unit %d): %m", unit);
- return 0;
+ return NULL;
}
- sa.nLength=sizeof (SECURITY_ATTRIBUTES);
+ sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = &sd;
- sa.bInheritHandle = 0;
+ sa.bInheritHandle = FALSE;
psec = &sa;
}
shmid = CreateFileMapping ((HANDLE)0xffffffff, psec, PAGE_READWRITE,
- 0, sizeof (struct shmTime), buf);
- if (!shmid) { /*error*/
- char buf[1000];
-
+ 0, sizeof (struct shmTime), buf);
+ if (shmid == NULL) { /*error*/
+ char buf[1000];
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,
0, GetLastError (), 0, buf, sizeof (buf), 0);
msyslog(LOG_ERR, "SHM CreateFileMapping (unit %d): %s", unit, buf);
- return 0;
- } else {
- struct shmTime *p = (struct shmTime *) MapViewOfFile (shmid,
- FILE_MAP_WRITE, 0, 0, sizeof (struct shmTime));
- if (p == 0) { /*error*/
- char buf[1000];
-
- FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,
- 0, GetLastError (), 0, buf, sizeof (buf), 0);
- msyslog(LOG_ERR,"SHM MapViewOfFile (unit %d): %s", unit, buf)
- return 0;
- }
- return p;
+ return NULL;
}
+ p = (struct shmTime *)MapViewOfFile(shmid, FILE_MAP_WRITE, 0, 0,
+ sizeof (struct shmTime));
+ if (p == NULL) { /*error*/
+ char buf[1000];
+ FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,
+ 0, GetLastError (), 0, buf, sizeof (buf), 0);
+ msyslog(LOG_ERR,"SHM MapViewOfFile (unit %d): %s", unit, buf);
+ return NULL;
+ }
+
#endif
+
+ return p;
}
/*
* shm_start - attach to shared memory
@@ -192,18 +208,17 @@ shm_start(
struct peer *peer
)
{
- struct refclockproc *pp;
- struct shmunit *up;
+ struct refclockproc * const pp = peer->procptr;
+ struct shmunit * const up = emalloc_zero(sizeof(*up));
- pp = peer->procptr;
pp->io.clock_recv = noentry;
pp->io.srcclock = peer;
pp->io.datalen = 0;
pp->io.fd = -1;
- up = emalloc_zero(sizeof(*up));
+ up->forall = (unit >= 2) && !(peer->ttl & SHM_MODE_PRIVATE);
- up->shm = getShmTime(unit);
+ up->shm = getShmTime(unit, up->forall);
/*
* Initialize miscellaneous peer variables
@@ -243,12 +258,12 @@ shm_control(
struct peer * peer
)
{
- struct refclockproc *pp;
- struct shmunit *up;
-
- pp = peer->procptr;
- up = pp->unitptr;
+ struct refclockproc * const pp = peer->procptr;
+ struct shmunit * const up = pp->unitptr;
+ UNUSED_ARG(unit);
+ UNUSED_ARG(in_st);
+ UNUSED_ARG(out_st);
if (NULL == up)
return;
if (pp->sloppyclockflag & CLK_FLAG1)
@@ -269,34 +284,26 @@ shm_shutdown(
struct peer *peer
)
{
- struct refclockproc *pp;
- struct shmunit *up;
-
- pp = peer->procptr;
- up = pp->unitptr;
+ struct refclockproc * const pp = peer->procptr;
+ struct shmunit * const up = pp->unitptr;
+ UNUSED_ARG(unit);
if (NULL == up)
return;
#ifndef SYS_WINNT
+
/* HMS: shmdt() wants char* or const void * */
- (void) shmdt ((char *)up->shm);
+ (void)shmdt((char *)up->shm);
+
#else
- UnmapViewOfFile (up->shm);
+
+ UnmapViewOfFile(up->shm);
+
#endif
free(up);
}
-/*
- * shm_timer - called every second
- */
-static void
-shm_timer(int unit, struct peer *peer)
-{
- shm_peek(unit, peer);
-}
-
-
/*
* shm_poll - called by the transmit procedure
*/
@@ -306,13 +313,10 @@ shm_poll(
struct peer *peer
)
{
- struct refclockproc *pp;
- struct shmunit *up;
+ struct refclockproc * const pp = peer->procptr;
+ struct shmunit * const up = pp->unitptr;
int major_error;
- pp = peer->procptr;
- up = pp->unitptr;
-
pp->polls++;
/* get dominant reason if we have no samples at all */
@@ -345,16 +349,18 @@ shm_poll(
}
/*
- * shm_peek - try to grab a sample
+ * shm_timer - called onece every second.
+ *
+ * This tries to grab a sample from the SHM segment
*/
static void
-shm_peek(
+shm_timer(
int unit,
struct peer *peer
)
{
- struct refclockproc *pp;
- struct shmunit *up;
+ struct refclockproc * const pp = peer->procptr;
+ struct shmunit * const up = pp->unitptr;
/* access order is important for lock-free SHM access; we
** enforce order by treating the whole structure volatile.
@@ -383,19 +389,16 @@ shm_peek(
* This is the main routine. It snatches the time from the shm
* board and tacks on a local timestamp.
*/
- pp = peer->procptr;
- up = pp->unitptr;
up->ticks++;
- if (up->shm == 0) {
+ if ((shm = up->shm) == NULL) {
/* try to map again - this may succeed if meanwhile some-
body has ipcrm'ed the old (unaccessible) shared mem segment */
- up->shm = getShmTime(unit);
- }
- shm = up->shm;
- if (shm == 0) {
- DPRINTF(1, ("%s: no SHM segment\n",
- refnumtoa(&peer->srcadr)));
- return;
+ shm = up->shm = getShmTime(unit, up->forall);
+ if (shm == NULL) {
+ DPRINTF(1, ("%s: no SHM segment\n",
+ refnumtoa(&peer->srcadr)));
+ return;
+ }
}
if ( ! shm->valid) {
DPRINTF(1, ("%s: SHM not ready\n",
@@ -542,28 +545,17 @@ static void shm_clockstats(
struct peer *peer
)
{
- struct refclockproc *pp;
- struct shmunit *up;
- char logbuf[64];
- unsigned int llen;
-
- pp = peer->procptr;
- up = pp->unitptr;
+ struct refclockproc * const pp = peer->procptr;
+ struct shmunit * const up = pp->unitptr;
+ UNUSED_ARG(unit);
if (pp->sloppyclockflag & CLK_FLAG4) {
- /* if snprintf() returns a negative values on errors
- ** (some older ones do) make sure we are NUL
- ** terminated. Using an unsigned result does the trick.
- */
- llen = snprintf(logbuf, sizeof(logbuf),
- "%3d %3d %3d %3d %3d",
- up->ticks, up->good, up->notready,
- up->bad, up->clash);
- logbuf[min(llen, sizeof(logbuf)-1)] = '\0';
- record_clock_stats(&peer->srcadr, logbuf);
+ mprintf_clock_stats(
+ &peer->srcadr, "%3d %3d %3d %3d %3d",
+ up->ticks, up->good, up->notready,
+ up->bad, up->clash);
}
up->ticks = up->good = up->notready = up->bad = up->clash = 0;
-
}
#else
diff --git a/ntpd/refclock_true.c b/ntpd/refclock_true.c
index 36ade81c7ba5..7a5c491bb595 100644
--- a/ntpd/refclock_true.c
+++ b/ntpd/refclock_true.c
@@ -215,6 +215,7 @@ struct refclock refclock_true = {
#if !defined(__STDC__)
# define true_debug (void)
#else
+NTP_PRINTF(2, 3)
static void
true_debug(struct peer *peer, const char *fmt, ...)
{
diff --git a/ntpd/refclock_wwv.c b/ntpd/refclock_wwv.c
index 14183b46ce2d..79c0afd5bcfb 100644
--- a/ntpd/refclock_wwv.c
+++ b/ntpd/refclock_wwv.c
@@ -1338,7 +1338,7 @@ wwv_qrz(
if (sp->reach & (1 << AMAX))
sp->count--;
if (sp->synmax > ATHR && sp->synsnr > ASNR) {
- if (abs(epoch) < AWND * MS) {
+ if (labs(epoch) < AWND * MS) {
sp->reach |= 1;
sp->count++;
sp->mepoch = sp->lastpos = sp->pos;
@@ -1540,14 +1540,14 @@ wwv_endpoc(
*/
dtemp = (mepoch - zepoch) % WWV_SEC;
if (up->status & FGATE) {
- if (abs(dtemp) < MAXFREQ * MINAVG) {
+ if (fabs(dtemp) < MAXFREQ * MINAVG) {
up->freq += (dtemp / 2.) / ((mcount - zcount) *
FCONST);
if (up->freq > MAXFREQ)
up->freq = MAXFREQ;
else if (up->freq < -MAXFREQ)
up->freq = -MAXFREQ;
- if (abs(dtemp) < MAXFREQ * MINAVG / 2.) {
+ if (fabs(dtemp) < MAXFREQ * MINAVG / 2.) {
if (avginc < 3) {
avginc++;
} else {
diff --git a/ntpdate/Makefile.in b/ntpdate/Makefile.in
index d7ffd18d2273..e0e0ec2d02ea 100644
--- a/ntpdate/Makefile.in
+++ b/ntpdate/Makefile.in
@@ -153,6 +153,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -187,7 +188,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/ntpdate/ntpdate.c b/ntpdate/ntpdate.c
index 16569f30b5f4..08edc8be4a7f 100644
--- a/ntpdate/ntpdate.c
+++ b/ntpdate/ntpdate.c
@@ -751,7 +751,7 @@ receive(
*/
if (rbufp->recv_length == LEN_PKT_NOMAC)
has_mac = 0;
- else if (rbufp->recv_length >= LEN_PKT_NOMAC)
+ else if (rbufp->recv_length >= (int)LEN_PKT_NOMAC)
has_mac = 1;
else {
if (debug)
diff --git a/ntpdc/Makefile.in b/ntpdc/Makefile.in
index 1b77fc9dec56..0837bac4b93d 100644
--- a/ntpdc/Makefile.in
+++ b/ntpdc/Makefile.in
@@ -187,6 +187,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -221,7 +222,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/ntpdc/invoke-ntpdc.texi b/ntpdc/invoke-ntpdc.texi
index cc97163ccf0c..8a9eb270d862 100644
--- a/ntpdc/invoke-ntpdc.texi
+++ b/ntpdc/invoke-ntpdc.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpdc.texi)
#
-# It has been AutoGen-ed December 19, 2014 at 07:49:42 AM by AutoGen 5.18.5pre4
+# It has been AutoGen-ed February 4, 2015 at 02:42:41 AM by AutoGen 5.18.5pre4
# 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.8
+ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p1
Usage: ntpdc [ - [] | --[@{=| @}] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/ntpdc/ntpdc-opts.c b/ntpdc/ntpdc-opts.c
index 11ba2cce359e..070501d00e6c 100644
--- a/ntpdc/ntpdc-opts.c
+++ b/ntpdc/ntpdc-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.c)
*
- * It has been AutoGen-ed December 19, 2014 at 07:49:26 AM by AutoGen 5.18.5pre4
+ * It has been AutoGen-ed February 4, 2015 at 02:42:23 AM by AutoGen 5.18.5pre4
* From the definitions ntpdc-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntpdc program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1970-2014 The University of Delaware, all rights reserved.
+ * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the NTP License, copies of which
* can be seen at:
@@ -31,7 +31,7 @@
* both the copyright notice and this permission notice appear in
* supporting documentation, and that the name The University of Delaware not be used in
* advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. The University of Delaware makes no
+ * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
* representations about the suitability this software for any purpose. It
* is provided "as is" without express or implied warranty.
*/
@@ -50,7 +50,7 @@ extern "C" {
#endif
extern FILE * option_usage_fp;
#define zCopyright (ntpdc_opt_strs+0)
-#define zLicenseDescrip (ntpdc_opt_strs+311)
+#define zLicenseDescrip (ntpdc_opt_strs+341)
/*
* global included definitions
@@ -68,84 +68,85 @@ extern FILE * option_usage_fp;
/**
* static const strings for ntpdc options
*/
-static char const ntpdc_opt_strs[1849] =
-/* 0 */ "ntpdc 4.2.8\n"
- "Copyright (C) 1970-2014 The University of Delaware, all rights reserved.\n"
+static char const ntpdc_opt_strs[1911] =
+/* 0 */ "ntpdc 4.2.8p1\n"
+ "Copyright (C) 1992-2015 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"
"can be seen at:\n"
" \n"
" \n\0"
-/* 311 */ "Permission to use, copy, modify, and distribute this software and its\n"
+/* 341 */ "Permission to use, copy, modify, and distribute this software and its\n"
"documentation for any purpose with or without fee is hereby granted,\n"
"provided that the above copyright notice appears in all copies and that\n"
"both the copyright notice and this permission notice appear in supporting\n"
"documentation, and that the name The University of Delaware not be used in\n"
"advertising or publicity pertaining to distribution of the software without\n"
- "specific, written prior permission. The University of Delaware makes no\n"
- "representations about the suitability this software for any purpose. It is\n"
- "provided \"as is\" without express or implied warranty.\n\0"
-/* 951 */ "Force IPv4 DNS name resolution\0"
-/* 982 */ "IPV4\0"
-/* 987 */ "ipv4\0"
-/* 992 */ "Force IPv6 DNS name resolution\0"
-/* 1023 */ "IPV6\0"
-/* 1028 */ "ipv6\0"
-/* 1033 */ "run a command and exit\0"
-/* 1056 */ "COMMAND\0"
-/* 1064 */ "command\0"
-/* 1072 */ "Increase debug verbosity level\0"
-/* 1103 */ "DEBUG_LEVEL\0"
-/* 1115 */ "debug-level\0"
-/* 1127 */ "Set the debug verbosity level\0"
-/* 1157 */ "SET_DEBUG_LEVEL\0"
-/* 1173 */ "set-debug-level\0"
-/* 1189 */ "Force ntpq to operate in interactive mode\0"
-/* 1231 */ "INTERACTIVE\0"
-/* 1243 */ "interactive\0"
-/* 1255 */ "Print a list of the peers\0"
-/* 1281 */ "LISTPEERS\0"
-/* 1291 */ "listpeers\0"
-/* 1301 */ "numeric host addresses\0"
-/* 1324 */ "NUMERIC\0"
-/* 1332 */ "numeric\0"
-/* 1340 */ "PEERS\0"
-/* 1346 */ "peers\0"
-/* 1352 */ "Show a list of the peers\0"
-/* 1377 */ "SHOWPEERS\0"
-/* 1387 */ "showpeers\0"
-/* 1397 */ "display extended usage information and exit\0"
-/* 1441 */ "help\0"
-/* 1446 */ "extended usage information passed thru pager\0"
-/* 1491 */ "more-help\0"
-/* 1501 */ "output version information and exit\0"
-/* 1537 */ "version\0"
-/* 1545 */ "save the option state to a config file\0"
-/* 1584 */ "save-opts\0"
-/* 1594 */ "load options from a config file\0"
-/* 1626 */ "LOAD_OPTS\0"
-/* 1636 */ "no-load-opts\0"
-/* 1649 */ "no\0"
-/* 1652 */ "NTPDC\0"
-/* 1658 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8\n"
+ "specific, written prior permission. The University of Delaware and Network\n"
+ "Time Foundation makes no representations about the suitability this\n"
+ "software for any purpose. It is provided \"as is\" without express or\n"
+ "implied warranty.\n\0"
+/* 1009 */ "Force IPv4 DNS name resolution\0"
+/* 1040 */ "IPV4\0"
+/* 1045 */ "ipv4\0"
+/* 1050 */ "Force IPv6 DNS name resolution\0"
+/* 1081 */ "IPV6\0"
+/* 1086 */ "ipv6\0"
+/* 1091 */ "run a command and exit\0"
+/* 1114 */ "COMMAND\0"
+/* 1122 */ "command\0"
+/* 1130 */ "Increase debug verbosity level\0"
+/* 1161 */ "DEBUG_LEVEL\0"
+/* 1173 */ "debug-level\0"
+/* 1185 */ "Set the debug verbosity level\0"
+/* 1215 */ "SET_DEBUG_LEVEL\0"
+/* 1231 */ "set-debug-level\0"
+/* 1247 */ "Force ntpq to operate in interactive mode\0"
+/* 1289 */ "INTERACTIVE\0"
+/* 1301 */ "interactive\0"
+/* 1313 */ "Print a list of the peers\0"
+/* 1339 */ "LISTPEERS\0"
+/* 1349 */ "listpeers\0"
+/* 1359 */ "numeric host addresses\0"
+/* 1382 */ "NUMERIC\0"
+/* 1390 */ "numeric\0"
+/* 1398 */ "PEERS\0"
+/* 1404 */ "peers\0"
+/* 1410 */ "Show a list of the peers\0"
+/* 1435 */ "SHOWPEERS\0"
+/* 1445 */ "showpeers\0"
+/* 1455 */ "display extended usage information and exit\0"
+/* 1499 */ "help\0"
+/* 1504 */ "extended usage information passed thru pager\0"
+/* 1549 */ "more-help\0"
+/* 1559 */ "output version information and exit\0"
+/* 1595 */ "version\0"
+/* 1603 */ "save the option state to a config file\0"
+/* 1642 */ "save-opts\0"
+/* 1652 */ "load options from a config file\0"
+/* 1684 */ "LOAD_OPTS\0"
+/* 1694 */ "no-load-opts\0"
+/* 1707 */ "no\0"
+/* 1710 */ "NTPDC\0"
+/* 1716 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p1\n"
"Usage: %s [ - [] | --[{=| }] ]... [ host ...]\n\0"
-/* 1786 */ "$HOME\0"
-/* 1792 */ ".\0"
-/* 1794 */ ".ntprc\0"
-/* 1801 */ "http://bugs.ntp.org, bugs@ntp.org\0"
-/* 1835 */ "\n\0"
-/* 1837 */ "ntpdc 4.2.8";
+/* 1846 */ "$HOME\0"
+/* 1852 */ ".\0"
+/* 1854 */ ".ntprc\0"
+/* 1861 */ "http://bugs.ntp.org, bugs@ntp.org\0"
+/* 1895 */ "\n\0"
+/* 1897 */ "ntpdc 4.2.8p1";
/**
* ipv4 option description with
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the ipv4 option */
-#define IPV4_DESC (ntpdc_opt_strs+951)
+#define IPV4_DESC (ntpdc_opt_strs+1009)
/** Upper-cased name for the ipv4 option */
-#define IPV4_NAME (ntpdc_opt_strs+982)
+#define IPV4_NAME (ntpdc_opt_strs+1040)
/** Name string for the ipv4 option */
-#define IPV4_name (ntpdc_opt_strs+987)
+#define IPV4_name (ntpdc_opt_strs+1045)
/** Other options that appear in conjunction with the ipv4 option */
static int const aIpv4CantList[] = {
INDEX_OPT_IPV6, NO_EQUIVALENT };
@@ -157,11 +158,11 @@ static int const aIpv4CantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the ipv6 option */
-#define IPV6_DESC (ntpdc_opt_strs+992)
+#define IPV6_DESC (ntpdc_opt_strs+1050)
/** Upper-cased name for the ipv6 option */
-#define IPV6_NAME (ntpdc_opt_strs+1023)
+#define IPV6_NAME (ntpdc_opt_strs+1081)
/** Name string for the ipv6 option */
-#define IPV6_name (ntpdc_opt_strs+1028)
+#define IPV6_name (ntpdc_opt_strs+1086)
/** Other options that appear in conjunction with the ipv6 option */
static int const aIpv6CantList[] = {
INDEX_OPT_IPV4, NO_EQUIVALENT };
@@ -172,11 +173,11 @@ static int const aIpv6CantList[] = {
* command option description:
*/
/** Descriptive text for the command option */
-#define COMMAND_DESC (ntpdc_opt_strs+1033)
+#define COMMAND_DESC (ntpdc_opt_strs+1091)
/** Upper-cased name for the command option */
-#define COMMAND_NAME (ntpdc_opt_strs+1056)
+#define COMMAND_NAME (ntpdc_opt_strs+1114)
/** Name string for the command option */
-#define COMMAND_name (ntpdc_opt_strs+1064)
+#define COMMAND_name (ntpdc_opt_strs+1122)
/** Compiled in flag settings for the command option */
#define COMMAND_FLAGS (OPTST_DISABLED | OPTST_STACKED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -185,11 +186,11 @@ static int const aIpv6CantList[] = {
* debug-level option description:
*/
/** Descriptive text for the debug-level option */
-#define DEBUG_LEVEL_DESC (ntpdc_opt_strs+1072)
+#define DEBUG_LEVEL_DESC (ntpdc_opt_strs+1130)
/** Upper-cased name for the debug-level option */
-#define DEBUG_LEVEL_NAME (ntpdc_opt_strs+1103)
+#define DEBUG_LEVEL_NAME (ntpdc_opt_strs+1161)
/** Name string for the debug-level option */
-#define DEBUG_LEVEL_name (ntpdc_opt_strs+1115)
+#define DEBUG_LEVEL_name (ntpdc_opt_strs+1173)
/** Compiled in flag settings for the debug-level option */
#define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
@@ -197,11 +198,11 @@ static int const aIpv6CantList[] = {
* set-debug-level option description:
*/
/** Descriptive text for the set-debug-level option */
-#define SET_DEBUG_LEVEL_DESC (ntpdc_opt_strs+1127)
+#define SET_DEBUG_LEVEL_DESC (ntpdc_opt_strs+1185)
/** Upper-cased name for the set-debug-level option */
-#define SET_DEBUG_LEVEL_NAME (ntpdc_opt_strs+1157)
+#define SET_DEBUG_LEVEL_NAME (ntpdc_opt_strs+1215)
/** Name string for the set-debug-level option */
-#define SET_DEBUG_LEVEL_name (ntpdc_opt_strs+1173)
+#define SET_DEBUG_LEVEL_name (ntpdc_opt_strs+1231)
/** Compiled in flag settings for the set-debug-level option */
#define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
@@ -211,11 +212,11 @@ static int const aIpv6CantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the interactive option */
-#define INTERACTIVE_DESC (ntpdc_opt_strs+1189)
+#define INTERACTIVE_DESC (ntpdc_opt_strs+1247)
/** Upper-cased name for the interactive option */
-#define INTERACTIVE_NAME (ntpdc_opt_strs+1231)
+#define INTERACTIVE_NAME (ntpdc_opt_strs+1289)
/** Name string for the interactive option */
-#define INTERACTIVE_name (ntpdc_opt_strs+1243)
+#define INTERACTIVE_name (ntpdc_opt_strs+1301)
/** Other options that appear in conjunction with the interactive option */
static int const aInteractiveCantList[] = {
INDEX_OPT_COMMAND,
@@ -230,11 +231,11 @@ static int const aInteractiveCantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the listpeers option */
-#define LISTPEERS_DESC (ntpdc_opt_strs+1255)
+#define LISTPEERS_DESC (ntpdc_opt_strs+1313)
/** Upper-cased name for the listpeers option */
-#define LISTPEERS_NAME (ntpdc_opt_strs+1281)
+#define LISTPEERS_NAME (ntpdc_opt_strs+1339)
/** Name string for the listpeers option */
-#define LISTPEERS_name (ntpdc_opt_strs+1291)
+#define LISTPEERS_name (ntpdc_opt_strs+1349)
/** Other options that appear in conjunction with the listpeers option */
static int const aListpeersCantList[] = {
INDEX_OPT_COMMAND, NO_EQUIVALENT };
@@ -245,11 +246,11 @@ static int const aListpeersCantList[] = {
* numeric option description:
*/
/** Descriptive text for the numeric option */
-#define NUMERIC_DESC (ntpdc_opt_strs+1301)
+#define NUMERIC_DESC (ntpdc_opt_strs+1359)
/** Upper-cased name for the numeric option */
-#define NUMERIC_NAME (ntpdc_opt_strs+1324)
+#define NUMERIC_NAME (ntpdc_opt_strs+1382)
/** Name string for the numeric option */
-#define NUMERIC_name (ntpdc_opt_strs+1332)
+#define NUMERIC_name (ntpdc_opt_strs+1390)
/** Compiled in flag settings for the numeric option */
#define NUMERIC_FLAGS (OPTST_DISABLED)
@@ -258,11 +259,11 @@ static int const aListpeersCantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the peers option */
-#define PEERS_DESC (ntpdc_opt_strs+1255)
+#define PEERS_DESC (ntpdc_opt_strs+1313)
/** Upper-cased name for the peers option */
-#define PEERS_NAME (ntpdc_opt_strs+1340)
+#define PEERS_NAME (ntpdc_opt_strs+1398)
/** Name string for the peers option */
-#define PEERS_name (ntpdc_opt_strs+1346)
+#define PEERS_name (ntpdc_opt_strs+1404)
/** Other options that appear in conjunction with the peers option */
static int const aPeersCantList[] = {
INDEX_OPT_COMMAND, NO_EQUIVALENT };
@@ -274,11 +275,11 @@ static int const aPeersCantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the showpeers option */
-#define SHOWPEERS_DESC (ntpdc_opt_strs+1352)
+#define SHOWPEERS_DESC (ntpdc_opt_strs+1410)
/** Upper-cased name for the showpeers option */
-#define SHOWPEERS_NAME (ntpdc_opt_strs+1377)
+#define SHOWPEERS_NAME (ntpdc_opt_strs+1435)
/** Name string for the showpeers option */
-#define SHOWPEERS_name (ntpdc_opt_strs+1387)
+#define SHOWPEERS_name (ntpdc_opt_strs+1445)
/** Other options that appear in conjunction with the showpeers option */
static int const aShowpeersCantList[] = {
INDEX_OPT_COMMAND, NO_EQUIVALENT };
@@ -288,11 +289,11 @@ static int const aShowpeersCantList[] = {
/*
* Help/More_Help/Version option descriptions:
*/
-#define HELP_DESC (ntpdc_opt_strs+1397)
-#define HELP_name (ntpdc_opt_strs+1441)
+#define HELP_DESC (ntpdc_opt_strs+1455)
+#define HELP_name (ntpdc_opt_strs+1499)
#ifdef HAVE_WORKING_FORK
-#define MORE_HELP_DESC (ntpdc_opt_strs+1446)
-#define MORE_HELP_name (ntpdc_opt_strs+1491)
+#define MORE_HELP_DESC (ntpdc_opt_strs+1504)
+#define MORE_HELP_name (ntpdc_opt_strs+1549)
#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
#else
#define MORE_HELP_DESC HELP_DESC
@@ -305,14 +306,14 @@ static int const aShowpeersCantList[] = {
# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
#endif
-#define VER_DESC (ntpdc_opt_strs+1501)
-#define VER_name (ntpdc_opt_strs+1537)
-#define SAVE_OPTS_DESC (ntpdc_opt_strs+1545)
-#define SAVE_OPTS_name (ntpdc_opt_strs+1584)
-#define LOAD_OPTS_DESC (ntpdc_opt_strs+1594)
-#define LOAD_OPTS_NAME (ntpdc_opt_strs+1626)
-#define NO_LOAD_OPTS_name (ntpdc_opt_strs+1636)
-#define LOAD_OPTS_pfx (ntpdc_opt_strs+1649)
+#define VER_DESC (ntpdc_opt_strs+1559)
+#define VER_name (ntpdc_opt_strs+1595)
+#define SAVE_OPTS_DESC (ntpdc_opt_strs+1603)
+#define SAVE_OPTS_name (ntpdc_opt_strs+1642)
+#define LOAD_OPTS_DESC (ntpdc_opt_strs+1652)
+#define LOAD_OPTS_NAME (ntpdc_opt_strs+1684)
+#define NO_LOAD_OPTS_name (ntpdc_opt_strs+1694)
+#define LOAD_OPTS_pfx (ntpdc_opt_strs+1707)
#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)
/**
* Declare option callback procedures
@@ -521,24 +522,24 @@ static tOptDesc optDesc[OPTION_CT] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** Reference to the upper cased version of ntpdc. */
-#define zPROGNAME (ntpdc_opt_strs+1652)
+#define zPROGNAME (ntpdc_opt_strs+1710)
/** Reference to the title line for ntpdc usage. */
-#define zUsageTitle (ntpdc_opt_strs+1658)
+#define zUsageTitle (ntpdc_opt_strs+1716)
/** ntpdc configuration file name. */
-#define zRcName (ntpdc_opt_strs+1794)
+#define zRcName (ntpdc_opt_strs+1854)
/** Directories to search for ntpdc config files. */
static char const * const apzHomeList[3] = {
- ntpdc_opt_strs+1786,
- ntpdc_opt_strs+1792,
+ ntpdc_opt_strs+1846,
+ ntpdc_opt_strs+1852,
NULL };
/** The ntpdc program bug email address. */
-#define zBugsAddr (ntpdc_opt_strs+1801)
+#define zBugsAddr (ntpdc_opt_strs+1861)
/** Clarification/explanation of what ntpdc does. */
-#define zExplain (ntpdc_opt_strs+1835)
+#define zExplain (ntpdc_opt_strs+1895)
/** Extra detail explaining what ntpdc does. */
#define zDetail (NULL)
/** The full version string for ntpdc. */
-#define zFullVersion (ntpdc_opt_strs+1837)
+#define zFullVersion (ntpdc_opt_strs+1897)
/* extracted from optcode.tlib near line 364 */
#if defined(ENABLE_NLS)
@@ -795,8 +796,8 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpdcOptions.pzCopyright */
- puts(_("ntpdc 4.2.8\n\
-Copyright (C) 1970-2014 The University of Delaware, all rights reserved.\n\
+ puts(_("ntpdc 4.2.8p1\n\
+Copyright (C) 1992-2015 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\
can be seen at:\n"));
@@ -810,9 +811,10 @@ provided that the above copyright notice appears in all copies and that\n\
both the copyright notice and this permission notice appear in supporting\n\
documentation, and that the name The University of Delaware not be used in\n\
advertising or publicity pertaining to distribution of the software without\n\
-specific, written prior permission. The University of Delaware makes no\n\
-representations about the suitability this software for any purpose. It is\n\
-provided \"as is\" without express or implied warranty.\n"));
+specific, written prior permission. The University of Delaware and Network\n\
+Time Foundation makes no representations about the suitability this\n\
+software for any purpose. It is provided \"as is\" without express or\n\
+implied warranty.\n"));
/* referenced via ntpdcOptions.pOptDesc->pzText */
puts(_("Force IPv4 DNS name resolution"));
@@ -860,14 +862,14 @@ provided \"as is\" without express or implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpdcOptions.pzUsageTitle */
- puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8\n\
+ puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p1\n\
Usage: %s [ - [] | --[{=| }] ]... [ host ...]\n"));
/* referenced via ntpdcOptions.pzExplain */
puts(_("\n"));
/* referenced via ntpdcOptions.pzFullVersion */
- puts(_("ntpdc 4.2.8"));
+ puts(_("ntpdc 4.2.8p1"));
/* referenced via ntpdcOptions.pzFullUsage */
puts(_("<<>>"));
diff --git a/ntpdc/ntpdc-opts.h b/ntpdc/ntpdc-opts.h
index 31e72bb15b5d..e9a3f2c8ee8e 100644
--- a/ntpdc/ntpdc-opts.h
+++ b/ntpdc/ntpdc-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.h)
*
- * It has been AutoGen-ed December 19, 2014 at 07:49:25 AM by AutoGen 5.18.5pre4
+ * It has been AutoGen-ed February 4, 2015 at 02:42:23 AM by AutoGen 5.18.5pre4
* From the definitions ntpdc-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntpdc program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1970-2014 The University of Delaware, all rights reserved.
+ * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the NTP License, copies of which
* can be seen at:
@@ -31,7 +31,7 @@
* both the copyright notice and this permission notice appear in
* supporting documentation, and that the name The University of Delaware not be used in
* advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. The University of Delaware makes no
+ * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
* representations about the suitability this software for any purpose. It
* is provided "as is" without express or implied warranty.
*/
@@ -83,9 +83,9 @@ typedef enum {
/** count of all options for ntpdc */
#define OPTION_CT 15
/** ntpdc version */
-#define NTPDC_VERSION "4.2.8"
+#define NTPDC_VERSION "4.2.8p1"
/** Full ntpdc version text */
-#define NTPDC_FULL_VERSION "ntpdc 4.2.8"
+#define NTPDC_FULL_VERSION "ntpdc 4.2.8p1"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/ntpdc/ntpdc.1ntpdcman b/ntpdc/ntpdc.1ntpdcman
index 861fade98039..5a9e25354190 100644
--- a/ntpdc/ntpdc.1ntpdcman
+++ b/ntpdc/ntpdc.1ntpdcman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpdc 1ntpdcman "19 Dec 2014" "4.2.8" "User Commands"
+.TH ntpdc 1ntpdcman "04 Feb 2015" "4.2.8p1" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Fraief/ag-Rraadf)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-DnaiLq/ag-QnaaKq)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:49:38 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:42:37 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpdc-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -848,7 +848,7 @@ RFC1305
.SH AUTHORS
The formatting directives in this document came from FreeBSD.
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.SH BUGS
The
diff --git a/ntpdc/ntpdc.1ntpdcmdoc b/ntpdc/ntpdc.1ntpdcmdoc
index 7c8693db08e0..c1681b026a50 100644
--- a/ntpdc/ntpdc.1ntpdcmdoc
+++ b/ntpdc/ntpdc.1ntpdcmdoc
@@ -1,9 +1,9 @@
-.Dd December 19 2014
+.Dd February 4 2015
.Dt NTPDC 1ntpdcmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:49:44 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:42:44 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpdc-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -787,7 +787,7 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Sh AUTHORS
The formatting directives in this document came from FreeBSD.
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.Sh BUGS
The
diff --git a/ntpdc/ntpdc.c b/ntpdc/ntpdc.c
index 35951841e81a..ce35bd4e2308 100644
--- a/ntpdc/ntpdc.c
+++ b/ntpdc/ntpdc.c
@@ -96,8 +96,10 @@ static void hostnames (struct parse *, FILE *);
static void setdebug (struct parse *, FILE *);
static void quit (struct parse *, FILE *);
static void version (struct parse *, FILE *);
-static void warning (const char *, const char *, const char *);
-static void error (const char *, const char *, const char *);
+static void warning (const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
+static void error (const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
static u_long getkeyid (const char *);
@@ -506,7 +508,7 @@ openhost(
sockfd = socket(ai->ai_family, SOCK_DGRAM, 0);
if (sockfd == INVALID_SOCKET) {
- error("socket", "", "");
+ error("socket");
exit(-1);
}
@@ -517,7 +519,7 @@ openhost(
if (setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF,
&rbufsize, sizeof(int)) == -1)
- error("setsockopt", "", "");
+ error("setsockopt");
}
# endif
#endif
@@ -528,7 +530,7 @@ openhost(
#else
if (connect(sockfd, ai->ai_addr, ai->ai_addrlen) == -1) {
#endif /* SYS_VXWORKS */
- error("connect", "", "");
+ error("connect");
exit(-1);
}
@@ -551,7 +553,7 @@ sendpkt(
)
{
if (send(sockfd, xdata, xdatalen, 0) == -1) {
- warning("write to %s failed", currenthost, "");
+ warning("write to %s failed", currenthost);
return -1;
}
@@ -600,7 +602,7 @@ getresponse(
int numrecv;
int seq;
fd_set fds;
- int n;
+ ssize_t n;
int pad;
/*
@@ -629,7 +631,7 @@ getresponse(
n = select(sockfd+1, &fds, (fd_set *)0, (fd_set *)0, &tvo);
if (n == -1) {
- warning("select fails", "", "");
+ warning("select fails");
return -1;
}
if (n == 0) {
@@ -648,7 +650,7 @@ getresponse(
printf("Received sequence numbers");
for (n = 0; n <= MAXSEQ; n++)
if (haveseq[n])
- printf(" %d,", n);
+ printf(" %zd,", n);
if (lastseq != 999)
printf(" last frame received\n");
else
@@ -660,7 +662,7 @@ getresponse(
n = recv(sockfd, (char *)&rpkt, sizeof(rpkt), 0);
if (n == -1) {
- warning("read", "", "");
+ warning("read");
return -1;
}
@@ -668,9 +670,9 @@ getresponse(
/*
* Check for format errors. Bug proofing.
*/
- if (n < RESP_HEADER_SIZE) {
+ if (n < (ssize_t)RESP_HEADER_SIZE) {
if (debug)
- printf("Short (%d byte) packet received\n", n);
+ printf("Short (%zd byte) packet received\n", n);
goto again;
}
if (INFO_VERSION(rpkt.rm_vn_mode) > NTP_VERSION ||
@@ -738,8 +740,8 @@ getresponse(
if ((size_t)datasize > (n-RESP_HEADER_SIZE)) {
if (debug)
printf(
- "Received items %d, size %d (total %d), data in packet is %lu\n",
- items, size, datasize, (u_long)(n-RESP_HEADER_SIZE));
+ "Received items %d, size %d (total %d), data in packet is %zu\n",
+ items, size, datasize, n-RESP_HEADER_SIZE);
goto again;
}
@@ -920,11 +922,11 @@ sendrequest(
if (!maclen) {
fprintf(stderr, "Key not found\n");
return 1;
- } else if (maclen != (info_auth_hashlen + sizeof(keyid_t))) {
+ } else if (maclen != (int)(info_auth_hashlen + sizeof(keyid_t))) {
fprintf(stderr,
- "%d octet MAC, %lu expected with %lu octet digest\n",
- maclen, (u_long)(info_auth_hashlen + sizeof(keyid_t)),
- (u_long)info_auth_hashlen);
+ "%d octet MAC, %zu expected with %zu octet digest\n",
+ maclen, (info_auth_hashlen + sizeof(keyid_t)),
+ info_auth_hashlen);
return 1;
}
return sendpkt(&qpkt, reqsize + maclen);
@@ -973,7 +975,7 @@ doquery(
res = select(sockfd+1, &fds, (fd_set *)0, (fd_set *)0, &tvzero);
if (res == -1) {
- warning("polling select", "", "");
+ warning("polling select");
return -1;
} else if (res > 0)
@@ -1868,34 +1870,44 @@ version(
}
+static void __attribute__((__format__(__printf__, 1, 0)))
+vwarning(const char *fmt, va_list ap)
+{
+ int serrno = errno;
+ (void) fprintf(stderr, "%s: ", progname);
+ vfprintf(stderr, fmt, ap);
+ (void) fprintf(stderr, ": %s\n", strerror(serrno));
+}
+
/*
* warning - print a warning message
*/
-static void
+static void __attribute__((__format__(__printf__, 1, 2)))
warning(
const char *fmt,
- const char *st1,
- const char *st2
+ ...
)
{
- (void) fprintf(stderr, "%s: ", progname);
- (void) fprintf(stderr, fmt, st1, st2);
- (void) fprintf(stderr, ": ");
- perror("");
+ va_list ap;
+ va_start(ap, fmt);
+ vwarning(fmt, ap);
+ va_end(ap);
}
/*
* error - print a message and exit
*/
-static void
+static void __attribute__((__format__(__printf__, 1, 2)))
error(
const char *fmt,
- const char *st1,
- const char *st2
+ ...
)
{
- warning(fmt, st1, st2);
+ va_list ap;
+ va_start(ap, fmt);
+ vwarning(fmt, ap);
+ va_end(ap);
exit(1);
}
diff --git a/ntpdc/ntpdc.h b/ntpdc/ntpdc.h
index bfc222863f39..6da4a5cb765d 100644
--- a/ntpdc/ntpdc.h
+++ b/ntpdc/ntpdc.h
@@ -43,7 +43,7 @@ typedef struct {
struct parse {
char *keyword;
arg_v argval[MAXARGS + MOREARGS];
- int nargs;
+ size_t nargs;
};
/*
diff --git a/ntpdc/ntpdc.html b/ntpdc/ntpdc.html
index 3e450ce049dc..1b6260bf1e03 100644
--- a/ntpdc/ntpdc.html
+++ b/ntpdc/ntpdc.html
@@ -36,7 +36,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.8 of ntpdc.
+
This document applies to version 4.2.8p1 of ntpdc.
The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
IETF specification.
@@ -152,7 +152,7 @@ the usage text by passing it through a pager program.
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.8
+
ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p1
Usage: ntpdc [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/ntpdc/ntpdc.man.in b/ntpdc/ntpdc.man.in
index f3814324b868..281727e4e24b 100644
--- a/ntpdc/ntpdc.man.in
+++ b/ntpdc/ntpdc.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpdc @NTPDC_MS@ "19 Dec 2014" "4.2.8" "User Commands"
+.TH ntpdc @NTPDC_MS@ "04 Feb 2015" "4.2.8p1" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Fraief/ag-Rraadf)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-DnaiLq/ag-QnaaKq)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:49:38 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:42:37 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpdc-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -848,7 +848,7 @@ RFC1305
.SH AUTHORS
The formatting directives in this document came from FreeBSD.
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.SH BUGS
The
diff --git a/ntpdc/ntpdc.mdoc.in b/ntpdc/ntpdc.mdoc.in
index ee074f162c05..d6f3feb6cef1 100644
--- a/ntpdc/ntpdc.mdoc.in
+++ b/ntpdc/ntpdc.mdoc.in
@@ -1,9 +1,9 @@
-.Dd December 19 2014
+.Dd February 4 2015
.Dt NTPDC @NTPDC_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:49:44 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:42:44 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpdc-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -787,7 +787,7 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Sh AUTHORS
The formatting directives in this document came from FreeBSD.
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.Sh BUGS
The
diff --git a/ntpdc/ntpdc_ops.c b/ntpdc/ntpdc_ops.c
index b0e7af05b447..be8ffa24a755 100644
--- a/ntpdc/ntpdc_ops.c
+++ b/ntpdc/ntpdc_ops.c
@@ -1346,7 +1346,7 @@ doconfig(
sendsize = v4sizeof(struct conf_peer);
items = 1;
- while (pcmd->nargs > items) {
+ while (pcmd->nargs > (size_t)items) {
if (STREQ(pcmd->argval[items].string, "prefer"))
flags |= CONF_FLAG_PREFER;
else if (STREQ(pcmd->argval[items].string, "burst"))
@@ -1571,7 +1571,7 @@ doset(
sys.flags = 0;
res = 0;
- for (items = 0; items < pcmd->nargs; items++) {
+ for (items = 0; (size_t)items < pcmd->nargs; items++) {
if (STREQ(pcmd->argval[items].string, "auth"))
sys.flags |= SYS_FLAG_AUTH;
else if (STREQ(pcmd->argval[items].string, "bclient"))
@@ -1833,7 +1833,7 @@ do_restrict(
u_int32 num;
u_long bit;
int i;
- int res;
+ size_t res;
int err;
int sendsize;
@@ -2095,7 +2095,7 @@ reset(
int itemsize;
char *dummy;
int i;
- int res;
+ size_t res;
int err;
err = 0;
@@ -2262,7 +2262,7 @@ do_trustkey(
)
{
u_long keyids[MAXARGS];
- int i;
+ size_t i;
int items;
int itemsize;
char *dummy;
@@ -3055,7 +3055,7 @@ iflist(
int res
)
{
- static char *actions = "?.+-";
+ static const char *actions = "?.+-";
sockaddr_u saddr;
if (res != 0)
diff --git a/ntpq/Makefile.in b/ntpq/Makefile.in
index d42493758a12..a58363ca8c7c 100644
--- a/ntpq/Makefile.in
+++ b/ntpq/Makefile.in
@@ -194,6 +194,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -228,7 +229,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/ntpq/invoke-ntpq.texi b/ntpq/invoke-ntpq.texi
index 017081dc2fa2..7a1b8950222b 100644
--- a/ntpq/invoke-ntpq.texi
+++ b/ntpq/invoke-ntpq.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpq.texi)
#
-# It has been AutoGen-ed December 19, 2014 at 07:50:17 AM by AutoGen 5.18.5pre4
+# It has been AutoGen-ed February 4, 2015 at 02:43:17 AM by AutoGen 5.18.5pre4
# From the definitions ntpq-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -835,7 +835,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpq - standard NTP query program - Ver. 4.2.8
+ntpq - standard NTP query program - Ver. 4.2.8p1
Usage: ntpq [ - [] | --[@{=| @}] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/ntpq/ntpq-opts.c b/ntpq/ntpq-opts.c
index fe2a8fe82033..9c4de559130f 100644
--- a/ntpq/ntpq-opts.c
+++ b/ntpq/ntpq-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpq-opts.c)
*
- * It has been AutoGen-ed December 19, 2014 at 07:49:47 AM by AutoGen 5.18.5pre4
+ * It has been AutoGen-ed February 4, 2015 at 02:42:46 AM by AutoGen 5.18.5pre4
* From the definitions ntpq-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntpq program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1970-2014 The University of Delaware, all rights reserved.
+ * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the NTP License, copies of which
* can be seen at:
@@ -31,7 +31,7 @@
* both the copyright notice and this permission notice appear in
* supporting documentation, and that the name The University of Delaware not be used in
* advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. The University of Delaware makes no
+ * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
* representations about the suitability this software for any purpose. It
* is provided "as is" without express or implied warranty.
*/
@@ -50,7 +50,7 @@ extern "C" {
#endif
extern FILE * option_usage_fp;
#define zCopyright (ntpq_opt_strs+0)
-#define zLicenseDescrip (ntpq_opt_strs+310)
+#define zLicenseDescrip (ntpq_opt_strs+340)
/*
* global included definitions
@@ -68,84 +68,85 @@ extern FILE * option_usage_fp;
/**
* static const strings for ntpq options
*/
-static char const ntpq_opt_strs[1863] =
-/* 0 */ "ntpq 4.2.8\n"
- "Copyright (C) 1970-2014 The University of Delaware, all rights reserved.\n"
+static char const ntpq_opt_strs[1925] =
+/* 0 */ "ntpq 4.2.8p1\n"
+ "Copyright (C) 1992-2015 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"
"can be seen at:\n"
" \n"
" \n\0"
-/* 310 */ "Permission to use, copy, modify, and distribute this software and its\n"
+/* 340 */ "Permission to use, copy, modify, and distribute this software and its\n"
"documentation for any purpose with or without fee is hereby granted,\n"
"provided that the above copyright notice appears in all copies and that\n"
"both the copyright notice and this permission notice appear in supporting\n"
"documentation, and that the name The University of Delaware not be used in\n"
"advertising or publicity pertaining to distribution of the software without\n"
- "specific, written prior permission. The University of Delaware makes no\n"
- "representations about the suitability this software for any purpose. It is\n"
- "provided \"as is\" without express or implied warranty.\n\0"
-/* 950 */ "Force IPv4 DNS name resolution\0"
-/* 981 */ "IPV4\0"
-/* 986 */ "ipv4\0"
-/* 991 */ "Force IPv6 DNS name resolution\0"
-/* 1022 */ "IPV6\0"
-/* 1027 */ "ipv6\0"
-/* 1032 */ "run a command and exit\0"
-/* 1055 */ "COMMAND\0"
-/* 1063 */ "command\0"
-/* 1071 */ "Increase debug verbosity level\0"
-/* 1102 */ "DEBUG_LEVEL\0"
-/* 1114 */ "debug-level\0"
-/* 1126 */ "Set the debug verbosity level\0"
-/* 1156 */ "SET_DEBUG_LEVEL\0"
-/* 1172 */ "set-debug-level\0"
-/* 1188 */ "Force ntpq to operate in interactive mode\0"
-/* 1230 */ "INTERACTIVE\0"
-/* 1242 */ "interactive\0"
-/* 1254 */ "numeric host addresses\0"
-/* 1277 */ "NUMERIC\0"
-/* 1285 */ "numeric\0"
-/* 1293 */ "Always output status line with readvar\0"
-/* 1332 */ "OLD_RV\0"
-/* 1339 */ "old-rv\0"
-/* 1346 */ "Print a list of the peers\0"
-/* 1372 */ "PEERS\0"
-/* 1378 */ "peers\0"
-/* 1384 */ "Display the full 'remote' value\0"
-/* 1416 */ "WIDE\0"
-/* 1421 */ "wide\0"
-/* 1426 */ "display extended usage information and exit\0"
-/* 1470 */ "help\0"
-/* 1475 */ "extended usage information passed thru pager\0"
-/* 1520 */ "more-help\0"
-/* 1530 */ "output version information and exit\0"
-/* 1566 */ "version\0"
-/* 1574 */ "save the option state to a config file\0"
-/* 1613 */ "save-opts\0"
-/* 1623 */ "load options from a config file\0"
-/* 1655 */ "LOAD_OPTS\0"
-/* 1665 */ "no-load-opts\0"
-/* 1678 */ "no\0"
-/* 1681 */ "NTPQ\0"
-/* 1686 */ "ntpq - standard NTP query program - Ver. 4.2.8\n"
+ "specific, written prior permission. The University of Delaware and Network\n"
+ "Time Foundation makes no representations about the suitability this\n"
+ "software for any purpose. It is provided \"as is\" without express or\n"
+ "implied warranty.\n\0"
+/* 1008 */ "Force IPv4 DNS name resolution\0"
+/* 1039 */ "IPV4\0"
+/* 1044 */ "ipv4\0"
+/* 1049 */ "Force IPv6 DNS name resolution\0"
+/* 1080 */ "IPV6\0"
+/* 1085 */ "ipv6\0"
+/* 1090 */ "run a command and exit\0"
+/* 1113 */ "COMMAND\0"
+/* 1121 */ "command\0"
+/* 1129 */ "Increase debug verbosity level\0"
+/* 1160 */ "DEBUG_LEVEL\0"
+/* 1172 */ "debug-level\0"
+/* 1184 */ "Set the debug verbosity level\0"
+/* 1214 */ "SET_DEBUG_LEVEL\0"
+/* 1230 */ "set-debug-level\0"
+/* 1246 */ "Force ntpq to operate in interactive mode\0"
+/* 1288 */ "INTERACTIVE\0"
+/* 1300 */ "interactive\0"
+/* 1312 */ "numeric host addresses\0"
+/* 1335 */ "NUMERIC\0"
+/* 1343 */ "numeric\0"
+/* 1351 */ "Always output status line with readvar\0"
+/* 1390 */ "OLD_RV\0"
+/* 1397 */ "old-rv\0"
+/* 1404 */ "Print a list of the peers\0"
+/* 1430 */ "PEERS\0"
+/* 1436 */ "peers\0"
+/* 1442 */ "Display the full 'remote' value\0"
+/* 1474 */ "WIDE\0"
+/* 1479 */ "wide\0"
+/* 1484 */ "display extended usage information and exit\0"
+/* 1528 */ "help\0"
+/* 1533 */ "extended usage information passed thru pager\0"
+/* 1578 */ "more-help\0"
+/* 1588 */ "output version information and exit\0"
+/* 1624 */ "version\0"
+/* 1632 */ "save the option state to a config file\0"
+/* 1671 */ "save-opts\0"
+/* 1681 */ "load options from a config file\0"
+/* 1713 */ "LOAD_OPTS\0"
+/* 1723 */ "no-load-opts\0"
+/* 1736 */ "no\0"
+/* 1739 */ "NTPQ\0"
+/* 1744 */ "ntpq - standard NTP query program - Ver. 4.2.8p1\n"
"Usage: %s [ - [] | --[{=| }] ]... [ host ...]\n\0"
-/* 1803 */ "$HOME\0"
-/* 1809 */ ".\0"
-/* 1811 */ ".ntprc\0"
-/* 1818 */ "http://bugs.ntp.org, bugs@ntp.org\0"
-/* 1852 */ "ntpq 4.2.8";
+/* 1863 */ "$HOME\0"
+/* 1869 */ ".\0"
+/* 1871 */ ".ntprc\0"
+/* 1878 */ "http://bugs.ntp.org, bugs@ntp.org\0"
+/* 1912 */ "ntpq 4.2.8p1";
/**
* ipv4 option description with
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the ipv4 option */
-#define IPV4_DESC (ntpq_opt_strs+950)
+#define IPV4_DESC (ntpq_opt_strs+1008)
/** Upper-cased name for the ipv4 option */
-#define IPV4_NAME (ntpq_opt_strs+981)
+#define IPV4_NAME (ntpq_opt_strs+1039)
/** Name string for the ipv4 option */
-#define IPV4_name (ntpq_opt_strs+986)
+#define IPV4_name (ntpq_opt_strs+1044)
/** Other options that appear in conjunction with the ipv4 option */
static int const aIpv4CantList[] = {
INDEX_OPT_IPV6, NO_EQUIVALENT };
@@ -157,11 +158,11 @@ static int const aIpv4CantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the ipv6 option */
-#define IPV6_DESC (ntpq_opt_strs+991)
+#define IPV6_DESC (ntpq_opt_strs+1049)
/** Upper-cased name for the ipv6 option */
-#define IPV6_NAME (ntpq_opt_strs+1022)
+#define IPV6_NAME (ntpq_opt_strs+1080)
/** Name string for the ipv6 option */
-#define IPV6_name (ntpq_opt_strs+1027)
+#define IPV6_name (ntpq_opt_strs+1085)
/** Other options that appear in conjunction with the ipv6 option */
static int const aIpv6CantList[] = {
INDEX_OPT_IPV4, NO_EQUIVALENT };
@@ -172,11 +173,11 @@ static int const aIpv6CantList[] = {
* command option description:
*/
/** Descriptive text for the command option */
-#define COMMAND_DESC (ntpq_opt_strs+1032)
+#define COMMAND_DESC (ntpq_opt_strs+1090)
/** Upper-cased name for the command option */
-#define COMMAND_NAME (ntpq_opt_strs+1055)
+#define COMMAND_NAME (ntpq_opt_strs+1113)
/** Name string for the command option */
-#define COMMAND_name (ntpq_opt_strs+1063)
+#define COMMAND_name (ntpq_opt_strs+1121)
/** Compiled in flag settings for the command option */
#define COMMAND_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -185,11 +186,11 @@ static int const aIpv6CantList[] = {
* debug-level option description:
*/
/** Descriptive text for the debug-level option */
-#define DEBUG_LEVEL_DESC (ntpq_opt_strs+1071)
+#define DEBUG_LEVEL_DESC (ntpq_opt_strs+1129)
/** Upper-cased name for the debug-level option */
-#define DEBUG_LEVEL_NAME (ntpq_opt_strs+1102)
+#define DEBUG_LEVEL_NAME (ntpq_opt_strs+1160)
/** Name string for the debug-level option */
-#define DEBUG_LEVEL_name (ntpq_opt_strs+1114)
+#define DEBUG_LEVEL_name (ntpq_opt_strs+1172)
/** Compiled in flag settings for the debug-level option */
#define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
@@ -197,11 +198,11 @@ static int const aIpv6CantList[] = {
* set-debug-level option description:
*/
/** Descriptive text for the set-debug-level option */
-#define SET_DEBUG_LEVEL_DESC (ntpq_opt_strs+1126)
+#define SET_DEBUG_LEVEL_DESC (ntpq_opt_strs+1184)
/** Upper-cased name for the set-debug-level option */
-#define SET_DEBUG_LEVEL_NAME (ntpq_opt_strs+1156)
+#define SET_DEBUG_LEVEL_NAME (ntpq_opt_strs+1214)
/** Name string for the set-debug-level option */
-#define SET_DEBUG_LEVEL_name (ntpq_opt_strs+1172)
+#define SET_DEBUG_LEVEL_name (ntpq_opt_strs+1230)
/** Compiled in flag settings for the set-debug-level option */
#define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
@@ -211,11 +212,11 @@ static int const aIpv6CantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the interactive option */
-#define INTERACTIVE_DESC (ntpq_opt_strs+1188)
+#define INTERACTIVE_DESC (ntpq_opt_strs+1246)
/** Upper-cased name for the interactive option */
-#define INTERACTIVE_NAME (ntpq_opt_strs+1230)
+#define INTERACTIVE_NAME (ntpq_opt_strs+1288)
/** Name string for the interactive option */
-#define INTERACTIVE_name (ntpq_opt_strs+1242)
+#define INTERACTIVE_name (ntpq_opt_strs+1300)
/** Other options that appear in conjunction with the interactive option */
static int const aInteractiveCantList[] = {
INDEX_OPT_COMMAND,
@@ -227,11 +228,11 @@ static int const aInteractiveCantList[] = {
* numeric option description:
*/
/** Descriptive text for the numeric option */
-#define NUMERIC_DESC (ntpq_opt_strs+1254)
+#define NUMERIC_DESC (ntpq_opt_strs+1312)
/** Upper-cased name for the numeric option */
-#define NUMERIC_NAME (ntpq_opt_strs+1277)
+#define NUMERIC_NAME (ntpq_opt_strs+1335)
/** Name string for the numeric option */
-#define NUMERIC_name (ntpq_opt_strs+1285)
+#define NUMERIC_name (ntpq_opt_strs+1343)
/** Compiled in flag settings for the numeric option */
#define NUMERIC_FLAGS (OPTST_DISABLED)
@@ -239,11 +240,11 @@ static int const aInteractiveCantList[] = {
* old-rv option description:
*/
/** Descriptive text for the old-rv option */
-#define OLD_RV_DESC (ntpq_opt_strs+1293)
+#define OLD_RV_DESC (ntpq_opt_strs+1351)
/** Upper-cased name for the old-rv option */
-#define OLD_RV_NAME (ntpq_opt_strs+1332)
+#define OLD_RV_NAME (ntpq_opt_strs+1390)
/** Name string for the old-rv option */
-#define OLD_RV_name (ntpq_opt_strs+1339)
+#define OLD_RV_name (ntpq_opt_strs+1397)
/** Compiled in flag settings for the old-rv option */
#define OLD_RV_FLAGS (OPTST_DISABLED)
@@ -252,11 +253,11 @@ static int const aInteractiveCantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the peers option */
-#define PEERS_DESC (ntpq_opt_strs+1346)
+#define PEERS_DESC (ntpq_opt_strs+1404)
/** Upper-cased name for the peers option */
-#define PEERS_NAME (ntpq_opt_strs+1372)
+#define PEERS_NAME (ntpq_opt_strs+1430)
/** Name string for the peers option */
-#define PEERS_name (ntpq_opt_strs+1378)
+#define PEERS_name (ntpq_opt_strs+1436)
/** Other options that appear in conjunction with the peers option */
static int const aPeersCantList[] = {
INDEX_OPT_INTERACTIVE, NO_EQUIVALENT };
@@ -267,22 +268,22 @@ static int const aPeersCantList[] = {
* wide option description:
*/
/** Descriptive text for the wide option */
-#define WIDE_DESC (ntpq_opt_strs+1384)
+#define WIDE_DESC (ntpq_opt_strs+1442)
/** Upper-cased name for the wide option */
-#define WIDE_NAME (ntpq_opt_strs+1416)
+#define WIDE_NAME (ntpq_opt_strs+1474)
/** Name string for the wide option */
-#define WIDE_name (ntpq_opt_strs+1421)
+#define WIDE_name (ntpq_opt_strs+1479)
/** Compiled in flag settings for the wide option */
#define WIDE_FLAGS (OPTST_DISABLED)
/*
* Help/More_Help/Version option descriptions:
*/
-#define HELP_DESC (ntpq_opt_strs+1426)
-#define HELP_name (ntpq_opt_strs+1470)
+#define HELP_DESC (ntpq_opt_strs+1484)
+#define HELP_name (ntpq_opt_strs+1528)
#ifdef HAVE_WORKING_FORK
-#define MORE_HELP_DESC (ntpq_opt_strs+1475)
-#define MORE_HELP_name (ntpq_opt_strs+1520)
+#define MORE_HELP_DESC (ntpq_opt_strs+1533)
+#define MORE_HELP_name (ntpq_opt_strs+1578)
#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
#else
#define MORE_HELP_DESC HELP_DESC
@@ -295,14 +296,14 @@ static int const aPeersCantList[] = {
# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
#endif
-#define VER_DESC (ntpq_opt_strs+1530)
-#define VER_name (ntpq_opt_strs+1566)
-#define SAVE_OPTS_DESC (ntpq_opt_strs+1574)
-#define SAVE_OPTS_name (ntpq_opt_strs+1613)
-#define LOAD_OPTS_DESC (ntpq_opt_strs+1623)
-#define LOAD_OPTS_NAME (ntpq_opt_strs+1655)
-#define NO_LOAD_OPTS_name (ntpq_opt_strs+1665)
-#define LOAD_OPTS_pfx (ntpq_opt_strs+1678)
+#define VER_DESC (ntpq_opt_strs+1588)
+#define VER_name (ntpq_opt_strs+1624)
+#define SAVE_OPTS_DESC (ntpq_opt_strs+1632)
+#define SAVE_OPTS_name (ntpq_opt_strs+1671)
+#define LOAD_OPTS_DESC (ntpq_opt_strs+1681)
+#define LOAD_OPTS_NAME (ntpq_opt_strs+1713)
+#define NO_LOAD_OPTS_name (ntpq_opt_strs+1723)
+#define LOAD_OPTS_pfx (ntpq_opt_strs+1736)
#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)
/**
* Declare option callback procedures
@@ -511,24 +512,24 @@ static tOptDesc optDesc[OPTION_CT] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** Reference to the upper cased version of ntpq. */
-#define zPROGNAME (ntpq_opt_strs+1681)
+#define zPROGNAME (ntpq_opt_strs+1739)
/** Reference to the title line for ntpq usage. */
-#define zUsageTitle (ntpq_opt_strs+1686)
+#define zUsageTitle (ntpq_opt_strs+1744)
/** ntpq configuration file name. */
-#define zRcName (ntpq_opt_strs+1811)
+#define zRcName (ntpq_opt_strs+1871)
/** Directories to search for ntpq config files. */
static char const * const apzHomeList[3] = {
- ntpq_opt_strs+1803,
- ntpq_opt_strs+1809,
+ ntpq_opt_strs+1863,
+ ntpq_opt_strs+1869,
NULL };
/** The ntpq program bug email address. */
-#define zBugsAddr (ntpq_opt_strs+1818)
+#define zBugsAddr (ntpq_opt_strs+1878)
/** Clarification/explanation of what ntpq does. */
#define zExplain (NULL)
/** Extra detail explaining what ntpq does. */
#define zDetail (NULL)
/** The full version string for ntpq. */
-#define zFullVersion (ntpq_opt_strs+1852)
+#define zFullVersion (ntpq_opt_strs+1912)
/* extracted from optcode.tlib near line 364 */
#if defined(ENABLE_NLS)
@@ -785,8 +786,8 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpqOptions.pzCopyright */
- puts(_("ntpq 4.2.8\n\
-Copyright (C) 1970-2014 The University of Delaware, all rights reserved.\n\
+ puts(_("ntpq 4.2.8p1\n\
+Copyright (C) 1992-2015 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\
can be seen at:\n"));
@@ -800,9 +801,10 @@ provided that the above copyright notice appears in all copies and that\n\
both the copyright notice and this permission notice appear in supporting\n\
documentation, and that the name The University of Delaware not be used in\n\
advertising or publicity pertaining to distribution of the software without\n\
-specific, written prior permission. The University of Delaware makes no\n\
-representations about the suitability this software for any purpose. It is\n\
-provided \"as is\" without express or implied warranty.\n"));
+specific, written prior permission. The University of Delaware and Network\n\
+Time Foundation makes no representations about the suitability this\n\
+software for any purpose. It is provided \"as is\" without express or\n\
+implied warranty.\n"));
/* referenced via ntpqOptions.pOptDesc->pzText */
puts(_("Force IPv4 DNS name resolution"));
@@ -850,11 +852,11 @@ provided \"as is\" without express or implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpqOptions.pzUsageTitle */
- puts(_("ntpq - standard NTP query program - Ver. 4.2.8\n\
+ puts(_("ntpq - standard NTP query program - Ver. 4.2.8p1\n\
Usage: %s [ - [] | --[{=| }] ]... [ host ...]\n"));
/* referenced via ntpqOptions.pzFullVersion */
- puts(_("ntpq 4.2.8"));
+ puts(_("ntpq 4.2.8p1"));
/* referenced via ntpqOptions.pzFullUsage */
puts(_("<<>>"));
diff --git a/ntpq/ntpq-opts.h b/ntpq/ntpq-opts.h
index 4e42e20ab407..0dfe3dd6e734 100644
--- a/ntpq/ntpq-opts.h
+++ b/ntpq/ntpq-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpq-opts.h)
*
- * It has been AutoGen-ed December 19, 2014 at 07:49:47 AM by AutoGen 5.18.5pre4
+ * It has been AutoGen-ed February 4, 2015 at 02:42:46 AM by AutoGen 5.18.5pre4
* From the definitions ntpq-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntpq program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1970-2014 The University of Delaware, all rights reserved.
+ * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the NTP License, copies of which
* can be seen at:
@@ -31,7 +31,7 @@
* both the copyright notice and this permission notice appear in
* supporting documentation, and that the name The University of Delaware not be used in
* advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. The University of Delaware makes no
+ * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
* representations about the suitability this software for any purpose. It
* is provided "as is" without express or implied warranty.
*/
@@ -83,9 +83,9 @@ typedef enum {
/** count of all options for ntpq */
#define OPTION_CT 15
/** ntpq version */
-#define NTPQ_VERSION "4.2.8"
+#define NTPQ_VERSION "4.2.8p1"
/** Full ntpq version text */
-#define NTPQ_FULL_VERSION "ntpq 4.2.8"
+#define NTPQ_FULL_VERSION "ntpq 4.2.8p1"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/ntpq/ntpq-subs.c b/ntpq/ntpq-subs.c
index 5460f80fc93a..56bc2280223f 100644
--- a/ntpq/ntpq-subs.c
+++ b/ntpq/ntpq-subs.c
@@ -269,7 +269,7 @@ char flash2[] = " .+* "; /* flash decode for version 2 */
char flash3[] = " x.-+#*o"; /* flash decode for peer status version 3 */
struct varlist {
- char *name;
+ const char *name;
char *value;
} g_varlist[MAXLIST] = { { 0, 0 } };
@@ -330,7 +330,11 @@ typedef struct var_display_collection_tag {
l_fp lfp; /* NTP_LFP */
} v; /* retrieved value */
} vdc;
-
+#if !defined(MISSING_C99_STYLE_INIT)
+# define VDC_INIT(a, b, c) { .tag = a, .display = b, .type = c }
+#else
+# define VDC_INIT(a, b, c) { a, b, c }
+#endif
/*
* other local function prototypes
*/
@@ -362,7 +366,7 @@ static mru ** hash_table;
* qsort comparison function table for mrulist(). The first two
* entries are NULL because they are handled without qsort().
*/
-const static qsort_cmp mru_qcmp_table[MRUSORT_MAX] = {
+static const qsort_cmp mru_qcmp_table[MRUSORT_MAX] = {
NULL, /* MRUSORT_DEF unused */
NULL, /* MRUSORT_R_DEF unused */
&qcmp_mru_avgint, /* MRUSORT_AVGINT */
@@ -477,7 +481,7 @@ dormvlist(
(void) fprintf(stderr, "Variable `%s' not found\n",
name);
} else {
- free((void *)vl->name);
+ free((void *)(intptr_t)vl->name);
if (vl->value != 0)
free(vl->value);
for ( ; (vl+1) < (g_varlist + MAXLIST)
@@ -502,7 +506,7 @@ doclearvlist(
register struct varlist *vl;
for (vl = vlist; vl < vlist + MAXLIST && vl->name != 0; vl++) {
- free((void *)vl->name);
+ free((void *)(intptr_t)vl->name);
vl->name = 0;
if (vl->value != 0) {
free(vl->value);
@@ -2192,7 +2196,7 @@ fetch_nonce(
return FALSE;
}
- if (rsize <= sizeof(nonce_eq) - 1 ||
+ if ((size_t)rsize <= sizeof(nonce_eq) - 1 ||
strncmp(rdata, nonce_eq, sizeof(nonce_eq) - 1)) {
fprintf(stderr, "unexpected nonce response format: %.*s\n",
rsize, rdata);
@@ -2935,7 +2939,7 @@ mrulist(
double flstint;
int avgint;
int lstint;
- int i;
+ size_t i;
order = MRUSORT_DEF;
parms_buf[0] = '\0';
@@ -3041,7 +3045,7 @@ mrulist(
LFPTOD(&interval, favgint);
favgint /= recent->count;
avgint = (int)(favgint + 0.5);
- fprintf(fp, "%6d %6d %4hx %c %d %d %6d %5hu %s\n",
+ fprintf(fp, "%6d %6d %4hx %c %d %d %6d %5u %s\n",
lstint, avgint, recent->rs,
(RES_KOD & recent->rs)
? 'K'
@@ -3179,7 +3183,6 @@ ifstats(
char * tag;
char * val;
int fields;
- u_int ifnum;
u_int ui;
ifstats_row row;
int comprende;
@@ -3198,7 +3201,6 @@ ifstats(
ZERO(row);
fields = 0;
- ifnum = 0;
ui = 0;
while (nextvar(&dsize, &datap, &tag, &val)) {
if (debug > 1)
@@ -3396,7 +3398,6 @@ reslist(
char * tag;
char * val;
int fields;
- u_int idx;
u_int ui;
reslist_row row;
int comprende;
@@ -3415,7 +3416,6 @@ reslist(
ZERO(row);
fields = 0;
- idx = 0;
ui = 0;
while (nextvar(&dsize, &datap, &tag, &val)) {
if (debug > 1)
@@ -3656,19 +3656,19 @@ sysstats(
)
{
static vdc sysstats_vdc[] = {
- { "ss_uptime", "uptime: ", NTP_STR },
- { "ss_reset", "sysstats reset: ", NTP_STR },
- { "ss_received", "packets received: ", NTP_STR },
- { "ss_thisver", "current version: ", NTP_STR },
- { "ss_oldver", "older version: ", NTP_STR },
- { "ss_badformat", "bad length or format: ", NTP_STR },
- { "ss_badauth", "authentication failed:", NTP_STR },
- { "ss_declined", "declined: ", NTP_STR },
- { "ss_restricted", "restricted: ", NTP_STR },
- { "ss_limited", "rate limited: ", NTP_STR },
- { "ss_kodsent", "KoD responses: ", NTP_STR },
- { "ss_processed", "processed for time: ", NTP_STR },
- { NULL, NULL, 0 }
+ VDC_INIT("ss_uptime", "uptime: ", NTP_STR),
+ VDC_INIT("ss_reset", "sysstats reset: ", NTP_STR),
+ VDC_INIT("ss_received", "packets received: ", NTP_STR),
+ VDC_INIT("ss_thisver", "current version: ", NTP_STR),
+ VDC_INIT("ss_oldver", "older version: ", NTP_STR),
+ VDC_INIT("ss_badformat", "bad length or format: ", NTP_STR),
+ VDC_INIT("ss_badauth", "authentication failed:", NTP_STR),
+ VDC_INIT("ss_declined", "declined: ", NTP_STR),
+ VDC_INIT("ss_restricted", "restricted: ", NTP_STR),
+ VDC_INIT("ss_limited", "rate limited: ", NTP_STR),
+ VDC_INIT("ss_kodsent", "KoD responses: ", NTP_STR),
+ VDC_INIT("ss_processed", "processed for time: ", NTP_STR),
+ VDC_INIT(NULL, NULL, 0)
};
collect_display_vdc(0, sysstats_vdc, FALSE, fp);
@@ -3685,21 +3685,21 @@ sysinfo(
)
{
static vdc sysinfo_vdc[] = {
- { "peeradr", "system peer: ", NTP_ADP },
- { "peermode", "system peer mode: ", NTP_MODE },
- { "leap", "leap indicator: ", NTP_2BIT },
- { "stratum", "stratum: ", NTP_STR },
- { "precision", "log2 precision: ", NTP_STR },
- { "rootdelay", "root delay: ", NTP_STR },
- { "rootdisp", "root dispersion: ", NTP_STR },
- { "refid", "reference ID: ", NTP_STR },
- { "reftime", "reference time: ", NTP_LFP },
- { "sys_jitter", "system jitter: ", NTP_STR },
- { "clk_jitter", "clock jitter: ", NTP_STR },
- { "clk_wander", "clock wander: ", NTP_STR },
- { "bcastdelay", "broadcast delay: ", NTP_STR },
- { "authdelay", "symm. auth. delay:", NTP_STR },
- { NULL, NULL, 0 }
+ VDC_INIT("peeradr", "system peer: ", NTP_ADP),
+ VDC_INIT("peermode", "system peer mode: ", NTP_MODE),
+ VDC_INIT("leap", "leap indicator: ", NTP_2BIT),
+ VDC_INIT("stratum", "stratum: ", NTP_STR),
+ VDC_INIT("precision", "log2 precision: ", NTP_STR),
+ VDC_INIT("rootdelay", "root delay: ", NTP_STR),
+ VDC_INIT("rootdisp", "root dispersion: ", NTP_STR),
+ VDC_INIT("refid", "reference ID: ", NTP_STR),
+ VDC_INIT("reftime", "reference time: ", NTP_LFP),
+ VDC_INIT("sys_jitter", "system jitter: ", NTP_STR),
+ VDC_INIT("clk_jitter", "clock jitter: ", NTP_STR),
+ VDC_INIT("clk_wander", "clock wander: ", NTP_STR),
+ VDC_INIT("bcastdelay", "broadcast delay: ", NTP_STR),
+ VDC_INIT("authdelay", "symm. auth. delay:", NTP_STR),
+ VDC_INIT(NULL, NULL, 0)
};
collect_display_vdc(0, sysinfo_vdc, TRUE, fp);
@@ -3716,23 +3716,23 @@ kerninfo(
)
{
static vdc kerninfo_vdc[] = {
- { "koffset", "pll offset: ", NTP_STR },
- { "kfreq", "pll frequency: ", NTP_STR },
- { "kmaxerr", "maximum error: ", NTP_STR },
- { "kesterr", "estimated error: ", NTP_STR },
- { "kstflags", "kernel status: ", NTP_STR },
- { "ktimeconst", "pll time constant: ", NTP_STR },
- { "kprecis", "precision: ", NTP_STR },
- { "kfreqtol", "frequency tolerance: ", NTP_STR },
- { "kppsfreq", "pps frequency: ", NTP_STR },
- { "kppsstab", "pps stability: ", NTP_STR },
- { "kppsjitter", "pps jitter: ", NTP_STR },
- { "kppscalibdur", "calibration interval ", NTP_STR },
- { "kppscalibs", "calibration cycles: ", NTP_STR },
- { "kppsjitexc", "jitter exceeded: ", NTP_STR },
- { "kppsstbexc", "stability exceeded: ", NTP_STR },
- { "kppscaliberrs", "calibration errors: ", NTP_STR },
- { NULL, NULL, 0 }
+ VDC_INIT("koffset", "pll offset: ", NTP_STR),
+ VDC_INIT("kfreq", "pll frequency: ", NTP_STR),
+ VDC_INIT("kmaxerr", "maximum error: ", NTP_STR),
+ VDC_INIT("kesterr", "estimated error: ", NTP_STR),
+ VDC_INIT("kstflags", "kernel status: ", NTP_STR),
+ VDC_INIT("ktimeconst", "pll time constant: ", NTP_STR),
+ VDC_INIT("kprecis", "precision: ", NTP_STR),
+ VDC_INIT("kfreqtol", "frequency tolerance: ", NTP_STR),
+ VDC_INIT("kppsfreq", "pps frequency: ", NTP_STR),
+ VDC_INIT("kppsstab", "pps stability: ", NTP_STR),
+ VDC_INIT("kppsjitter", "pps jitter: ", NTP_STR),
+ VDC_INIT("kppscalibdur", "calibration interval ", NTP_STR),
+ VDC_INIT("kppscalibs", "calibration cycles: ", NTP_STR),
+ VDC_INIT("kppsjitexc", "jitter exceeded: ", NTP_STR),
+ VDC_INIT("kppsstbexc", "stability exceeded: ", NTP_STR),
+ VDC_INIT("kppscaliberrs", "calibration errors: ", NTP_STR),
+ VDC_INIT(NULL, NULL, 0)
};
collect_display_vdc(0, kerninfo_vdc, TRUE, fp);
@@ -3749,15 +3749,15 @@ monstats(
)
{
static vdc monstats_vdc[] = {
- { "mru_enabled", "enabled: ", NTP_STR },
- { "mru_depth", "addresses: ", NTP_STR },
- { "mru_deepest", "peak addresses: ", NTP_STR },
- { "mru_maxdepth", "maximum addresses: ", NTP_STR },
- { "mru_mindepth", "reclaim above count:", NTP_STR },
- { "mru_maxage", "reclaim older than: ", NTP_STR },
- { "mru_mem", "kilobytes: ", NTP_STR },
- { "mru_maxmem", "maximum kilobytes: ", NTP_STR },
- { NULL, NULL, 0 }
+ VDC_INIT("mru_enabled", "enabled: ", NTP_STR),
+ VDC_INIT("mru_depth", "addresses: ", NTP_STR),
+ VDC_INIT("mru_deepest", "peak addresses: ", NTP_STR),
+ VDC_INIT("mru_maxdepth", "maximum addresses: ", NTP_STR),
+ VDC_INIT("mru_mindepth", "reclaim above count:", NTP_STR),
+ VDC_INIT("mru_maxage", "reclaim older than: ", NTP_STR),
+ VDC_INIT("mru_mem", "kilobytes: ", NTP_STR),
+ VDC_INIT("mru_maxmem", "maximum kilobytes: ", NTP_STR),
+ VDC_INIT(NULL, NULL, 0)
};
collect_display_vdc(0, monstats_vdc, FALSE, fp);
@@ -3774,19 +3774,19 @@ iostats(
)
{
static vdc iostats_vdc[] = {
- { "iostats_reset", "time since reset: ", NTP_STR },
- { "total_rbuf", "receive buffers: ", NTP_STR },
- { "free_rbuf", "free receive buffers: ", NTP_STR },
- { "used_rbuf", "used receive buffers: ", NTP_STR },
- { "rbuf_lowater", "low water refills: ", NTP_STR },
- { "io_dropped", "dropped packets: ", NTP_STR },
- { "io_ignored", "ignored packets: ", NTP_STR },
- { "io_received", "received packets: ", NTP_STR },
- { "io_sent", "packets sent: ", NTP_STR },
- { "io_sendfailed", "packet send failures: ", NTP_STR },
- { "io_wakeups", "input wakeups: ", NTP_STR },
- { "io_goodwakeups", "useful input wakeups: ", NTP_STR },
- { NULL, NULL, 0 }
+ VDC_INIT("iostats_reset", "time since reset: ", NTP_STR),
+ VDC_INIT("total_rbuf", "receive buffers: ", NTP_STR),
+ VDC_INIT("free_rbuf", "free receive buffers: ", NTP_STR),
+ VDC_INIT("used_rbuf", "used receive buffers: ", NTP_STR),
+ VDC_INIT("rbuf_lowater", "low water refills: ", NTP_STR),
+ VDC_INIT("io_dropped", "dropped packets: ", NTP_STR),
+ VDC_INIT("io_ignored", "ignored packets: ", NTP_STR),
+ VDC_INIT("io_received", "received packets: ", NTP_STR),
+ VDC_INIT("io_sent", "packets sent: ", NTP_STR),
+ VDC_INIT("io_sendfailed", "packet send failures: ", NTP_STR),
+ VDC_INIT("io_wakeups", "input wakeups: ", NTP_STR),
+ VDC_INIT("io_goodwakeups", "useful input wakeups: ", NTP_STR),
+ VDC_INIT(NULL, NULL, 0)
};
collect_display_vdc(0, iostats_vdc, FALSE, fp);
@@ -3803,10 +3803,10 @@ timerstats(
)
{
static vdc timerstats_vdc[] = {
- { "timerstats_reset", "time since reset: ", NTP_STR },
- { "timer_overruns", "timer overruns: ", NTP_STR },
- { "timer_xmts", "calls to transmit: ", NTP_STR },
- { NULL, NULL, 0 }
+ VDC_INIT("timerstats_reset", "time since reset: ", NTP_STR),
+ VDC_INIT("timer_overruns", "timer overruns: ", NTP_STR),
+ VDC_INIT("timer_xmts", "calls to transmit: ", NTP_STR),
+ VDC_INIT(NULL, NULL, 0)
};
collect_display_vdc(0, timerstats_vdc, FALSE, fp);
@@ -3823,16 +3823,16 @@ authinfo(
)
{
static vdc authinfo_vdc[] = {
- { "authreset", "time since reset:", NTP_STR },
- { "authkeys", "stored keys: ", NTP_STR },
- { "authfreek", "free keys: ", NTP_STR },
- { "authklookups", "key lookups: ", NTP_STR },
- { "authknotfound", "keys not found: ", NTP_STR },
- { "authkuncached", "uncached keys: ", NTP_STR },
- { "authkexpired", "expired keys: ", NTP_STR },
- { "authencrypts", "encryptions: ", NTP_STR },
- { "authdecrypts", "decryptions: ", NTP_STR },
- { NULL, NULL, 0 }
+ VDC_INIT("authreset", "time since reset:", NTP_STR),
+ VDC_INIT("authkeys", "stored keys: ", NTP_STR),
+ VDC_INIT("authfreek", "free keys: ", NTP_STR),
+ VDC_INIT("authklookups", "key lookups: ", NTP_STR),
+ VDC_INIT("authknotfound", "keys not found: ", NTP_STR),
+ VDC_INIT("authkuncached", "uncached keys: ", NTP_STR),
+ VDC_INIT("authkexpired", "expired keys: ", NTP_STR),
+ VDC_INIT("authencrypts", "encryptions: ", NTP_STR),
+ VDC_INIT("authdecrypts", "decryptions: ", NTP_STR),
+ VDC_INIT(NULL, NULL, 0)
};
collect_display_vdc(0, authinfo_vdc, FALSE, fp);
@@ -3849,20 +3849,20 @@ pstats(
)
{
static vdc pstats_vdc[] = {
- { "src", "remote host: ", NTP_ADD },
- { "dst", "local address: ", NTP_ADD },
- { "timerec", "time last received: ", NTP_STR },
- { "timer", "time until next send:", NTP_STR },
- { "timereach", "reachability change: ", NTP_STR },
- { "sent", "packets sent: ", NTP_STR },
- { "received", "packets received: ", NTP_STR },
- { "badauth", "bad authentication: ", NTP_STR },
- { "bogusorg", "bogus origin: ", NTP_STR },
- { "oldpkt", "duplicate: ", NTP_STR },
- { "seldisp", "bad dispersion: ", NTP_STR },
- { "selbroken", "bad reference time: ", NTP_STR },
- { "candidate", "candidate order: ", NTP_STR },
- { NULL, NULL, 0 }
+ VDC_INIT("src", "remote host: ", NTP_ADD),
+ VDC_INIT("dst", "local address: ", NTP_ADD),
+ VDC_INIT("timerec", "time last received: ", NTP_STR),
+ VDC_INIT("timer", "time until next send:", NTP_STR),
+ VDC_INIT("timereach", "reachability change: ", NTP_STR),
+ VDC_INIT("sent", "packets sent: ", NTP_STR),
+ VDC_INIT("received", "packets received: ", NTP_STR),
+ VDC_INIT("badauth", "bad authentication: ", NTP_STR),
+ VDC_INIT("bogusorg", "bogus origin: ", NTP_STR),
+ VDC_INIT("oldpkt", "duplicate: ", NTP_STR),
+ VDC_INIT("seldisp", "bad dispersion: ", NTP_STR),
+ VDC_INIT("selbroken", "bad reference time: ", NTP_STR),
+ VDC_INIT("candidate", "candidate order: ", NTP_STR),
+ VDC_INIT(NULL, NULL, 0)
};
associd_t associd;
@@ -3872,4 +3872,3 @@ pstats(
collect_display_vdc(associd, pstats_vdc, TRUE, fp);
}
-
diff --git a/ntpq/ntpq.1ntpqman b/ntpq/ntpq.1ntpqman
index 49cc5aa66335..a92f61ec3d7f 100644
--- a/ntpq/ntpq.1ntpqman
+++ b/ntpq/ntpq.1ntpqman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpq 1ntpqman "19 Dec 2014" "4.2.8" "User Commands"
+.TH ntpq 1ntpqman "04 Feb 2015" "4.2.8p1" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-XYaGog/ag-9Yayng)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-oaaWVr/ag-CaaOUr)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:50:13 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:43:13 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpq-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -1397,9 +1397,9 @@ libopts had an internal operational error. Please report
it to autogen-users@lists.sourceforge.net. Thank you.
.PP
.SH "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.SH "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpq/ntpq.1ntpqmdoc b/ntpq/ntpq.1ntpqmdoc
index 3c93d140553f..c55a5329c788 100644
--- a/ntpq/ntpq.1ntpqmdoc
+++ b/ntpq/ntpq.1ntpqmdoc
@@ -1,9 +1,9 @@
-.Dd December 19 2014
+.Dd February 4 2015
.Dt NTPQ 1ntpqmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:50:19 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:43:19 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpq-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -943,9 +943,9 @@ libopts had an internal operational error. Please report
it to autogen\-users@lists.sourceforge.net. Thank you.
.El
.Sh "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.Sh "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c
index 2ffdfc7be0ec..90cae41b1ca3 100644
--- a/ntpq/ntpq.c
+++ b/ntpq/ntpq.c
@@ -201,8 +201,10 @@ static void raw (struct parse *, FILE *);
static void cooked (struct parse *, FILE *);
static void authenticate (struct parse *, FILE *);
static void ntpversion (struct parse *, FILE *);
-static void warning (const char *, const char *, const char *);
-static void error (const char *, const char *, const char *);
+static void warning (const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
+static void error (const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
static u_long getkeyid (const char *);
static void atoascii (const char *, size_t, char *, size_t);
static void cookedprint (int, int, const char *, int, int, FILE *);
@@ -315,7 +317,7 @@ struct sock_timeval tvsout = { DEFSTIMEOUT, 0 };/* secondary time out */
l_fp delay_time; /* delay time */
char currenthost[LENHOSTNAME]; /* current host name */
int currenthostisnum; /* is prior text from IP? */
-struct sockaddr_in hostaddr = { 0 }; /* host address */
+struct sockaddr_in hostaddr; /* host address */
int showhostnames = 1; /* show host names by default */
int wideremote = 0; /* show wide remote names? */
@@ -678,7 +680,7 @@ openhost(
sockfd = socket(ai->ai_family, ai->ai_socktype,
ai->ai_protocol);
if (sockfd == INVALID_SOCKET) {
- error("socket", "", "");
+ error("socket");
freeaddrinfo(ai);
return 0;
}
@@ -689,7 +691,7 @@ openhost(
{ int rbufsize = DATASIZE + 2048; /* 2K for slop */
if (setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF,
&rbufsize, sizeof(int)) == -1)
- error("setsockopt", "", "");
+ error("setsockopt");
}
# endif
#endif
@@ -703,7 +705,7 @@ openhost(
ai->ai_addrlen) == -1)
#endif /* SYS_VXWORKS */
{
- error("connect", "", "");
+ error("connect");
freeaddrinfo(ai);
return 0;
}
@@ -761,10 +763,10 @@ sendpkt(
)
{
if (debug >= 3)
- printf("Sending %lu octets\n", (u_long)xdatalen);
+ printf("Sending %zu octets\n", xdatalen);
if (send(sockfd, xdata, (size_t)xdatalen, 0) == -1) {
- warning("write to %s failed", currenthost, "");
+ warning("write to %s failed", currenthost);
return -1;
}
@@ -835,7 +837,7 @@ getresponse(
n = select(sockfd + 1, &fds, NULL, NULL, &tvo);
if (n == -1) {
- warning("select fails", "", "");
+ warning("select fails");
return -1;
}
if (n == 0) {
@@ -874,7 +876,7 @@ getresponse(
n = recv(sockfd, (char *)&rpkt, sizeof(rpkt), 0);
if (n == -1) {
- warning("read", "", "");
+ warning("read");
return -1;
}
@@ -886,7 +888,7 @@ getresponse(
/*
* Check for format errors. Bug proofing.
*/
- if (n < CTL_HEADER_LEN) {
+ if (n < (int)CTL_HEADER_LEN) {
if (debug)
printf("Short (%d byte) packet received\n", n);
continue;
@@ -994,7 +996,7 @@ getresponse(
shouldbesize = (shouldbesize + 7) & ~7;
maclen = n - shouldbesize;
- if (maclen >= MIN_MAC_LEN) {
+ if (maclen >= (int)MIN_MAC_LEN) {
printf(
"Packet shows signs of authentication (total %d, data %d, mac %d)\n",
n, shouldbesize, maclen);
@@ -1226,9 +1228,9 @@ sendrequest(
return 1;
} else if ((size_t)maclen != (info_auth_hashlen + sizeof(keyid_t))) {
fprintf(stderr,
- "%d octet MAC, %lu expected with %lu octet digest\n",
- maclen, (u_long)(info_auth_hashlen + sizeof(keyid_t)),
- (u_long)info_auth_hashlen);
+ "%d octet MAC, %zu expected with %zu octet digest\n",
+ maclen, (info_auth_hashlen + sizeof(keyid_t)),
+ info_auth_hashlen);
return 1;
}
@@ -2620,37 +2622,46 @@ ntpversion(
}
+static void __attribute__((__format__(__printf__, 1, 0)))
+vwarning(const char *fmt, va_list ap)
+{
+ int serrno = errno;
+ (void) fprintf(stderr, "%s: ", progname);
+ vfprintf(stderr, fmt, ap);
+ (void) fprintf(stderr, ": %s", strerror(serrno));
+}
+
/*
* warning - print a warning message
*/
-static void
+static void __attribute__((__format__(__printf__, 1, 2)))
warning(
const char *fmt,
- const char *st1,
- const char *st2
+ ...
)
{
- (void) fprintf(stderr, "%s: ", progname);
- (void) fprintf(stderr, fmt, st1, st2);
- (void) fprintf(stderr, ": ");
- perror("");
+ va_list ap;
+ va_start(ap, fmt);
+ vwarning(fmt, ap);
+ va_end(ap);
}
/*
* error - print a message and exit
*/
-static void
+static void __attribute__((__format__(__printf__, 1, 2)))
error(
const char *fmt,
- const char *st1,
- const char *st2
+ ...
)
{
- warning(fmt, st1, st2);
+ va_list ap;
+ va_start(ap, fmt);
+ vwarning(fmt, ap);
+ va_end(ap);
exit(1);
}
-
/*
* getkeyid - prompt the user for a keyid to use
*/
@@ -2900,7 +2911,7 @@ nextvar(
srclen = strcspn(cp, ",=\r\n");
srclen = min(srclen, (size_t)(cpend - cp));
len = srclen;
- while (len > 0 && isspace(cp[len - 1]))
+ while (len > 0 && isspace((unsigned char)cp[len - 1]))
len--;
if (len > 0)
memcpy(name, cp, len);
@@ -2924,7 +2935,7 @@ nextvar(
* So far, so good. Copy out the value
*/
cp++; /* past '=' */
- while (cp < cpend && (isspace(*cp) && *cp != '\r' && *cp != '\n'))
+ while (cp < cpend && (isspace((unsigned char)*cp) && *cp != '\r' && *cp != '\n'))
cp++;
np = cp;
if ('"' == *np) {
@@ -2945,7 +2956,7 @@ nextvar(
/*
* Trim off any trailing whitespace
*/
- while (len > 0 && isspace(value[len - 1]))
+ while (len > 0 && isspace((unsigned char)value[len - 1]))
len--;
value[len] = '\0';
@@ -3028,7 +3039,7 @@ rawprint(
*/
if (cp == (cpend - 1) || *(cp + 1) != '\n')
makeascii(1, cp, fp);
- } else if (isspace(*cp) || isprint(*cp))
+ } else if (isspace((unsigned char)*cp) || isprint((unsigned char)*cp))
putc(*cp, fp);
else
makeascii(1, cp, fp);
@@ -3176,7 +3187,7 @@ tstflags(
*cp++ = ' ';
cb--;
}
- for (i = 0; i < COUNTOF(tstflagnames); i++) {
+ for (i = 0; i < (int)COUNTOF(tstflagnames); i++) {
if (val & 0x1) {
snprintf(cp, cb, "%s%s", sep,
tstflagnames[i]);
diff --git a/ntpq/ntpq.h b/ntpq/ntpq.h
index ec2bcb98d3bb..2575b885c179 100644
--- a/ntpq/ntpq.h
+++ b/ntpq/ntpq.h
@@ -79,7 +79,7 @@ typedef union {
struct parse {
const char *keyword;
arg_v argval[MAXARGS];
- int nargs;
+ size_t nargs;
};
/*
diff --git a/ntpq/ntpq.html b/ntpq/ntpq.html
index e5119d5b3625..757dd2baa338 100644
--- a/ntpq/ntpq.html
+++ b/ntpq/ntpq.html
@@ -44,7 +44,7 @@ monitor the operational status
and determine the performance of
ntpd, the NTP daemon.
-
This document applies to version 4.2.8 of ntpq.
+
This document applies to version 4.2.8p1 of ntpq.
ntpq Description
@@ -759,7 +759,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to more. Both will exit
with a status code of 0.
-
ntpq - standard NTP query program - Ver. 4.2.7p486-RC
+
ntpq - standard NTP query program - Ver. 4.2.8p1-RC2
Usage: ntpq [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/ntpq/ntpq.man.in b/ntpq/ntpq.man.in
index 548ebf7f5dd9..f6d28cc95241 100644
--- a/ntpq/ntpq.man.in
+++ b/ntpq/ntpq.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpq @NTPQ_MS@ "19 Dec 2014" "4.2.8" "User Commands"
+.TH ntpq @NTPQ_MS@ "04 Feb 2015" "4.2.8p1" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-XYaGog/ag-9Yayng)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-oaaWVr/ag-CaaOUr)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:50:13 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:43:13 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpq-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -1397,9 +1397,9 @@ libopts had an internal operational error. Please report
it to autogen-users@lists.sourceforge.net. Thank you.
.PP
.SH "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.SH "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpq/ntpq.mdoc.in b/ntpq/ntpq.mdoc.in
index 34bbfdfbc169..23fe10242d78 100644
--- a/ntpq/ntpq.mdoc.in
+++ b/ntpq/ntpq.mdoc.in
@@ -1,9 +1,9 @@
-.Dd December 19 2014
+.Dd February 4 2015
.Dt NTPQ @NTPQ_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:50:19 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:43:19 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpq-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -943,9 +943,9 @@ libopts had an internal operational error. Please report
it to autogen\-users@lists.sourceforge.net. Thank you.
.El
.Sh "AUTHORS"
-The University of Delaware
+The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.Sh "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpsnmpd/Makefile.in b/ntpsnmpd/Makefile.in
index 6733b3cb19cb..2532f0782468 100644
--- a/ntpsnmpd/Makefile.in
+++ b/ntpsnmpd/Makefile.in
@@ -182,6 +182,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -216,7 +217,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/ntpsnmpd/invoke-ntpsnmpd.texi b/ntpsnmpd/invoke-ntpsnmpd.texi
index 6631f01a80d6..513d70cfc965 100644
--- a/ntpsnmpd/invoke-ntpsnmpd.texi
+++ b/ntpsnmpd/invoke-ntpsnmpd.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpsnmpd.texi)
#
-# It has been AutoGen-ed December 19, 2014 at 07:50:32 AM by AutoGen 5.18.5pre4
+# It has been AutoGen-ed February 4, 2015 at 02:43:32 AM by AutoGen 5.18.5pre4
# From the definitions ntpsnmpd-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -47,7 +47,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8
+ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p1
Usage: ntpsnmpd [ - [] | --[@{=| @}] ]...
Flg Arg Option-Name Description
-n no nofork Do not fork
diff --git a/ntpsnmpd/netsnmp_daemonize.c b/ntpsnmpd/netsnmp_daemonize.c
index 969caa0db77a..4311bac0903b 100644
--- a/ntpsnmpd/netsnmp_daemonize.c
+++ b/ntpsnmpd/netsnmp_daemonize.c
@@ -40,6 +40,7 @@ SOFTWARE.
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
+#undef PACKAGE_URL
#undef PACKAGE_VERSION
#include
diff --git a/ntpsnmpd/ntp_snmp.h b/ntpsnmpd/ntp_snmp.h
index 1e0499d05a8d..b6057582c30c 100644
--- a/ntpsnmpd/ntp_snmp.h
+++ b/ntpsnmpd/ntp_snmp.h
@@ -26,6 +26,9 @@
#ifdef PACKAGE_TARNAME
# undef PACKAGE_TARNAME
#endif
+#ifdef PACKAGE_URL
+# undef PACKAGE_URL
+#endif
#ifdef PACKAGE_VERSION
# undef PACKAGE_VERSION
#endif
diff --git a/ntpsnmpd/ntpsnmpd-opts.c b/ntpsnmpd/ntpsnmpd-opts.c
index 4877ffe4ccf1..0f8622e7aa5f 100644
--- a/ntpsnmpd/ntpsnmpd-opts.c
+++ b/ntpsnmpd/ntpsnmpd-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.c)
*
- * It has been AutoGen-ed December 19, 2014 at 07:50:22 AM by AutoGen 5.18.5pre4
+ * It has been AutoGen-ed February 4, 2015 at 02:43:22 AM by AutoGen 5.18.5pre4
* From the definitions ntpsnmpd-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntpsnmpd program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1970-2014 The University of Delaware, all rights reserved.
+ * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the NTP License, copies of which
* can be seen at:
@@ -31,7 +31,7 @@
* both the copyright notice and this permission notice appear in
* supporting documentation, and that the name The University of Delaware not be used in
* advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. The University of Delaware makes no
+ * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
* representations about the suitability this software for any purpose. It
* is provided "as is" without express or implied warranty.
*/
@@ -50,7 +50,7 @@ extern "C" {
#endif
extern FILE * option_usage_fp;
#define zCopyright (ntpsnmpd_opt_strs+0)
-#define zLicenseDescrip (ntpsnmpd_opt_strs+314)
+#define zLicenseDescrip (ntpsnmpd_opt_strs+344)
#ifndef NULL
@@ -60,64 +60,65 @@ extern FILE * option_usage_fp;
/**
* static const strings for ntpsnmpd options
*/
-static char const ntpsnmpd_opt_strs[1548] =
-/* 0 */ "ntpsnmpd 4.2.8\n"
- "Copyright (C) 1970-2014 The University of Delaware, all rights reserved.\n"
+static char const ntpsnmpd_opt_strs[1610] =
+/* 0 */ "ntpsnmpd 4.2.8p1\n"
+ "Copyright (C) 1992-2015 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"
"can be seen at:\n"
" \n"
" \n\0"
-/* 314 */ "Permission to use, copy, modify, and distribute this software and its\n"
+/* 344 */ "Permission to use, copy, modify, and distribute this software and its\n"
"documentation for any purpose with or without fee is hereby granted,\n"
"provided that the above copyright notice appears in all copies and that\n"
"both the copyright notice and this permission notice appear in supporting\n"
"documentation, and that the name The University of Delaware not be used in\n"
"advertising or publicity pertaining to distribution of the software without\n"
- "specific, written prior permission. The University of Delaware makes no\n"
- "representations about the suitability this software for any purpose. It is\n"
- "provided \"as is\" without express or implied warranty.\n\0"
-/* 954 */ "Do not fork\0"
-/* 966 */ "NOFORK\0"
-/* 973 */ "nofork\0"
-/* 980 */ "Log to syslog()\0"
-/* 996 */ "SYSLOG\0"
-/* 1003 */ "syslog\0"
-/* 1010 */ "The socket address ntpsnmpd uses to connect to net-snmpd\0"
-/* 1067 */ "AGENTXSOCKET\0"
-/* 1080 */ "agentxsocket\0"
-/* 1093 */ "unix:/var/agentx/master\0"
-/* 1117 */ "display extended usage information and exit\0"
-/* 1161 */ "help\0"
-/* 1166 */ "extended usage information passed thru pager\0"
-/* 1211 */ "more-help\0"
-/* 1221 */ "output version information and exit\0"
-/* 1257 */ "version\0"
-/* 1265 */ "save the option state to a config file\0"
-/* 1304 */ "save-opts\0"
-/* 1314 */ "load options from a config file\0"
-/* 1346 */ "LOAD_OPTS\0"
-/* 1356 */ "no-load-opts\0"
-/* 1369 */ "no\0"
-/* 1372 */ "NTPSNMPD\0"
-/* 1381 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8\n"
+ "specific, written prior permission. The University of Delaware and Network\n"
+ "Time Foundation makes no representations about the suitability this\n"
+ "software for any purpose. It is provided \"as is\" without express or\n"
+ "implied warranty.\n\0"
+/* 1012 */ "Do not fork\0"
+/* 1024 */ "NOFORK\0"
+/* 1031 */ "nofork\0"
+/* 1038 */ "Log to syslog()\0"
+/* 1054 */ "SYSLOG\0"
+/* 1061 */ "syslog\0"
+/* 1068 */ "The socket address ntpsnmpd uses to connect to net-snmpd\0"
+/* 1125 */ "AGENTXSOCKET\0"
+/* 1138 */ "agentxsocket\0"
+/* 1151 */ "unix:/var/agentx/master\0"
+/* 1175 */ "display extended usage information and exit\0"
+/* 1219 */ "help\0"
+/* 1224 */ "extended usage information passed thru pager\0"
+/* 1269 */ "more-help\0"
+/* 1279 */ "output version information and exit\0"
+/* 1315 */ "version\0"
+/* 1323 */ "save the option state to a config file\0"
+/* 1362 */ "save-opts\0"
+/* 1372 */ "load options from a config file\0"
+/* 1404 */ "LOAD_OPTS\0"
+/* 1414 */ "no-load-opts\0"
+/* 1427 */ "no\0"
+/* 1430 */ "NTPSNMPD\0"
+/* 1439 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p1\n"
"Usage: %s [ - [] | --[{=| }] ]...\n\0"
-/* 1482 */ "$HOME\0"
-/* 1488 */ ".\0"
-/* 1490 */ ".ntprc\0"
-/* 1497 */ "http://bugs.ntp.org, bugs@ntp.org\0"
-/* 1531 */ "\n\0"
-/* 1533 */ "ntpsnmpd 4.2.8";
+/* 1542 */ "$HOME\0"
+/* 1548 */ ".\0"
+/* 1550 */ ".ntprc\0"
+/* 1557 */ "http://bugs.ntp.org, bugs@ntp.org\0"
+/* 1591 */ "\n\0"
+/* 1593 */ "ntpsnmpd 4.2.8p1";
/**
* nofork option description:
*/
/** Descriptive text for the nofork option */
-#define NOFORK_DESC (ntpsnmpd_opt_strs+954)
+#define NOFORK_DESC (ntpsnmpd_opt_strs+1012)
/** Upper-cased name for the nofork option */
-#define NOFORK_NAME (ntpsnmpd_opt_strs+966)
+#define NOFORK_NAME (ntpsnmpd_opt_strs+1024)
/** Name string for the nofork option */
-#define NOFORK_name (ntpsnmpd_opt_strs+973)
+#define NOFORK_name (ntpsnmpd_opt_strs+1031)
/** Compiled in flag settings for the nofork option */
#define NOFORK_FLAGS (OPTST_DISABLED)
@@ -125,11 +126,11 @@ static char const ntpsnmpd_opt_strs[1548] =
* syslog option description:
*/
/** Descriptive text for the syslog option */
-#define SYSLOG_DESC (ntpsnmpd_opt_strs+980)
+#define SYSLOG_DESC (ntpsnmpd_opt_strs+1038)
/** Upper-cased name for the syslog option */
-#define SYSLOG_NAME (ntpsnmpd_opt_strs+996)
+#define SYSLOG_NAME (ntpsnmpd_opt_strs+1054)
/** Name string for the syslog option */
-#define SYSLOG_name (ntpsnmpd_opt_strs+1003)
+#define SYSLOG_name (ntpsnmpd_opt_strs+1061)
/** Compiled in flag settings for the syslog option */
#define SYSLOG_FLAGS (OPTST_DISABLED)
@@ -137,13 +138,13 @@ static char const ntpsnmpd_opt_strs[1548] =
* agentXSocket option description:
*/
/** Descriptive text for the agentXSocket option */
-#define AGENTXSOCKET_DESC (ntpsnmpd_opt_strs+1010)
+#define AGENTXSOCKET_DESC (ntpsnmpd_opt_strs+1068)
/** Upper-cased name for the agentXSocket option */
-#define AGENTXSOCKET_NAME (ntpsnmpd_opt_strs+1067)
+#define AGENTXSOCKET_NAME (ntpsnmpd_opt_strs+1125)
/** Name string for the agentXSocket option */
-#define AGENTXSOCKET_name (ntpsnmpd_opt_strs+1080)
+#define AGENTXSOCKET_name (ntpsnmpd_opt_strs+1138)
/** The compiled in default value for the agentXSocket option argument */
-#define AGENTXSOCKET_DFT_ARG (ntpsnmpd_opt_strs+1093)
+#define AGENTXSOCKET_DFT_ARG (ntpsnmpd_opt_strs+1151)
/** Compiled in flag settings for the agentXSocket option */
#define AGENTXSOCKET_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -151,11 +152,11 @@ static char const ntpsnmpd_opt_strs[1548] =
/*
* Help/More_Help/Version option descriptions:
*/
-#define HELP_DESC (ntpsnmpd_opt_strs+1117)
-#define HELP_name (ntpsnmpd_opt_strs+1161)
+#define HELP_DESC (ntpsnmpd_opt_strs+1175)
+#define HELP_name (ntpsnmpd_opt_strs+1219)
#ifdef HAVE_WORKING_FORK
-#define MORE_HELP_DESC (ntpsnmpd_opt_strs+1166)
-#define MORE_HELP_name (ntpsnmpd_opt_strs+1211)
+#define MORE_HELP_DESC (ntpsnmpd_opt_strs+1224)
+#define MORE_HELP_name (ntpsnmpd_opt_strs+1269)
#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
#else
#define MORE_HELP_DESC HELP_DESC
@@ -168,14 +169,14 @@ static char const ntpsnmpd_opt_strs[1548] =
# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
#endif
-#define VER_DESC (ntpsnmpd_opt_strs+1221)
-#define VER_name (ntpsnmpd_opt_strs+1257)
-#define SAVE_OPTS_DESC (ntpsnmpd_opt_strs+1265)
-#define SAVE_OPTS_name (ntpsnmpd_opt_strs+1304)
-#define LOAD_OPTS_DESC (ntpsnmpd_opt_strs+1314)
-#define LOAD_OPTS_NAME (ntpsnmpd_opt_strs+1346)
-#define NO_LOAD_OPTS_name (ntpsnmpd_opt_strs+1356)
-#define LOAD_OPTS_pfx (ntpsnmpd_opt_strs+1369)
+#define VER_DESC (ntpsnmpd_opt_strs+1279)
+#define VER_name (ntpsnmpd_opt_strs+1315)
+#define SAVE_OPTS_DESC (ntpsnmpd_opt_strs+1323)
+#define SAVE_OPTS_name (ntpsnmpd_opt_strs+1362)
+#define LOAD_OPTS_DESC (ntpsnmpd_opt_strs+1372)
+#define LOAD_OPTS_NAME (ntpsnmpd_opt_strs+1404)
+#define NO_LOAD_OPTS_name (ntpsnmpd_opt_strs+1414)
+#define LOAD_OPTS_pfx (ntpsnmpd_opt_strs+1427)
#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)
/**
* Declare option callback procedures
@@ -300,24 +301,24 @@ static tOptDesc optDesc[OPTION_CT] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** Reference to the upper cased version of ntpsnmpd. */
-#define zPROGNAME (ntpsnmpd_opt_strs+1372)
+#define zPROGNAME (ntpsnmpd_opt_strs+1430)
/** Reference to the title line for ntpsnmpd usage. */
-#define zUsageTitle (ntpsnmpd_opt_strs+1381)
+#define zUsageTitle (ntpsnmpd_opt_strs+1439)
/** ntpsnmpd configuration file name. */
-#define zRcName (ntpsnmpd_opt_strs+1490)
+#define zRcName (ntpsnmpd_opt_strs+1550)
/** Directories to search for ntpsnmpd config files. */
static char const * const apzHomeList[3] = {
- ntpsnmpd_opt_strs+1482,
- ntpsnmpd_opt_strs+1488,
+ ntpsnmpd_opt_strs+1542,
+ ntpsnmpd_opt_strs+1548,
NULL };
/** The ntpsnmpd program bug email address. */
-#define zBugsAddr (ntpsnmpd_opt_strs+1497)
+#define zBugsAddr (ntpsnmpd_opt_strs+1557)
/** Clarification/explanation of what ntpsnmpd does. */
-#define zExplain (ntpsnmpd_opt_strs+1531)
+#define zExplain (ntpsnmpd_opt_strs+1591)
/** Extra detail explaining what ntpsnmpd does. */
#define zDetail (NULL)
/** The full version string for ntpsnmpd. */
-#define zFullVersion (ntpsnmpd_opt_strs+1533)
+#define zFullVersion (ntpsnmpd_opt_strs+1593)
/* extracted from optcode.tlib near line 364 */
#if defined(ENABLE_NLS)
@@ -553,8 +554,8 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpsnmpdOptions.pzCopyright */
- puts(_("ntpsnmpd 4.2.8\n\
-Copyright (C) 1970-2014 The University of Delaware, all rights reserved.\n\
+ puts(_("ntpsnmpd 4.2.8p1\n\
+Copyright (C) 1992-2015 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\
can be seen at:\n"));
@@ -568,9 +569,10 @@ provided that the above copyright notice appears in all copies and that\n\
both the copyright notice and this permission notice appear in supporting\n\
documentation, and that the name The University of Delaware not be used in\n\
advertising or publicity pertaining to distribution of the software without\n\
-specific, written prior permission. The University of Delaware makes no\n\
-representations about the suitability this software for any purpose. It is\n\
-provided \"as is\" without express or implied warranty.\n"));
+specific, written prior permission. The University of Delaware and Network\n\
+Time Foundation makes no representations about the suitability this\n\
+software for any purpose. It is provided \"as is\" without express or\n\
+implied warranty.\n"));
/* referenced via ntpsnmpdOptions.pOptDesc->pzText */
puts(_("Do not fork"));
@@ -597,14 +599,14 @@ provided \"as is\" without express or implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpsnmpdOptions.pzUsageTitle */
- puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8\n\
+ puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p1\n\
Usage: %s [ - [] | --[{=| }] ]...\n"));
/* referenced via ntpsnmpdOptions.pzExplain */
puts(_("\n"));
/* referenced via ntpsnmpdOptions.pzFullVersion */
- puts(_("ntpsnmpd 4.2.8"));
+ puts(_("ntpsnmpd 4.2.8p1"));
/* referenced via ntpsnmpdOptions.pzFullUsage */
puts(_("<<>>"));
diff --git a/ntpsnmpd/ntpsnmpd-opts.h b/ntpsnmpd/ntpsnmpd-opts.h
index 67742a23dc77..9b9204133ecf 100644
--- a/ntpsnmpd/ntpsnmpd-opts.h
+++ b/ntpsnmpd/ntpsnmpd-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.h)
*
- * It has been AutoGen-ed December 19, 2014 at 07:50:21 AM by AutoGen 5.18.5pre4
+ * It has been AutoGen-ed February 4, 2015 at 02:43:21 AM by AutoGen 5.18.5pre4
* From the definitions ntpsnmpd-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntpsnmpd program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1970-2014 The University of Delaware, all rights reserved.
+ * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the NTP License, copies of which
* can be seen at:
@@ -31,7 +31,7 @@
* both the copyright notice and this permission notice appear in
* supporting documentation, and that the name The University of Delaware not be used in
* advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. The University of Delaware makes no
+ * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
* representations about the suitability this software for any purpose. It
* is provided "as is" without express or implied warranty.
*/
@@ -76,9 +76,9 @@ typedef enum {
/** count of all options for ntpsnmpd */
#define OPTION_CT 8
/** ntpsnmpd version */
-#define NTPSNMPD_VERSION "4.2.8"
+#define NTPSNMPD_VERSION "4.2.8p1"
/** Full ntpsnmpd version text */
-#define NTPSNMPD_FULL_VERSION "ntpsnmpd 4.2.8"
+#define NTPSNMPD_FULL_VERSION "ntpsnmpd 4.2.8p1"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/ntpsnmpd/ntpsnmpd.1ntpsnmpdman b/ntpsnmpd/ntpsnmpd.1ntpsnmpdman
index c1880b7ec40b..1c44243be1a3 100644
--- a/ntpsnmpd/ntpsnmpd.1ntpsnmpdman
+++ b/ntpsnmpd/ntpsnmpd.1ntpsnmpdman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpsnmpd 1ntpsnmpdman "19 Dec 2014" "4.2.8" "User Commands"
+.TH ntpsnmpd 1ntpsnmpdman "04 Feb 2015" "4.2.8p1" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FOaywh/ag-ROaqvh)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-T1aO3s/ag-51aG2s)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:50:29 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:43:29 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -138,7 +138,7 @@ it to autogen-users@lists.sourceforge.net. Thank you.
.NOP "Heiko Gerstung"
.br
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.SH "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc b/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc
index ce76dc14f5d0..9374142cb83e 100644
--- a/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc
+++ b/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc
@@ -1,9 +1,9 @@
-.Dd December 19 2014
+.Dd February 4 2015
.Dt NTPSNMPD 1ntpsnmpdmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:50:34 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:43:34 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -110,7 +110,7 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Sh AUTHORS
.An "Heiko Gerstung"
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.Sh "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpsnmpd/ntpsnmpd.html b/ntpsnmpd/ntpsnmpd.html
index 974b536e5d25..983b6dee87aa 100644
--- a/ntpsnmpd/ntpsnmpd.html
+++ b/ntpsnmpd/ntpsnmpd.html
@@ -42,7 +42,7 @@ Up: (dir)
The ntpsnmpd utility program is used to monitor NTP daemon ntpd
operations and determine performance. It uses the standard NTP mode 6 control
-
This document applies to version 4.2.8 of ntpsnmpd.
+
This document applies to version 4.2.8p1 of ntpsnmpd.
ntpsnmpd Description: Description
diff --git a/ntpsnmpd/ntpsnmpd.man.in b/ntpsnmpd/ntpsnmpd.man.in
index da48b668e110..f0de336492b3 100644
--- a/ntpsnmpd/ntpsnmpd.man.in
+++ b/ntpsnmpd/ntpsnmpd.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpsnmpd @NTPSNMPD_MS@ "19 Dec 2014" "4.2.8" "User Commands"
+.TH ntpsnmpd @NTPSNMPD_MS@ "04 Feb 2015" "4.2.8p1" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FOaywh/ag-ROaqvh)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-T1aO3s/ag-51aG2s)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:50:29 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:43:29 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -138,7 +138,7 @@ it to autogen-users@lists.sourceforge.net. Thank you.
.NOP "Heiko Gerstung"
.br
.SH "COPYRIGHT"
-Copyright (C) 1970-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.SH "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpsnmpd/ntpsnmpd.mdoc.in b/ntpsnmpd/ntpsnmpd.mdoc.in
index d85df74e59c6..d8d183d63657 100644
--- a/ntpsnmpd/ntpsnmpd.mdoc.in
+++ b/ntpsnmpd/ntpsnmpd.mdoc.in
@@ -1,9 +1,9 @@
-.Dd December 19 2014
+.Dd February 4 2015
.Dt NTPSNMPD @NTPSNMPD_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed December 19, 2014 at 07:50:34 AM by AutoGen 5.18.5pre4
+.\" It has been AutoGen-ed February 4, 2015 at 02:43:34 AM by AutoGen 5.18.5pre4
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -110,7 +110,7 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Sh AUTHORS
.An "Heiko Gerstung"
.Sh "COPYRIGHT"
-Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, .
.Sh "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/packageinfo.sh b/packageinfo.sh
index 684227aa7295..f3b727e61a51 100644
--- a/packageinfo.sh
+++ b/packageinfo.sh
@@ -83,7 +83,7 @@ CLTAG=NTP_4_2_0
# - Numeric values increment
# - empty 'increments' to 1
# - NEW 'increments' to empty
-point=
+point=1
### betapoint is normally modified by script.
# ntp-stable Beta number (betapoint)
diff --git a/parseutil/Makefile.in b/parseutil/Makefile.in
index 1d9d9cbe5df9..e741a93e1a02 100644
--- a/parseutil/Makefile.in
+++ b/parseutil/Makefile.in
@@ -148,6 +148,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -182,7 +183,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
diff --git a/ports/winnt/include/arpa/inet.h b/ports/winnt/include/arpa/inet.h
new file mode 100644
index 000000000000..5e1599737300
--- /dev/null
+++ b/ports/winnt/include/arpa/inet.h
@@ -0,0 +1,4 @@
+/**************************************************************
+ * Dummy Header for Unix to Windows NT portability
+ * Created for NTP package
+ **************************************************************/
diff --git a/ports/winnt/include/clockstuff.h b/ports/winnt/include/clockstuff.h
new file mode 100644
index 000000000000..df8569935094
--- /dev/null
+++ b/ports/winnt/include/clockstuff.h
@@ -0,0 +1,44 @@
+#ifndef _CLOCKSTUFF_H
+#define _CLOCKSTUFF_H
+
+#include
+#include
+
+#include "ntp_fp.h"
+#include "ntp_syslog.h"
+
+
+void init_winnt_time(void);
+void reset_winnt_time(void);
+void lock_thread_to_processor(HANDLE);
+
+/* 100ns intervals between 1/1/1601 and 1/1/1970 as reported by
+ * SystemTimeToFileTime()
+ */
+
+#define FILETIME_1970 0x019db1ded53e8000
+#define HECTONANOSECONDS 10000000
+
+/*
+ * Multimedia Timer
+ */
+
+void set_mm_timer(int);
+
+enum {
+ MM_TIMER_LORES,
+ MM_TIMER_HIRES
+};
+
+/*
+ * get_sys_time_as_filetime is a function pointer to
+ * either GetSystemTimeAsFileTime provided by Windows
+ * or ntpd's interpolating replacement.
+ */
+typedef void (WINAPI *PGSTAFT)(LPFILETIME pftResult);
+extern PGSTAFT get_sys_time_as_filetime;
+extern PGSTAFT pGetSystemTimePreciseAsFileTime;
+
+void lock_thread_to_processor(HANDLE);
+
+#endif
diff --git a/ports/winnt/include/config.h b/ports/winnt/include/config.h
new file mode 100644
index 000000000000..6de8857c1fed
--- /dev/null
+++ b/ports/winnt/include/config.h
@@ -0,0 +1,560 @@
+/*
+ * ports/winnt/include/config.h - static Windows config.h
+ *
+ * On most systems config.h is generated by the configure script.
+ * For the Windows port, it's hand-maintained. Compilers earlier
+ * than Visual C++ 2005 are no longer supported, enabling
+ * portable use of "long long" and "%lld".
+ */
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+/*
+ * Known predifined MS compiler version codes:
+ * 1800: MSVC++ 12.0 (Visual Studio 2013)
+ * 1700: MSVC++ 11.0 (Visual Studio 2012)
+ * 1600: MSVC++ 10.0 (Visual Studio 2010)
+ * 1500: MSVC++ 9.0 (Visual Studio 2008)
+ * 1400: MSVC++ 8.0 (Visual Studio 2005)
+ * 1310: MSVC++ 7.1 (Visual Studio 2003)
+ * 1300: MSVC++ 7.0
+ * 1200: MSVC++ 6.0 (Visual C++ 6)
+ * 1100: MSVC++ 5.0
+ */
+
+#if defined(_MSC_VER) && _MSC_VER < 1400
+#error Minimum supported Microsoft compiler is Visual C++ 2005.
+#endif
+
+/*
+ * We want structures and prototypes added after Windows NT 4.0 exposed
+ * by Windows header files, so we define _WIN32_WINNT to target Windows
+ * XP (version 5.1). By default, _WIN32_WINNT also controls the minimum
+ * required Windows version to launch the .exe. As we want a single
+ * binary to work on all supported Windows versions, we runtime link
+ * newer functions, and use the linker /version:0x0400 option to
+ * override the .EXE header minimum Windows version.
+ *
+ * When using the VC++ 2008 and later compilers, the resulting binaries
+ * will not work on versions earlier than Windows XP, due to runtime
+ * library dependencies. That is, Visual C++ 2005 is the last version
+ * capable of producing binaries usable with Windows NT 4 and 2000.
+ */
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+
+#define __attribute__(x) /* empty */
+#define _CRT_SECURE_NO_DEPRECATE 1
+
+/*
+ * ANSI C compliance enabled
+ */
+#define __STDC__ 1
+
+/*
+ * Enable the debug build of MS C runtime to dump leaks
+ * at exit time (currently only if run under a debugger).
+ */
+#if defined(_MSC_VER) && defined(_DEBUG)
+# define _CRTDBG_MAP_ALLOC
+# include
+# include
+# include
+/* # define MALLOC_LINT */ /* defers free() */
+# define EREALLOC_IMPL(ptr, newsz, filenm, loc) \
+ _realloc_dbg(ptr, newsz, _NORMAL_BLOCK, filenm, loc)
+#endif
+
+/*
+ * We need to include stdio.h first before we #define snprintf
+ * otherwise we can get errors during the build
+ */
+#include
+
+/* Prevent inclusion of winsock.h in windows.h */
+#ifndef _WINSOCKAPI_
+#define _WINSOCKAPI_
+#endif
+
+#ifndef __RPCASYNC_H__
+#define __RPCASYNC_H__
+#endif
+
+/*
+ * On Unix struct sock_timeval is equivalent to struct timeval.
+ * On Windows built with 64-bit time_t, sock_timeval.tv_sec is a long
+ * as required by Windows' socket() interface timeout argument, while
+ * timeval.tv_sec is time_t for the more common use as a UTC time
+ * within NTP.
+ *
+ * winsock.h unconditionally defines struct timeval with long tv_sec
+ * instead of time_t tv_sec. We redirect its declaration to struct
+ * sock_timeval instead of struct timeval with a #define.
+ */
+#define timeval sock_timeval
+
+/* Include Windows headers */
+#include
+#include
+#include
+
+#undef timeval /* see sock_timeval #define and comment above */
+
+/*
+ * Some definitions we are using are missing in the headers
+ * shipping with VC6. However, if the SDK is installed then the
+ * SDK's headers may declare the missing types. This is at least
+ * the case in the Oct 2001 SDK. That SDK and all subsequent
+ * versions also define the symbol _W64, so we can use that one
+ * to determine whether some types need to be defined, or not.
+ */
+#ifdef _W64
+/* VC6 can include wspiapi.h only if the SDK is installed */
+#include
+#endif
+
+#undef interface
+#include
+#include /* time_t for timeval decl */
+#include
+#include
+
+/* ---------------------------------------------------------------------
+ * Above this line are #include lines and the few #define lines
+ * needed before including headers.
+ */
+
+struct timeval {
+ time_t tv_sec;
+ long tv_usec;
+};
+
+/*
+ * ntohl and friends are actual functions on Windows, use our own
+ * macros instead to save the function call overhead. All releases
+ * of Windows are little-endian.
+ */
+#ifdef ntohl
+#error ntohl is already defined in ports/winnt/include/config.h
+#else
+#define ntohl(ul) (((u_long)(ul) & 0xff) << 24 | \
+ ((u_long)(ul) & 0xff00) << 8 | \
+ ((u_long)(ul) & 0xff0000) >> 8 | \
+ ((u_long)(ul) & 0xff000000) >> 24)
+#define htonl(ul) ntohl(ul)
+#define ntohs(us) ((u_short) \
+ (((u_short)(us) & 0xff) << 8 | \
+ ((u_short)(us) & 0xff00) >> 8))
+#define htons(us) ntohs(us)
+#endif
+
+/*
+ * On Unix open() works for tty (serial) devices just fine, while on
+ * Windows refclock serial devices are opened using CreateFile, a lower
+ * level than the CRT-provided descriptors, because the C runtime lacks
+ * tty APIs. For refclocks which wish to use open() as well as or
+ * instead of refclock_open(), tty_open() is equivalent to open() on
+ * Unix and implemented in the Windows port similarly to
+ * refclock_open().
+ */
+extern int tty_open(char *, int, int);
+
+/*
+ * disable use of __declspec(dllexport) by libisc routines
+ */
+#define ISC_STATIC_WIN 1
+
+/*
+ * ntp_rfc2553.h has cruft under #ifdef SYS_WINNT which is
+ * appropriate for older Microsoft IPv6 definitions, such
+ * as in_addr6 being the struct type. We can differentiate
+ * the RFC2553-compliant newer headers because they have
+ * #define in_addr6 in6_addr
+ * for backward compatibility. With the newer headers,
+ * we define ISC_PLATFORM_HAVEIPV6 and disable the cruft.
+ */
+#ifdef in_addr6
+#define WANT_IPV6
+#define ISC_PLATFORM_HAVEIPV6
+#define ISC_PLATFORM_HAVESCOPEID
+#define HAVE_STRUCT_SOCKADDR_STORAGE
+#define ISC_PLATFORM_HAVEIN6PKTINFO
+#endif /* in_addr6 / RFC2553-compliant IPv6 headers */
+
+#define NO_OPTION_NAME_WARNINGS
+
+#if !defined( _W64 )
+ /*
+ * if ULONG_PTR needs to be defined then the build environment
+ * is pure 32 bit Windows. Since ULONG_PTR and DWORD have
+ * the same size in 32 bit Windows we can safely define
+ * a replacement.
+ */
+typedef DWORD ULONG_PTR;
+/* VC6 doesn't know about socklen_t, except if the SDK is installed */
+typedef int socklen_t;
+#endif /* _W64 */
+
+#define ISC_PLATFORM_NEEDIN6ADDRANY
+#define HAVE_SOCKADDR_IN6
+
+/*
+ * The type of the socklen_t defined for getnameinfo() and getaddrinfo()
+ * is int for VS compilers on Windows but the type is already declared
+ */
+#define GETSOCKNAME_SOCKLEN_TYPE socklen_t
+
+/*
+ * Older SDKs do not define SO_EXCLUSIVEADDRUSE in winsock2.h
+ */
+#ifndef SO_EXCLUSIVEADDRUSE
+#define SO_EXCLUSIVEADDRUSE ((int)(~SO_REUSEADDR))
+#endif
+
+#if defined _MSC_VER && _MSC_VER < 1400
+/*
+ * Use 32-bit time definitions for versions prior to VS 2005
+ * VS 2005 defaults to 64-bit time
+ */
+# define SIZEOF_TIME_T 4
+#else
+# define SIZEOF_TIME_T 8
+#endif
+
+
+/*
+ * An attempt to cut down the number of warnings generated during compilation.
+ * All of these should be benign to disable.
+ */
+
+#pragma warning(disable: 4100) /* unreferenced formal parameter */
+#pragma warning(disable: 4127) /* conditional expression is constant */
+#pragma warning(disable: 4996) /* more secure replacement available */
+
+/*
+ * Windows NT Configuration Values
+ */
+#if defined _DEBUG /* Use VC standard macro definitions */
+# define DEBUG 1
+#endif
+
+#define __windows__ 1
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+#define OPEN_BCAST_SOCKET 1 /* for ntp_io.c */
+#define TYPEOF_IP_MULTICAST_LOOP BOOL
+#define SETSOCKOPT_ARG_CAST (const char *)
+#define HAVE_RANDOM
+#define AUTOKEY
+#define SAVECONFIG 1
+
+/*
+ * Multimedia timer enable
+ */
+#define USE_MM_TIMER
+
+/* Enable OpenSSL */
+#define OPENSSL 1
+#define USE_OPENSSL_CRYPTO_RAND 1
+
+/*
+ * Keywords and functions that Microsoft maps
+ * to other names
+ */
+#define inline __inline
+#define stricmp _stricmp
+#define strcasecmp _stricmp
+#define isascii __isascii
+#define finite _finite
+#define random rand
+#define srandom srand
+#define fdopen _fdopen
+#define read _read
+#define open _open
+#ifndef close
+#define close _close
+#endif
+#define write _write
+#define strdup _strdup
+#define alloca _alloca
+#define stat _stat /*struct stat from */
+#define fstat _fstat
+#define unlink _unlink
+/*
+ * punt on fchmod on Windows
+ */
+#define fchmod(x,y) {}
+#define lseek _lseek
+#define pipe _pipe
+#define dup2 _dup2
+/*
+ * scale, unix sleep is seconds, Windows Sleep is msec
+ */
+#define sleep(x) Sleep((unsigned)(x) * 1000)
+#define fileno _fileno
+#define isatty _isatty
+#define mktemp _mktemp
+#define getpid _getpid
+#define timegm _mkgmtime
+#define errno_to_str isc__strerror
+/*
+ * symbol returning the name of the current function
+ */
+#define __func__ __FUNCTION__
+
+typedef int pid_t; /* PID is an int */
+typedef int ssize_t; /* ssize is an int */
+
+/*
+ * Map the stream to the file number
+ */
+#define STDOUT_FILENO _fileno(stdout)
+#define STDERR_FILENO _fileno(stderr)
+
+/*
+ * To minimize Windows-specific changes to the rest of the NTP code,
+ * particularly reference clocks, ntp_stdlib.h will
+ *
+ * #define strerror(e) ntp_strerror(e)
+ *
+ * to deal with our mixture of C runtime (open, write) and Windows
+ * (sockets, serial ports) error codes. This is an ugly hack because
+ * both use the lowest values differently, but particularly for ntpd,
+ * it's not a problem.
+ */
+#define NTP_REDEFINE_STRERROR
+
+#define MCAST /* Enable Multicast Support */
+#define MULTICAST_NONEWSOCKET /* Don't create a new socket for mcast address */
+
+# define REFCLOCK /* from ntpd.mak */
+
+/* #define CLOCK_PARSE */
+#define CLOCK_ACTS
+#define CLOCK_ARBITER
+#define CLOCK_ARCRON_MSF
+#define OWN_PPS_NTP_TIMESTAMP_FROM_COUNTER /* timepps.h */
+#define HAVE_TIMEPPS_H
+#define HAVE_PPSAPI
+#define CLOCK_ATOM
+#define CLOCK_CHU
+#define CLOCK_CHRONOLOG
+#define CLOCK_DUMBCLOCK
+#define CLOCK_HOPF_SERIAL /* device 38, hopf DCF77/GPS serial line receiver */
+#define CLOCK_HOPF_PCI /* device 39, hopf DCF77/GPS PCI-Bus receiver */
+#define CLOCK_JUPITER
+#define CLOCK_LOCAL
+#define CLOCK_NMEA
+#define CLOCK_ONCORE
+#define CLOCK_PALISADE /* from ntpd.mak */
+#define CLOCK_PARSE
+/* parse component drivers */
+#define CLOCK_COMPUTIME
+#define CLOCK_DCF7000
+#define CLOCK_HOPF6021
+#define CLOCK_MEINBERG
+#define CLOCK_RAWDCF
+#define CLOCK_RCC8000
+#define CLOCK_SCHMID
+#define CLOCK_TRIMTAIP
+#define CLOCK_TRIMTSIP
+#define CLOCK_VARITEXT
+#define CLOCK_WHARTON_400A
+/* end parse component drivers */
+/* # define CLOCK_SHM */
+#define CLOCK_SPECTRACOM /* refclock_wwvb.c */
+#define CLOCK_TRIMBLEDC
+#define CLOCK_TRUETIME
+
+#define NTP_LITTLE_ENDIAN /* from libntp.mak */
+#define NTP_POSIX_SOURCE
+
+#define SYSLOG_FILE /* from libntp.mak */
+
+#define HAVE_LONG_LONG_INT 1
+#define HAVE_UNSIGNED_LONG_LONG_INT 1
+#define HAVE_SIZE_T 1
+#define HAVE_PTRDIFF_T 1
+
+# define SIZEOF_SIGNED_CHAR 1
+# define SIZEOF_SHORT 2
+# define SIZEOF_INT 4
+# define SIZEOF_LONG 4
+# define SIZEOF_LONG_LONG 8
+
+/* libntp/snprintf.c doesn't know %I64d */
+#define ISC_PLATFORM_QUADFORMAT "ll"
+
+# define HAVE_ERRNO_H 1
+# define HAVE_FCNTL_H 1
+# define HAVE_LIMITS_H 1
+# define HAVE_STDARG_H 1
+# define HAVE_SYS_RESOURCE_H 1
+# define HAVE_SYS_TIME_H 1
+# define HAVE_TERMIOS_H 1
+
+# define HAVE_ALLOCA 1
+# define HAVE_GETCLOCK 1
+# define HAVE_MEMMOVE 1
+# define HAVE_MKTIME 1
+# define HAVE_SETVBUF 1
+# define HAVE_STRCHR 1 /* for libopts */
+# define HAVE_STRDUP 1
+# define HAVE_TIMEGM 1 /* actually _mkgmtime */
+
+# define HAVE_STRUCT_TIMESPEC
+# define HAVE_IO_COMPLETION_PORT
+# define ISC_PLATFORM_NEEDNTOP
+# define ISC_PLATFORM_NEEDPTON
+
+#define HAVE_BSD_NICE /* emulate BSD setpriority() */
+
+#define HW_WANT_RPL_VSNPRINTF 1
+#define vsnprintf rpl_vsnprintf
+#include
+int rpl_vsnprintf(char *, size_t, const char *, va_list);
+#define HW_WANT_RPL_SNPRINTF 1
+#define snprintf rpl_snprintf
+int rpl_snprintf(char *, size_t, const char *, ...);
+#define HAVE_VSNPRINTF 1
+#define HAVE_SNPRINTF 1
+
+typedef char *caddr_t;
+
+#ifdef _WCTYPE_T_DEFINED /* see vc/include/crtdefs.h */
+#define HAVE_WINT_T 1
+#endif
+
+#ifndef _INTPTR_T_DEFINED
+typedef long intptr_t;
+#define _INTPTR_T_DEFINED
+#endif
+#define HAVE_INTPTR_T 1
+
+#ifndef _UINTPTR_T_DEFINED
+typedef unsigned long uintptr_t;
+#define _UINTPTR_T_DEFINED
+#endif
+#define HAVE_UINTPTR_T 1
+
+#if !defined( _W64 )
+ /*
+ * if DWORD_PTR needs to be defined then the build environment
+ * is pure 32 bit Windows. Since DWORD_PTR and DWORD have
+ * the same size in 32 bit Windows we can safely define
+ * a replacement.
+ */
+ typedef DWORD DWORD_PTR;
+#endif
+
+#define NEED_S_CHAR_TYPEDEF
+
+
+/* C99 exact size integer support. */
+#if defined(_MSC_VER) && _MSC_VER<1800
+# define MISSING_INTTYPES_H 1 /* not provided by VS2012 and earlier */
+# define MISSING_STDBOOL_H 1 /* not provided by VS2012 and earlier */
+# define MISSING_C99_STYLE_INIT 1 /* see [Bug 2728] */
+#else
+#if defined(_MSC_VER) && _MSC_VER>=1800
+/* VS2013 and above support C99 types */
+# define HAVE_INT8_T 1
+# define HAVE_UINT8_T 1
+# define HAVE_INT16_T 1
+# define HAVE_UINT16_T 1
+# define HAVE_INT32_T 1
+# define HAVE_UINT32_T 1
+#endif
+#endif
+
+#if !defined (MISSING_STDBOOL_H)
+# define HAVE_STDBOOL_H
+#endif
+#if !defined(MISSING_INTTYPES_H)
+# define HAVE_INTTYPES_H 1
+#elif !defined(MISSING_STDINT_H)
+# define HAVE_STDINT_H 1
+#elif !defined(ADDED_EXACT_SIZE_INTEGERS)
+# define ADDED_EXACT_SIZE_INTEGERS 1
+ typedef __int8 int8_t;
+ typedef unsigned __int8 uint8_t;
+
+ typedef __int16 int16_t;
+ typedef unsigned __int16 uint16_t;
+
+ typedef __int32 int32_t;
+ typedef unsigned __int32 uint32_t;
+
+ typedef __int64 int64_t;
+ typedef unsigned __int64 uint64_t;
+#endif
+
+
+/* Directory separator, usually / or \ */
+#define DIR_SEP '\\'
+
+#define POSIX_SHELL "/bin/sh" /* libopts/makeshell.c */
+
+#define ULONG_CONST(a) a ## UL
+
+#define NOKMEM
+#define RETSIGTYPE void
+
+#ifndef STR_SYSTEM
+#define STR_SYSTEM "Windows"
+#endif
+
+#ifndef STR_PROCESSOR
+
+#define STRINGIZE(arg) #arg
+
+#ifdef _M_IX86
+#ifndef _M_IX86_FP
+#define STR_PROCESSOR "x86"
+#else
+#if !_M_IX86_FP
+#define STR_PROCESSOR "x86"
+#else
+#if _M_IX86_FP > 2
+#define STR_PROCESSOR "x86-FP-" STRINGIZE(_M_IX86_FP)
+#else
+#if _M_IX86_FP == 2
+#define STR_PROCESSOR "x86-SSE2"
+#else
+#define STR_PROCESSOR "x86-SSE"
+#endif /* _M_IX86 == 2 */
+#endif /* _M_IX86_FP > 2 */
+#endif /* !_M_IX86_FP */
+#endif /* !defined(_M_IX86_FP) */
+#endif /* !defined(_M_IX86) */
+
+#ifdef _M_IA64
+#define STR_PROCESSOR "Itanium"
+#endif
+
+#ifdef _M_X64
+#define STR_PROCESSOR "x64"
+#endif
+
+#endif /* !defined(STR_PROCESSOR) */
+
+#undef STRINGIZE
+
+#define SIOCGIFFLAGS SIO_GET_INTERFACE_LIST /* used in ntp_io.c */
+/*
+ * Below this line are includes which must happen after the bulk of
+ * config.h is processed. If you need to add another #include to this
+ * file the preferred location is near the top, above the similar
+ * line of hyphens.
+ * ---------------------------------------------------------------------
+ */
+
+/*
+ * Include standard stat information
+ */
+#include
+
+#endif /* CONFIG_H */
diff --git a/ports/winnt/include/gaa_compat.h b/ports/winnt/include/gaa_compat.h
new file mode 100644
index 000000000000..fdacaf0e84a5
--- /dev/null
+++ b/ports/winnt/include/gaa_compat.h
@@ -0,0 +1,771 @@
+/*
+ * ports/winnt/include/gaa_compat.h
+ *
+ * This header allows systems without a recent-enough SDK to build NTP
+ * which can use GetAdaptersAddresses(), related functions and macros.
+ */
+#ifndef GAA_COMPAT_H
+#define GAA_COMPAT_H
+
+#ifdef _W64
+# include
+#else /* !_W64 follows */
+
+#pragma warning(push)
+/* warning C4201: nonstandard extension used : nameless struct/union */
+#pragma warning(disable:4201)
+/* warning C4214: nonstandard extension used : bit field types other than int */
+#pragma warning(disable:4214)
+
+/* +++++++++++++++++++++++ from nldef.h */
+typedef enum {
+ //
+ // These values are from iptypes.h.
+ // They need to fit in a 4 bit field.
+ //
+ IpPrefixOriginOther = 0,
+ IpPrefixOriginManual,
+ IpPrefixOriginWellKnown,
+ IpPrefixOriginDhcp,
+ IpPrefixOriginRouterAdvertisement,
+ IpPrefixOriginUnchanged = 1 << 4
+} NL_PREFIX_ORIGIN;
+
+typedef enum {
+ //
+ // These values are from in iptypes.h.
+ // They need to fit in a 4 bit field.
+ //
+ IpSuffixOriginOther = 0,
+ IpSuffixOriginManual,
+ IpSuffixOriginWellKnown,
+ IpSuffixOriginDhcp,
+ IpSuffixOriginLinkLayerAddress,
+ IpSuffixOriginRandom,
+ IpSuffixOriginUnchanged = 1 << 4
+} NL_SUFFIX_ORIGIN;
+
+typedef enum {
+ //
+ // These values are from in iptypes.h.
+ //
+ IpDadStateInvalid = 0,
+ IpDadStateTentative,
+ IpDadStateDuplicate,
+ IpDadStateDeprecated,
+ IpDadStatePreferred,
+} NL_DAD_STATE;
+/* +++++++++++++++++++++++ from nldef.h */
+
+
+/* +++++++++++++++++++++++ from ifdef.h */
+typedef ULONG32 NET_IF_OBJECT_ID, *PNET_IF_OBJECT_ID;
+
+
+typedef enum _NET_IF_ADMIN_STATUS // ifAdminStatus
+{
+ NET_IF_ADMIN_STATUS_UP = 1,
+ NET_IF_ADMIN_STATUS_DOWN = 2,
+ NET_IF_ADMIN_STATUS_TESTING = 3
+} NET_IF_ADMIN_STATUS, *PNET_IF_ADMIN_STATUS;
+
+typedef enum _NET_IF_OPER_STATUS // ifOperStatus
+{
+ NET_IF_OPER_STATUS_UP = 1,
+ NET_IF_OPER_STATUS_DOWN = 2,
+ NET_IF_OPER_STATUS_TESTING = 3,
+ NET_IF_OPER_STATUS_UNKNOWN = 4,
+ NET_IF_OPER_STATUS_DORMANT = 5,
+ NET_IF_OPER_STATUS_NOT_PRESENT = 6,
+ NET_IF_OPER_STATUS_LOWER_LAYER_DOWN = 7
+} NET_IF_OPER_STATUS, *PNET_IF_OPER_STATUS;
+
+//
+// Flags to extend operational status
+//
+#define NET_IF_OPER_STATUS_DOWN_NOT_AUTHENTICATED 0x00000001
+#define NET_IF_OPER_STATUS_DOWN_NOT_MEDIA_CONNECTED 0x00000002
+#define NET_IF_OPER_STATUS_DORMANT_PAUSED 0x00000004
+#define NET_IF_OPER_STATUS_DORMANT_LOW_POWER 0x00000008
+
+typedef UINT32 NET_IF_COMPARTMENT_ID, *PNET_IF_COMPARTMENT_ID;
+
+//
+// Define compartment ID type:
+//
+#define NET_IF_COMPARTMENT_ID_UNSPECIFIED (NET_IF_COMPARTMENT_ID)0
+#define NET_IF_COMPARTMENT_ID_PRIMARY (NET_IF_COMPARTMENT_ID)1
+
+#define NET_IF_OID_IF_ALIAS 0x00000001 // identifies the ifAlias string for an interface
+#define NET_IF_OID_COMPARTMENT_ID 0x00000002 // identifies the compartment ID for an interface.
+#define NET_IF_OID_NETWORK_GUID 0x00000003 // identifies the NetworkGuid for an interface.
+#define NET_IF_OID_IF_ENTRY 0x00000004 // identifies statistics for an interface.
+
+//
+// Define NetworkGUID type:
+//
+typedef GUID NET_IF_NETWORK_GUID, *PNET_IF_NETWORK_GUID;
+
+//
+// Define macros for an "unspecified" NetworkGUID value to be used in structures
+// that haven't had the NET_LUID field filled in yet.
+//
+#define NET_SET_UNSPECIFIED_NETWORK_GUID(_pNetworkGuid)
+#define NET_IS_UNSPECIFIED_NETWORK_GUID(_NetworkGuidValue)
+
+//
+// To prevent collisions between user-assigned and system-assigend site-ids,
+// we partition the site-id space into two:
+// 1. User-Assigned: NET_SITEID_UNSPECIFIED < SiteId < NET_SITEID_MAXUSER
+// 2. System-Assigned: NET_SITEID_MAXUSER < SiteId < NET_SITEID_MAXSYSTEM
+//
+// Note: A network's SiteId doesn't really need to be settable.
+// 1. The network profile manager creates a network per network profile.
+// 2. NDIS/IF assigns a unique SiteId to each network.
+//
+#define NET_SITEID_UNSPECIFIED (0)
+#define NET_SITEID_MAXUSER (0x07ffffff)
+#define NET_SITEID_MAXSYSTEM (0x0fffffff)
+C_ASSERT(NET_SITEID_MAXUSER < NET_SITEID_MAXSYSTEM);
+
+typedef enum _NET_IF_RCV_ADDRESS_TYPE // ifRcvAddressType
+{
+ NET_IF_RCV_ADDRESS_TYPE_OTHER = 1,
+ NET_IF_RCV_ADDRESS_TYPE_VOLATILE = 2,
+ NET_IF_RCV_ADDRESS_TYPE_NON_VOLATILE = 3
+} NET_IF_RCV_ADDRESS_TYPE, *PNET_IF_RCV_ADDRESS_TYPE;
+
+typedef struct _NET_IF_RCV_ADDRESS_LH
+{
+ NET_IF_RCV_ADDRESS_TYPE ifRcvAddressType;
+ USHORT ifRcvAddressLength;
+ USHORT ifRcvAddressOffset; // from beginning of this struct
+} NET_IF_RCV_ADDRESS_LH, *PNET_IF_RCV_ADDRESS_LH;
+
+typedef struct _NET_IF_ALIAS_LH
+{
+ USHORT ifAliasLength; // in bytes, of ifAlias string
+ USHORT ifAliasOffset; // in bytes, from beginning of this struct
+} NET_IF_ALIAS_LH, *PNET_IF_ALIAS_LH;
+
+#pragma warning(push)
+#pragma warning(disable:4214) // bit field types other than int
+typedef union _NET_LUID_LH
+{
+ ULONG64 Value;
+ struct
+ {
+ ULONG64 Reserved:24;
+ ULONG64 NetLuidIndex:24;
+ ULONG64 IfType:16; // equal to IANA IF type
+ }Info;
+} NET_LUID_LH, *PNET_LUID_LH;
+#pragma warning(pop)
+
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+typedef NET_IF_RCV_ADDRESS_LH NET_IF_RCV_ADDRESS;
+typedef NET_IF_RCV_ADDRESS* PNET_IF_RCV_ADDRESS;
+
+typedef NET_IF_ALIAS_LH NET_IF_ALIAS;
+typedef NET_IF_ALIAS* PNET_IF_ALIAS;
+#endif //NTDDI_LONGHORN
+
+//
+// Need to make this visible on all platforms (for the purpose of IF_LUID).
+//
+typedef NET_LUID_LH NET_LUID;
+typedef NET_LUID* PNET_LUID;
+
+//
+// IF_LUID
+//
+// Define the locally unique datalink interface identifier type.
+// This type is persistable.
+//
+typedef NET_LUID IF_LUID, *PIF_LUID;
+
+typedef ULONG NET_IFINDEX, *PNET_IFINDEX; // Interface Index (ifIndex)
+typedef UINT16 NET_IFTYPE, *PNET_IFTYPE; // Interface Type (IANA ifType)
+
+#define NET_IFINDEX_UNSPECIFIED (NET_IFINDEX)(0) // Not a valid ifIndex
+#define NET_IFLUID_UNSPECIFIED (0) // Not a valid if Luid
+
+//
+// Definitions for NET_IF_INFORMATION.Flags
+//
+#define NIIF_HARDWARE_INTERFACE 0x00000001 // Set iff hardware
+#define NIIF_FILTER_INTERFACE 0x00000002
+#define NIIF_NDIS_RESERVED1 0x00000004
+#define NIIF_NDIS_RESERVED2 0x00000008
+#define NIIF_NDIS_RESERVED3 0x00000010
+#define NIIF_NDIS_WDM_INTERFACE 0x00000020
+#define NIIF_NDIS_ENDPOINT_INTERFACE 0x00000040
+
+#define NIIF_WAN_TUNNEL_TYPE_UNKNOWN ((ULONG)(-1))
+
+//
+// Define datalink interface access types.
+//
+typedef enum _NET_IF_ACCESS_TYPE
+{
+ NET_IF_ACCESS_LOOPBACK = 1,
+ NET_IF_ACCESS_BROADCAST = 2,
+ NET_IF_ACCESS_POINT_TO_POINT = 3,
+ NET_IF_ACCESS_POINT_TO_MULTI_POINT = 4,
+ NET_IF_ACCESS_MAXIMUM = 5
+} NET_IF_ACCESS_TYPE, *PNET_IF_ACCESS_TYPE;
+
+
+//
+// Define datalink interface direction types.
+//
+typedef enum _NET_IF_DIRECTION_TYPE
+{
+ NET_IF_DIRECTION_SENDRECEIVE,
+ NET_IF_DIRECTION_SENDONLY,
+ NET_IF_DIRECTION_RECEIVEONLY,
+ NET_IF_DIRECTION_MAXIMUM
+} NET_IF_DIRECTION_TYPE, *PNET_IF_DIRECTION_TYPE;
+
+
+typedef enum _NET_IF_CONNECTION_TYPE
+{
+ NET_IF_CONNECTION_DEDICATED = 1,
+ NET_IF_CONNECTION_PASSIVE = 2,
+ NET_IF_CONNECTION_DEMAND = 3,
+ NET_IF_CONNECTION_MAXIMUM = 4
+} NET_IF_CONNECTION_TYPE, *PNET_IF_CONNECTION_TYPE;
+
+
+typedef enum _NET_IF_MEDIA_CONNECT_STATE
+{
+ MediaConnectStateUnknown,
+ MediaConnectStateConnected,
+ MediaConnectStateDisconnected
+} NET_IF_MEDIA_CONNECT_STATE, *PNET_IF_MEDIA_CONNECT_STATE;
+
+#define NET_IF_LINK_SPEED_UNKNOWN ((ULONG64)(-1))
+
+//
+// Defines the duplex state of media
+//
+typedef enum _NET_IF_MEDIA_DUPLEX_STATE
+{
+ MediaDuplexStateUnknown,
+ MediaDuplexStateHalf,
+ MediaDuplexStateFull
+} NET_IF_MEDIA_DUPLEX_STATE, *PNET_IF_MEDIA_DUPLEX_STATE;
+
+
+// Special values for fields in NET_PHYSICAL_LOCATION
+#define NIIF_BUS_NUMBER_UNKNOWN ((ULONG)(-1))
+#define NIIF_SLOT_NUMBER_UNKNOWN ((ULONG)(-1))
+#define NIIF_FUNCTION_NUMBER_UNKNOWN ((ULONG)(-1))
+
+typedef struct _NET_PHYSICAL_LOCATION_LH
+{
+ ULONG BusNumber; // Physical location
+ ULONG SlotNumber; // ... for hardware
+ ULONG FunctionNumber; // ... devices.
+} NET_PHYSICAL_LOCATION_LH, *PNET_PHYSICAL_LOCATION_LH;
+
+//
+// maximum string size in -wchar- units
+//
+#define IF_MAX_STRING_SIZE 256
+
+typedef struct _IF_COUNTED_STRING_LH
+{
+ USHORT Length; // in -Bytes-
+ WCHAR String[IF_MAX_STRING_SIZE + 1];
+} IF_COUNTED_STRING_LH, *PIF_COUNTED_STRING_LH;
+
+#define IF_MAX_PHYS_ADDRESS_LENGTH 32
+
+typedef struct _IF_PHYSICAL_ADDRESS_LH
+{
+ USHORT Length;
+ UCHAR Address[IF_MAX_PHYS_ADDRESS_LENGTH];
+} IF_PHYSICAL_ADDRESS_LH, *PIF_PHYSICAL_ADDRESS_LH;
+
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+typedef NET_PHYSICAL_LOCATION_LH NET_PHYSICAL_LOCATION;
+typedef NET_PHYSICAL_LOCATION* PNET_PHYSICAL_LOCATION;
+
+typedef IF_COUNTED_STRING_LH IF_COUNTED_STRING;
+typedef IF_COUNTED_STRING* PIF_COUNTED_STRING;
+
+typedef IF_PHYSICAL_ADDRESS_LH IF_PHYSICAL_ADDRESS;
+typedef IF_PHYSICAL_ADDRESS* PIF_PHYSICAL_ADDRESS;
+#endif
+
+
+//
+// IF_INDEX
+//
+// Define the interface index type.
+// This type is not persistable.
+// This must be unsigned (not an enum) to replace previous uses of
+// an index that used a DWORD type.
+//
+
+typedef NET_IFINDEX IF_INDEX, *PIF_INDEX;
+#define IFI_UNSPECIFIED NET_IFINDEX_UNSPECIFIED
+
+
+//
+// Get definitions for IFTYPE and IF_ACCESS_TYPE.
+//
+#include
+
+
+//
+// Types of tunnels (sub-type of IF_TYPE when IF_TYPE is IF_TYPE_TUNNEL).
+// See http://www.iana.org/assignments/ianaiftype-mib.
+//
+typedef enum {
+ TUNNEL_TYPE_NONE = 0,
+ TUNNEL_TYPE_OTHER = 1,
+ TUNNEL_TYPE_DIRECT = 2,
+ TUNNEL_TYPE_6TO4 = 11,
+ TUNNEL_TYPE_ISATAP = 13,
+ TUNNEL_TYPE_TEREDO = 14,
+} TUNNEL_TYPE, *PTUNNEL_TYPE;
+
+//
+// IF_ADMINISTRATIVE_STATE
+//
+// Datalink Interface Administrative State.
+// Indicates whether the interface has been administratively enabled.
+//
+
+typedef enum _IF_ADMINISTRATIVE_STATE {
+ IF_ADMINISTRATIVE_DISABLED,
+ IF_ADMINISTRATIVE_ENABLED,
+ IF_ADMINISTRATIVE_DEMANDDIAL,
+} IF_ADMINISTRATIVE_STATE, *PIF_ADMINISTRATIVE_STATE;
+
+
+//
+// Note: Interface is Operational iff
+// ((MediaSense is Connected) and (AdministrativeState is Enabled))
+// or
+// ((MediaSense is Connected) and (AdministrativeState is OnDemand))
+//
+// !Operational iff
+// ((MediaSense != Connected) or (AdministrativeState is Disabled))
+//
+
+//
+// OperStatus values from RFC 2863
+//
+typedef enum {
+ IfOperStatusUp = 1,
+ IfOperStatusDown,
+ IfOperStatusTesting,
+ IfOperStatusUnknown,
+ IfOperStatusDormant,
+ IfOperStatusNotPresent,
+ IfOperStatusLowerLayerDown
+} IF_OPER_STATUS;
+/* +++++++++++++++++++++++ from ifdef.h */
+
+
+/* +++++++++++++++++++++++ from iptypes.h */
+// Definitions and structures used by getnetworkparams and getadaptersinfo apis
+
+#define MAX_ADAPTER_DESCRIPTION_LENGTH 128 // arb.
+#define MAX_ADAPTER_NAME_LENGTH 256 // arb.
+#define MAX_ADAPTER_ADDRESS_LENGTH 8 // arb.
+#define DEFAULT_MINIMUM_ENTITIES 32 // arb.
+#define MAX_HOSTNAME_LEN 128 // arb.
+#define MAX_DOMAIN_NAME_LEN 128 // arb.
+#define MAX_SCOPE_ID_LEN 256 // arb.
+#define MAX_DHCPV6_DUID_LENGTH 130 // RFC 3315.
+
+//
+// types
+//
+
+// Node Type
+
+#define BROADCAST_NODETYPE 1
+#define PEER_TO_PEER_NODETYPE 2
+#define MIXED_NODETYPE 4
+#define HYBRID_NODETYPE 8
+
+//
+// IP_ADDRESS_STRING - store an IP address as a dotted decimal string
+//
+
+typedef struct {
+ char String[4 * 4];
+} IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING;
+
+//
+// IP_ADDR_STRING - store an IP address with its corresponding subnet mask,
+// both as dotted decimal strings
+//
+
+typedef struct _IP_ADDR_STRING {
+ struct _IP_ADDR_STRING* Next;
+ IP_ADDRESS_STRING IpAddress;
+ IP_MASK_STRING IpMask;
+ DWORD Context;
+} IP_ADDR_STRING, *PIP_ADDR_STRING;
+
+//
+// ADAPTER_INFO - per-adapter information. All IP addresses are stored as
+// strings
+//
+
+typedef struct _IP_ADAPTER_INFO {
+ struct _IP_ADAPTER_INFO* Next;
+ DWORD ComboIndex;
+ char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
+ char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
+ UINT AddressLength;
+ BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
+ DWORD Index;
+ UINT Type;
+ UINT DhcpEnabled;
+ PIP_ADDR_STRING CurrentIpAddress;
+ IP_ADDR_STRING IpAddressList;
+ IP_ADDR_STRING GatewayList;
+ IP_ADDR_STRING DhcpServer;
+ BOOL HaveWins;
+ IP_ADDR_STRING PrimaryWinsServer;
+ IP_ADDR_STRING SecondaryWinsServer;
+ time_t LeaseObtained;
+ time_t LeaseExpires;
+} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
+
+#ifdef _WINSOCK2API_
+
+//
+// The following types require Winsock2.
+//
+
+typedef NL_PREFIX_ORIGIN IP_PREFIX_ORIGIN;
+typedef NL_SUFFIX_ORIGIN IP_SUFFIX_ORIGIN;
+typedef NL_DAD_STATE IP_DAD_STATE;
+
+typedef struct _IP_ADAPTER_UNICAST_ADDRESS_LH {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Flags;
+ };
+ };
+ struct _IP_ADAPTER_UNICAST_ADDRESS_LH *Next;
+ SOCKET_ADDRESS Address;
+
+ IP_PREFIX_ORIGIN PrefixOrigin;
+ IP_SUFFIX_ORIGIN SuffixOrigin;
+ IP_DAD_STATE DadState;
+
+ ULONG ValidLifetime;
+ ULONG PreferredLifetime;
+ ULONG LeaseLifetime;
+ UINT8 OnLinkPrefixLength;
+} IP_ADAPTER_UNICAST_ADDRESS_LH,
+ *PIP_ADAPTER_UNICAST_ADDRESS_LH;
+
+typedef struct _IP_ADAPTER_UNICAST_ADDRESS_XP {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Flags;
+ };
+ };
+ struct _IP_ADAPTER_UNICAST_ADDRESS_XP *Next;
+ SOCKET_ADDRESS Address;
+
+ IP_PREFIX_ORIGIN PrefixOrigin;
+ IP_SUFFIX_ORIGIN SuffixOrigin;
+ IP_DAD_STATE DadState;
+
+ ULONG ValidLifetime;
+ ULONG PreferredLifetime;
+ ULONG LeaseLifetime;
+} IP_ADAPTER_UNICAST_ADDRESS_XP, *PIP_ADAPTER_UNICAST_ADDRESS_XP;
+
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+typedef IP_ADAPTER_UNICAST_ADDRESS_LH IP_ADAPTER_UNICAST_ADDRESS;
+typedef IP_ADAPTER_UNICAST_ADDRESS_LH *PIP_ADAPTER_UNICAST_ADDRESS;
+#elif (NTDDI_VERSION >= NTDDI_WINXP)
+typedef IP_ADAPTER_UNICAST_ADDRESS_XP IP_ADAPTER_UNICAST_ADDRESS;
+typedef IP_ADAPTER_UNICAST_ADDRESS_XP *PIP_ADAPTER_UNICAST_ADDRESS;
+#endif
+
+//
+// Bit values of IP_ADAPTER_UNICAST_ADDRESS Flags field.
+//
+#define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x01
+#define IP_ADAPTER_ADDRESS_TRANSIENT 0x02
+
+typedef struct _IP_ADAPTER_ANYCAST_ADDRESS_XP {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Flags;
+ };
+ };
+ struct _IP_ADAPTER_ANYCAST_ADDRESS_XP *Next;
+ SOCKET_ADDRESS Address;
+} IP_ADAPTER_ANYCAST_ADDRESS_XP, *PIP_ADAPTER_ANYCAST_ADDRESS_XP;
+#if (NTDDI_VERSION >= NTDDI_WINXP)
+typedef IP_ADAPTER_ANYCAST_ADDRESS_XP IP_ADAPTER_ANYCAST_ADDRESS;
+typedef IP_ADAPTER_ANYCAST_ADDRESS_XP *PIP_ADAPTER_ANYCAST_ADDRESS;
+#endif
+
+typedef struct _IP_ADAPTER_MULTICAST_ADDRESS_XP {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Flags;
+ };
+ };
+ struct _IP_ADAPTER_MULTICAST_ADDRESS_XP *Next;
+ SOCKET_ADDRESS Address;
+} IP_ADAPTER_MULTICAST_ADDRESS_XP, *PIP_ADAPTER_MULTICAST_ADDRESS_XP;
+#if (NTDDI_VERSION >= NTDDI_WINXP)
+typedef IP_ADAPTER_MULTICAST_ADDRESS_XP IP_ADAPTER_MULTICAST_ADDRESS;
+typedef IP_ADAPTER_MULTICAST_ADDRESS_XP *PIP_ADAPTER_MULTICAST_ADDRESS;
+#endif
+
+typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS_XP {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Reserved;
+ };
+ };
+ struct _IP_ADAPTER_DNS_SERVER_ADDRESS_XP *Next;
+ SOCKET_ADDRESS Address;
+} IP_ADAPTER_DNS_SERVER_ADDRESS_XP, *PIP_ADAPTER_DNS_SERVER_ADDRESS_XP;
+#if (NTDDI_VERSION >= NTDDI_WINXP)
+typedef IP_ADAPTER_DNS_SERVER_ADDRESS_XP IP_ADAPTER_DNS_SERVER_ADDRESS;
+typedef IP_ADAPTER_DNS_SERVER_ADDRESS_XP *PIP_ADAPTER_DNS_SERVER_ADDRESS;
+#endif
+
+typedef struct _IP_ADAPTER_WINS_SERVER_ADDRESS_LH {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Reserved;
+ };
+ };
+ struct _IP_ADAPTER_WINS_SERVER_ADDRESS_LH *Next;
+ SOCKET_ADDRESS Address;
+} IP_ADAPTER_WINS_SERVER_ADDRESS_LH, *PIP_ADAPTER_WINS_SERVER_ADDRESS_LH;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+typedef IP_ADAPTER_WINS_SERVER_ADDRESS_LH IP_ADAPTER_WINS_SERVER_ADDRESS;
+typedef IP_ADAPTER_WINS_SERVER_ADDRESS_LH *PIP_ADAPTER_WINS_SERVER_ADDRESS;
+#endif
+
+
+typedef struct _IP_ADAPTER_GATEWAY_ADDRESS_LH {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Reserved;
+ };
+ };
+ struct _IP_ADAPTER_GATEWAY_ADDRESS_LH *Next;
+ SOCKET_ADDRESS Address;
+} IP_ADAPTER_GATEWAY_ADDRESS_LH, *PIP_ADAPTER_GATEWAY_ADDRESS_LH;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+typedef IP_ADAPTER_GATEWAY_ADDRESS_LH IP_ADAPTER_GATEWAY_ADDRESS;
+typedef IP_ADAPTER_GATEWAY_ADDRESS_LH *PIP_ADAPTER_GATEWAY_ADDRESS;
+#endif
+
+typedef struct _IP_ADAPTER_PREFIX_XP {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Flags;
+ };
+ };
+ struct _IP_ADAPTER_PREFIX_XP *Next;
+ SOCKET_ADDRESS Address;
+ ULONG PrefixLength;
+} IP_ADAPTER_PREFIX_XP, *PIP_ADAPTER_PREFIX_XP;
+#if (NTDDI_VERSION >= NTDDI_WINXP)
+typedef IP_ADAPTER_PREFIX_XP IP_ADAPTER_PREFIX;
+typedef IP_ADAPTER_PREFIX_XP *PIP_ADAPTER_PREFIX;
+#endif
+
+//
+// Bit values of IP_ADAPTER_ADDRESSES Flags field.
+//
+#define IP_ADAPTER_DDNS_ENABLED 0x00000001
+#define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX 0x00000002
+#define IP_ADAPTER_DHCP_ENABLED 0x00000004
+#define IP_ADAPTER_RECEIVE_ONLY 0x00000008
+#define IP_ADAPTER_NO_MULTICAST 0x00000010
+#define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x00000020
+#define IP_ADAPTER_NETBIOS_OVER_TCPIP_ENABLED 0x00000040
+#define IP_ADAPTER_IPV4_ENABLED 0x00000080
+#define IP_ADAPTER_IPV6_ENABLED 0x00000100
+
+typedef struct _IP_ADAPTER_ADDRESSES_LH {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ IF_INDEX IfIndex;
+ };
+ };
+ struct _IP_ADAPTER_ADDRESSES_LH *Next;
+ PCHAR AdapterName;
+ PIP_ADAPTER_UNICAST_ADDRESS_LH FirstUnicastAddress;
+ PIP_ADAPTER_ANYCAST_ADDRESS_XP FirstAnycastAddress;
+ PIP_ADAPTER_MULTICAST_ADDRESS_XP FirstMulticastAddress;
+ PIP_ADAPTER_DNS_SERVER_ADDRESS_XP FirstDnsServerAddress;
+ PWCHAR DnsSuffix;
+ PWCHAR Description;
+ PWCHAR FriendlyName;
+ BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
+ ULONG PhysicalAddressLength;
+ union {
+ ULONG Flags;
+ struct {
+ ULONG DdnsEnabled : 1;
+ ULONG RegisterAdapterSuffix : 1;
+ ULONG Dhcpv4Enabled : 1;
+ ULONG ReceiveOnly : 1;
+ ULONG NoMulticast : 1;
+ ULONG Ipv6OtherStatefulConfig : 1;
+ ULONG NetbiosOverTcpipEnabled : 1;
+ ULONG Ipv4Enabled : 1;
+ ULONG Ipv6Enabled : 1;
+ ULONG Ipv6ManagedAddressConfigurationSupported : 1;
+ };
+ };
+ ULONG Mtu;
+ IFTYPE IfType;
+ IF_OPER_STATUS OperStatus;
+ IF_INDEX Ipv6IfIndex;
+ ULONG ZoneIndices[16];
+ PIP_ADAPTER_PREFIX_XP FirstPrefix;
+
+ ULONG64 TransmitLinkSpeed;
+ ULONG64 ReceiveLinkSpeed;
+ PIP_ADAPTER_WINS_SERVER_ADDRESS_LH FirstWinsServerAddress;
+ PIP_ADAPTER_GATEWAY_ADDRESS_LH FirstGatewayAddress;
+ ULONG Ipv4Metric;
+ ULONG Ipv6Metric;
+ IF_LUID Luid;
+ SOCKET_ADDRESS Dhcpv4Server;
+ NET_IF_COMPARTMENT_ID CompartmentId;
+ NET_IF_NETWORK_GUID NetworkGuid;
+ NET_IF_CONNECTION_TYPE ConnectionType;
+ TUNNEL_TYPE TunnelType;
+ //
+ // DHCP v6 Info.
+ //
+ SOCKET_ADDRESS Dhcpv6Server;
+ BYTE Dhcpv6ClientDuid[MAX_DHCPV6_DUID_LENGTH];
+ ULONG Dhcpv6ClientDuidLength;
+ ULONG Dhcpv6Iaid;
+} IP_ADAPTER_ADDRESSES_LH,
+ *PIP_ADAPTER_ADDRESSES_LH;
+
+typedef struct _IP_ADAPTER_ADDRESSES_XP {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD IfIndex;
+ };
+ };
+ struct _IP_ADAPTER_ADDRESSES_XP *Next;
+ PCHAR AdapterName;
+ PIP_ADAPTER_UNICAST_ADDRESS_XP FirstUnicastAddress;
+ PIP_ADAPTER_ANYCAST_ADDRESS_XP FirstAnycastAddress;
+ PIP_ADAPTER_MULTICAST_ADDRESS_XP FirstMulticastAddress;
+ PIP_ADAPTER_DNS_SERVER_ADDRESS_XP FirstDnsServerAddress;
+ PWCHAR DnsSuffix;
+ PWCHAR Description;
+ PWCHAR FriendlyName;
+ BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
+ DWORD PhysicalAddressLength;
+ DWORD Flags;
+ DWORD Mtu;
+ DWORD IfType;
+ IF_OPER_STATUS OperStatus;
+ DWORD Ipv6IfIndex;
+ DWORD ZoneIndices[16];
+ PIP_ADAPTER_PREFIX_XP FirstPrefix;
+} IP_ADAPTER_ADDRESSES_XP,
+ *PIP_ADAPTER_ADDRESSES_XP;
+
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+typedef IP_ADAPTER_ADDRESSES_LH IP_ADAPTER_ADDRESSES;
+typedef IP_ADAPTER_ADDRESSES_LH *PIP_ADAPTER_ADDRESSES;
+#elif (NTDDI_VERSION >= NTDDI_WINXP)
+typedef IP_ADAPTER_ADDRESSES_XP IP_ADAPTER_ADDRESSES;
+typedef IP_ADAPTER_ADDRESSES_XP *PIP_ADAPTER_ADDRESSES;
+#else
+//
+// For platforms other platforms that are including
+// the file but not using the types.
+//
+typedef IP_ADAPTER_ADDRESSES_XP IP_ADAPTER_ADDRESSES;
+typedef IP_ADAPTER_ADDRESSES_XP *PIP_ADAPTER_ADDRESSES;
+#endif
+
+
+//
+// Flags used as argument to GetAdaptersAddresses().
+// "SKIP" flags are added when the default is to include the information.
+// "INCLUDE" flags are added when the default is to skip the information.
+//
+#define GAA_FLAG_SKIP_UNICAST 0x0001
+#define GAA_FLAG_SKIP_ANYCAST 0x0002
+#define GAA_FLAG_SKIP_MULTICAST 0x0004
+#define GAA_FLAG_SKIP_DNS_SERVER 0x0008
+#define GAA_FLAG_INCLUDE_PREFIX 0x0010
+#define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020
+#define GAA_FLAG_INCLUDE_WINS_INFO 0x0040
+#define GAA_FLAG_INCLUDE_GATEWAYS 0x0080
+#define GAA_FLAG_INCLUDE_ALL_INTERFACES 0x0100
+#define GAA_FLAG_INCLUDE_ALL_COMPARTMENTS 0x0200
+#define GAA_FLAG_INCLUDE_TUNNEL_BINDINGORDER 0x0400
+
+#endif /* _WINSOCK2API_ */
+/* +++++++++++++++++++++++ from iptypes.h */
+
+
+/* +++++++++++++++++++++++ from iphlpapi.h */
+#ifdef _WINSOCK2API_
+
+//
+// The following functions require Winsock2.
+//
+
+ULONG
+WINAPI
+GetAdaptersAddresses(
+ IN ULONG Family,
+ IN ULONG Flags,
+ IN PVOID Reserved,
+ __out_bcount_opt(*SizePointer) PIP_ADAPTER_ADDRESSES AdapterAddresses,
+ IN OUT PULONG SizePointer
+ );
+
+#endif
+/* +++++++++++++++++++++++ from iphlpapi.h */
+
+#pragma warning(pop)
+#endif /* !_W64 */
+#endif /* GAA_COMPAT_H */
diff --git a/ports/winnt/include/hopf_PCI_io.h b/ports/winnt/include/hopf_PCI_io.h
new file mode 100644
index 000000000000..7bca1d3f57c9
--- /dev/null
+++ b/ports/winnt/include/hopf_PCI_io.h
@@ -0,0 +1,91 @@
+/*
+ * hopf_PCI_io.h
+ * structur definition and prototype Function declarations
+ *
+ * Date: 21.03.2000 Revision: 01.10
+ *
+ * Copyright (C) 1999, 2000 by Bernd Altmeier altmeier@ATLSoft.de
+ *
+ */
+
+#if defined(__cplusplus)
+extern "C"{
+#endif
+
+#ifndef __inpREAD_H
+#define __inpREAD_H
+
+
+typedef struct _CLOCKVER {
+ CHAR cVersion[255];
+} CLOCKVER, *PCLOCKVER, *LPCLOCKVER;
+
+typedef struct _HOPFTIME {
+ WORD wYear;
+ WORD wMonth;
+ WORD wDayOfWeek;
+ WORD wDay;
+ WORD wHour;
+ WORD wMinute;
+ WORD wSecond;
+ WORD wMilliseconds;
+ WORD wStatus;
+} HOPFTIME, *PHOPFTIME, *LPHOPFTIME;
+
+typedef struct _SATSTAT {
+ BYTE wVisible;
+ BYTE wMode;
+ BYTE wSat0;
+ BYTE wRat0;
+ BYTE wSat1;
+ BYTE wRat1;
+ BYTE wSat2;
+ BYTE wRat2;
+ BYTE wSat3;
+ BYTE wRat3;
+ BYTE wSat4;
+ BYTE wRat4;
+ BYTE wSat5;
+ BYTE wRat5;
+ BYTE wSat6;
+ BYTE wRat6;
+ BYTE wSat7;
+ BYTE wRat7;
+} SATSTAT, *PSATSTAT, *LPSATSTAT;
+
+
+typedef struct _GPSPOS {
+ LONG wAltitude; // Höhe immer 0
+ LONG wLongitude; // Länge in Msec
+ LONG wLatitude; // Breite in Msec
+} GPSPOS, *PGPSPOS, *LPGPSPOS;
+
+
+typedef struct _DCFANTENNE {
+ BYTE bStatus;
+ BYTE bStatus1;
+ WORD wAntValue;
+} DCFANTENNE, *PDCFANTENNE, *LPDCFANTENNE;
+
+
+
+// Function declarations
+BOOL OpenHopfDevice();
+BOOL CloseHopfDevice();
+VOID GetHopfTime(LPHOPFTIME Data, DWORD Offset);
+VOID GetHopfLocalTime(LPHOPFTIME Data);
+VOID GetHopfSystemTime(LPHOPFTIME Data);
+VOID GetSatData(LPSATSTAT Data);
+VOID GetDiffTime(LPLONG Data);
+VOID GetPosition(LPGPSPOS Data);
+VOID GetHardwareVersion(LPCLOCKVER Data);
+VOID GetHardwareData(LPDWORD Data,WORD Ofs);
+VOID GetDCFAntenne(LPDCFANTENNE Data);
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* inpREAD_H */
+
diff --git a/ports/winnt/include/netdb.h b/ports/winnt/include/netdb.h
new file mode 100644
index 000000000000..5e1599737300
--- /dev/null
+++ b/ports/winnt/include/netdb.h
@@ -0,0 +1,4 @@
+/**************************************************************
+ * Dummy Header for Unix to Windows NT portability
+ * Created for NTP package
+ **************************************************************/
diff --git a/ports/winnt/include/ntp_iocompletionport.h b/ports/winnt/include/ntp_iocompletionport.h
new file mode 100644
index 000000000000..7d7ff7c4b207
--- /dev/null
+++ b/ports/winnt/include/ntp_iocompletionport.h
@@ -0,0 +1,27 @@
+#if !defined __ntp_iocompletionport_h
+# define __ntp_iocompletionport_h
+
+#include "ntp_fp.h"
+#include "ntp.h"
+#include "clockstuff.h"
+#include "ntp_worker.h"
+
+# if defined(HAVE_IO_COMPLETION_PORT)
+
+extern void init_io_completion_port(void);
+extern void uninit_io_completion_port(void);
+
+extern int io_completion_port_add_socket(SOCKET fd, struct interface *);
+
+struct refclockio; /* in ntp_refclock.h but inclusion here triggers problems */
+extern int io_completion_port_add_clock_io(struct refclockio *rio);
+extern void io_completion_port_remove_clock_io(struct refclockio *rio);
+extern int io_completion_port_sendto(int, void *, size_t, sockaddr_u *);
+
+extern int GetReceivedBuffers(void);
+
+extern HANDLE WaitableExitEventHandle;
+
+# endif
+
+#endif
diff --git a/ports/winnt/include/ntp_timer.h b/ports/winnt/include/ntp_timer.h
new file mode 100644
index 000000000000..15328a67a123
--- /dev/null
+++ b/ports/winnt/include/ntp_timer.h
@@ -0,0 +1,6 @@
+#ifndef NTP_TIMER_H
+#define NTP_TIMER_H
+
+extern void timer_clr_stats(void);
+
+#endif /* NTP_TIMER_H */
diff --git a/ports/winnt/include/ntservice.h b/ports/winnt/include/ntservice.h
new file mode 100644
index 000000000000..f44335fdb3b9
--- /dev/null
+++ b/ports/winnt/include/ntservice.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 1999-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef NTSERVICE_H
+#define NTSERVICE_H
+
+#define NTP_DISPLAY_NAME "NetworkTimeProtocol"
+#define NTP_SERVICE_NAME "ntpd"
+
+void ntservice_init(void);
+void UpdateSCM(DWORD);
+void WINAPI ServiceControl(DWORD dwCtrlCode);
+void ntservice_shutdown(void);
+BOOL ntservice_systemisshuttingdown(void);
+BOOL WINAPI OnConsoleEvent(DWORD dwCtrlType);
+
+#endif /* NTSERVICE_H */
diff --git a/ports/winnt/include/stdint.h b/ports/winnt/include/stdint.h
new file mode 100644
index 000000000000..4040c24f0f84
--- /dev/null
+++ b/ports/winnt/include/stdint.h
@@ -0,0 +1,244 @@
+/*
+ * stdint_msvc.h - C99 integer types for older Visual C compilers
+ *
+ * Written by Juergen Perlinger (perlinger@ntp.org) for the NTP project.
+ * The contents of 'html/copyright.html' apply.
+ *
+ * ----------------------------------------------------------------------
+ *
+ * Fairly straight forward implementation of the C99 standard integer
+ * types.
+ */
+
+#ifndef __STDINT_INCLUDED
+#define __STDINT_INCLUDED
+
+#if !defined(_MSC_VER) || _MSC_VER >= 1800
+# error Use only with MSVC6 - MSVC11(VS2012)
+#endif
+
+#include
+#include
+
+/* ---------------------------------------------------------------------
+ * We declare the min/max values, using the MSVC syntax for literals of
+ * a given bit width.
+ */
+
+#define _VC_SI_LIT(lit,wbit) (lit ## i ## wbit)
+#define _VC_UI_LIT(lit,wbit) (lit ## ui ## wbit)
+
+/* ---------------------------------------------------------------------
+ * Exact width integer types
+ */
+typedef __int8 int8_t;
+typedef __int16 int16_t;
+typedef __int32 int32_t;
+typedef __int64 int64_t;
+
+typedef unsigned __int8 uint8_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+# define INT8_MIN _I8_MIN
+# define INT8_MAX _I8_MAX
+# define UINT8_MAX _UI8_MAX
+# define INT16_MIN _I16_MIN
+# define INT16_MAX _I16_MAX
+# define UINT16_MAX _UI16_MAX
+# define INT32_MIN _I32_MIN
+# define INT32_MAX _I32_MAX
+# define UINT32_MAX _UI32_MAX
+# define INT64_MIN _I64_MIN
+# define INT64_MAX _I64_MAX
+# define UINT64_MAX _UI64_MAX
+#endif
+
+/* ---------------------------------------------------------------------
+ * Least-size integers
+ *
+ * These are mapped to exact size.
+ */
+typedef __int8 int_least8_t;
+typedef __int16 int_least16_t;
+typedef __int32 int_least32_t;
+typedef __int64 int_least64_t;
+
+typedef unsigned __int8 uint_least8_t;
+typedef unsigned __int16 uint_least16_t;
+typedef unsigned __int32 uint_least32_t;
+typedef unsigned __int64 uint_least64_t;
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+#define INT_LEAST8_MIN _I8_MIN
+#define INT_LEAST8_MAX _I8_MAX
+#define UINT_LEAST8_MAX _UI8_MAX
+#define INT_LEAST16_MIN _I16_MIN
+#define INT_LEAST16_MAX _I16_MAX
+#define UINT_LEAST16_MAX _UI16_MAX
+#define INT_LEAST32_MIN _I32_MIN
+#define INT_LEAST32_MAX _I32_MAX
+#define UINT_LEAST32_MAX _UI32_MAX
+#define INT_LEAST64_MIN _I64_MIN
+#define INT_LEAST64_MAX _I64_MAX
+#define UINT_LEAST64_MAX _UI64_MAX
+#endif
+
+/* ---------------------------------------------------------------------
+ * least-size, fastest integer
+ *
+ * The 'FAST' types are all 32 bits, except the 64 bit quantity; as the
+ * natural register width is 32 bits, quantities of that size are fastest
+ * to operate on naturally. (This even holds for the x86_64; MSVC uses
+ * the 'llp64' model.
+ */
+typedef __int32 int_fast8_t;
+typedef __int32 int_fast16_t;
+typedef __int32 int_fast32_t;
+typedef __int64 int_fast64_t;
+
+typedef unsigned __int32 uint_fast8_t;
+typedef unsigned __int32 uint_fast16_t;
+typedef unsigned __int32 uint_fast32_t;
+typedef unsigned __int64 uint_fast64_t;
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+#define INT_FAST8_MIN _I32_MIN
+#define INT_FAST8_MAX _I32_MAX
+#define UINT_FAST8_MAX _UI32_MAX
+#define INT_FAST16_MIN _I32_MIN
+#define INT_FAST16_MAX _I32_MAX
+#define UINT_FAST16_MAX _UI32_MAX
+#define INT_FAST32_MIN _I32_MIN
+#define INT_FAST32_MAX _I32_MAX
+#define UINT_FAST32_MAX _UI32_MAX
+#define INT_FAST64_MIN _I64_MIN
+#define INT_FAST64_MAX _I64_MAX
+#define UINT_FAST64_MAX _UI64_MAX
+#endif
+
+/* ---------------------------------------------------------------------
+ * The (u)intptr_t, ptrdiff_t and size_t definitions depend on the
+ * target: 32bit for x86, and 64bit for x64, aka amd64. Well, we
+ * have to bite the bullet.
+ */
+
+/* ------------------------------------------------------------------ */
+# if defined(_WIN64) || defined(WIN64)
+/* ------------------------------------------------------------------ */
+
+# ifndef _INTPTR_T_DEFINED
+# define _INTPTR_T_DEFINED
+ typedef __int64 intptr_t;
+# endif
+
+# ifndef _UINTPTR_T_DEFINED
+# define _UINTPTR_T_DEFINED
+ typedef unsigned __int64 uintptr_t;
+# endif
+
+# ifndef _PTRDIFF_T_DEFINED
+# define _PTRDIFF_T_DEFINED
+ typedef __int64 ptrdiff_t;
+# endif
+
+# if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+# ifndef INTPTR_MIN
+# define INTPTR_MIN _I64_MIN
+# endif
+# ifndef INTPTR_MAX
+# define INTPTR_MAX _I64_MAX
+# endif
+# ifndef UINTPTR_MAX
+# define UINTPTR_MAX _UI64_MAX
+# endif
+# ifndef PTRDIFF_MIN
+# define PTRDIFF_MIN _I64_MIN
+# endif
+# ifndef PTRDIFF_MAX
+# define PTRDIFF_MAX _I64_MAX
+# endif
+# endif
+
+/* ------------------------------------------------------------------ */
+#else /* 32 bit target assumed here! */
+/* ------------------------------------------------------------------ */
+
+# ifndef _INTPTR_T_DEFINED
+# define _INTPTR_T_DEFINED
+ typedef __int32 intptr_t;
+# endif
+
+# ifndef _UINTPTR_T_DEFINED
+# define _UINTPTR_T_DEFINED
+ typedef unsigned __int32 uintptr_t;
+# endif
+
+# ifndef _PTRDIFF_T_DEFINED
+# define _PTRDIFF_T_DEFINED
+ typedef __int64 ptrdiff_t;
+# endif
+
+# if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+# ifndef INTPTR_MIN
+# define INTPTR_MIN _I32_MIN
+# endif
+# ifndef INTPTR_MAX
+# define INTPTR_MAX _I32_MAX
+# endif
+# ifndef UINTPTR_MAX
+# define UINTPTR_MAX _UI32_MAX
+# endif
+# ifndef PTRDIFF_MIN
+# define PTRDIFF_MIN _I32_MIN
+# endif
+# ifndef PTRDIFF_MAX
+# define PTRDIFF_MAX _I32_MAX
+# endif
+# endif
+#endif /* platform dependent stuff */
+
+
+/* ---------------------------------------------------------------------
+ * max integer is 64-bit integer
+ */
+typedef __int64 intmax_t;
+typedef unsigned __int64 uintmax_t;
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+# define INTMAX_MIN _I64_MIN
+# define INTMAX_MAX _I64_MAX
+# define UINTMAX_MAX _UI64_MAX
+#endif
+
+/* ---------------------------------------------------------------------
+ * limit for size_t (older MSVC versions lack that one)
+ */
+#if _MSC_VER <=1200
+# if defined(_WIN64) || defined(WIN64)
+# define SIZE_MAX _UI64_MAX
+#else
+# define SIZE_MAX _UI32_MAX
+# endif
+#endif
+
+/* ---------------------------------------------------------------------
+ * construct numerical literals with precise size
+ */
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
+# define INT8_C(lit) _VC_SI_LIT(lit,8)
+# define UINT8_C(lit) _VC_UI_LIT(lit,8)
+# define INT16_C(lit) _VC_SI_LIT(lit,16)
+# define UINT16_C(lit) _VC_UI_LIT(lit,16)
+# define INT32_C(lit) _VC_SI_LIT(lit,32)
+# define UINT32_C(lit) _VC_UI_LIT(lit,32)
+# define INT64_C(lit) _VC_SI_LIT(lit,64)
+# define UINT64_C(lit) _VC_UI_LIT(lit,64)
+# define INTMAX_C(lit) _VC_SI_LIT(lit,64)
+# define UINTMAX_C(lit) _VC_UI_LIT(lit,64)
+#endif
+
+#endif
+/**** EOF ****/
diff --git a/ports/winnt/include/stdnoreturn.h b/ports/winnt/include/stdnoreturn.h
new file mode 100644
index 000000000000..65702e012026
--- /dev/null
+++ b/ports/winnt/include/stdnoreturn.h
@@ -0,0 +1,61 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* A substitute for ISO C11 .
+
+ Copyright 2012-2014 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see . */
+
+/* Written by Paul Eggert. */
+
+#ifndef noreturn
+
+/* ISO C11 for platforms that lack it.
+
+ References:
+ ISO C11 (latest free draft
+ )
+ section 7.23 */
+
+/* The definition of _Noreturn is copied here. */
+#if !defined _Noreturn && __STDC_VERSION__ < 201112
+# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
+ || 0x5110 <= __SUNPRO_C)
+# define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn
+# endif
+#endif
+
+#if 1200 <= _MSC_VER
+/* Standard include files on this platform contain declarations like
+ "__declspec (noreturn) void abort (void);". "#define noreturn
+ _Noreturn" would cause this declaration to be rewritten to the
+ invalid "__declspec (__declspec (noreturn)) void abort (void);".
+ Instead, define noreturn to empty, so that such declarations are
+ rewritten to "__declspec () void abort (void);", which is
+ equivalent to "void abort (void);"; this gives up on noreturn's
+ advice to the compiler but at least it is valid code. */
+# define noreturn /*empty*/
+#else
+# define noreturn _Noreturn
+#endif
+
+/* Did he ever return?
+ No he never returned
+ And his fate is still unlearn'd ...
+ -- Steiner J, Hawes BL. M.T.A. (1949) */
+
+#endif /* noreturn */
diff --git a/ports/winnt/include/sys/ioctl.h b/ports/winnt/include/sys/ioctl.h
new file mode 100644
index 000000000000..6f4b07691661
--- /dev/null
+++ b/ports/winnt/include/sys/ioctl.h
@@ -0,0 +1,11 @@
+/**************************************************************
+ * Dummy Header for Unix to Windows NT portability
+ * Created for NTP package
+ **************************************************************/
+
+#ifndef _IOCTL_H
+#define _IOCTL_H
+
+#include "win32_io.h"
+
+#endif
\ No newline at end of file
diff --git a/ports/winnt/include/sys/param.h b/ports/winnt/include/sys/param.h
new file mode 100644
index 000000000000..5e1599737300
--- /dev/null
+++ b/ports/winnt/include/sys/param.h
@@ -0,0 +1,4 @@
+/**************************************************************
+ * Dummy Header for Unix to Windows NT portability
+ * Created for NTP package
+ **************************************************************/
diff --git a/ports/winnt/include/sys/resource.h b/ports/winnt/include/sys/resource.h
new file mode 100644
index 000000000000..01f4c810ff7f
--- /dev/null
+++ b/ports/winnt/include/sys/resource.h
@@ -0,0 +1,10 @@
+/*
+ * ports/winnt/include/sys/resource.h
+ *
+ * routines declared in Unix systems' sys/resource.h
+ */
+
+#define PRIO_PROCESS 0
+#define NTP_PRIO (-12)
+
+int setpriority(int, int, int); /* winnt\libntp\setpriority.c */
diff --git a/ports/winnt/include/sys/signal.h b/ports/winnt/include/sys/signal.h
new file mode 100644
index 000000000000..5e1599737300
--- /dev/null
+++ b/ports/winnt/include/sys/signal.h
@@ -0,0 +1,4 @@
+/**************************************************************
+ * Dummy Header for Unix to Windows NT portability
+ * Created for NTP package
+ **************************************************************/
diff --git a/ports/winnt/include/sys/time.h b/ports/winnt/include/sys/time.h
new file mode 100644
index 000000000000..b4489170bea0
--- /dev/null
+++ b/ports/winnt/include/sys/time.h
@@ -0,0 +1,25 @@
+/*
+ * ports/winnt/include/sys/time.h
+ *
+ * routines declared in Unix systems' sys/time.h
+ */
+
+#ifndef SYS_TIME_H
+#define SYS_TIME_H
+
+#include "ntp_types.h"
+#include
+#include
+
+typedef struct timespec {
+ time_t tv_sec;
+ long tv_nsec;
+} timespec_t;
+
+#define TIMEOFDAY 0 /* getclock() clktyp arg */
+extern int getclock(int, struct timespec *ts);
+extern int gettimeofday(struct timeval *, void *);
+extern int settimeofday(struct timeval *);
+extern void init_win_precise_time(void);
+
+#endif /* SYS_TIME_H */
diff --git a/ports/winnt/include/sys/wait.h b/ports/winnt/include/sys/wait.h
new file mode 100644
index 000000000000..5e1599737300
--- /dev/null
+++ b/ports/winnt/include/sys/wait.h
@@ -0,0 +1,4 @@
+/**************************************************************
+ * Dummy Header for Unix to Windows NT portability
+ * Created for NTP package
+ **************************************************************/
diff --git a/ports/winnt/include/syslog.h b/ports/winnt/include/syslog.h
new file mode 100644
index 000000000000..5cbf30a00a13
--- /dev/null
+++ b/ports/winnt/include/syslog.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* From BIND 9 lib/isc/include/isc/: syslog.h,v 1.4 2002/08/01 03:43:31 mayer */
+
+#ifndef _SYSLOG_H
+#define _SYSLOG_H
+
+#include
+
+/* Constant definitions for openlog() */
+#define LOG_PID 1
+#define LOG_CONS 2
+/* NT event log does not support facility level */
+#define LOG_KERN 0
+#define LOG_USER 0
+#define LOG_MAIL 0
+#define LOG_DAEMON 0
+#define LOG_AUTH 0
+#define LOG_SYSLOG 0
+#define LOG_LPR 0
+#define LOG_LOCAL0 0
+#define LOG_LOCAL1 0
+#define LOG_LOCAL2 0
+#define LOG_LOCAL3 0
+#define LOG_LOCAL4 0
+#define LOG_LOCAL5 0
+#define LOG_LOCAL6 0
+#define LOG_LOCAL7 0
+
+#define LOG_EMERG 0 /* system is unusable */
+#define LOG_ALERT 1 /* action must be taken immediately */
+#define LOG_CRIT 2 /* critical conditions */
+#define LOG_ERR 3 /* error conditions */
+#define LOG_WARNING 4 /* warning conditions */
+#define LOG_NOTICE 5 /* normal but signification condition */
+#define LOG_INFO 6 /* informational */
+#define LOG_DEBUG 7 /* debug-level messages */
+
+/*
+ * These are ignored on NT
+ */
+#define LOG_NDELAY 0 /* Open the connection to syslogd immediately */
+
+#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */
+
+void
+syslog(int level, const char *fmt, ...);
+
+void
+openlog(const char *, int, ...);
+
+void
+closelog(void);
+
+void
+ModifyLogLevel(int level);
+
+int
+setlogmask(int maskpri);
+
+void
+InitNTLogging(FILE *, int);
+
+void
+NTReportError(const char *, const char *);
+
+#endif
diff --git a/ports/winnt/include/termios.h b/ports/winnt/include/termios.h
new file mode 100644
index 000000000000..9c1cc625cd40
--- /dev/null
+++ b/ports/winnt/include/termios.h
@@ -0,0 +1,214 @@
+#ifndef NTP_WIN_TERMIOS_H
+#define NTP_WIN_TERMIOS_H
+
+/* Flag definitions for compatibility
+ * ==================================
+*/
+
+#include
+
+#define NCCS 18 /* refclock_arc.c uses VTIME (17) */
+#define VEOL 3
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+struct termios
+{
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_line; /* line discipline */
+ cc_t c_cc[NCCS]; /* control characters */
+ speed_t c_ispeed; /* input speed */
+ speed_t c_ospeed; /* output speed */
+};
+
+/* c_cc characters
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VTIME 5
+#define VMIN 6
+#define VSWTC 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VEOL 11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOL2 16
+*/
+
+/* c_iflag bits */
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IUCLC 0001000
+#define IXON 0002000
+#define IXANY 0004000
+#define IXOFF 0010000
+#define IMAXBEL 0020000
+
+/* c_oflag bits */
+#define OPOST 0000001
+#define OLCUC 0000002
+#define ONLCR 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+
+#define NLDLY 0000400
+#define NL0 0000000
+#define NL1 0000400
+
+#define CRDLY 0003000
+#define CR0 0000000
+#define CR1 0001000
+#define CR2 0002000
+#define CR3 0003000
+
+#define TABDLY 0014000
+#define TAB0 0000000
+#define TAB1 0004000
+#define TAB2 0010000
+#define TAB3 0014000
+#define XTABS 0014000
+
+#define BSDLY 0020000
+#define BS0 0000000
+#define BS1 0020000
+
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+
+#define FFDLY 0100000
+#define FF0 0000000
+#define FF1 0100000
+
+/* c_cflag bit meaning */
+#define CBAUD 0010017
+#define B0 0000000 /* hang up */
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+
+#define EXTA B19200
+#define EXTB B38400
+
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+
+#define CBAUDEX 0010000
+#define B57600 0010001
+#define B115200 0010002
+#define B230400 0010003
+#define B460800 0010004
+
+#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CRTSCTS 020000000000 /* flow control */
+
+/* c_lflag bits */
+#define ISIG 0000001
+#define ICANON 0000002
+#define XCASE 0000004
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE 0004000
+#define FLUSHO 0010000
+#define PENDIN 0040000
+#define IEXTEN 0100000
+
+/* tcflow() and TCXONC use these */
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+/* tcflush() and TCFLSH use these */
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+/* tcsetattr uses these */
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+#define VMIN 16
+#define VTIME 17
+
+/* modem lines */
+#define TIOCM_LE 0x001
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_ST 0x008
+#define TIOCM_SR 0x010
+#define TIOCM_CTS 0x020
+#define TIOCM_CAR 0x040
+#define TIOCM_RNG 0x080
+#define TIOCM_DSR 0x100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+
+/* ioctl */
+#define TIOCMGET 1
+#define TIOCMSET 2
+#define TIOCMBIC 3
+#define TIOCMBIS 4
+
+/* NOP cfsetospeed() and cfsetispeed() for now */
+#define cfsetospeed(dcb, spd) (0)
+#define cfsetispeed(dcb, spd) (0)
+
+extern int closeserial (int);
+extern int ioctl (int, int, int *);
+extern int tcsetattr (int, int, const struct termios *);
+extern int tcgetattr (int, struct termios *);
+extern int tcflush (int, int);
+extern int isserialhandle (HANDLE);
+
+#endif /* NTP_WIN_TERMIOS_H */
diff --git a/ports/winnt/include/timepps.h b/ports/winnt/include/timepps.h
new file mode 100644
index 000000000000..76b1bfada1ab
--- /dev/null
+++ b/ports/winnt/include/timepps.h
@@ -0,0 +1,811 @@
+/***********************************************************************
+ * *
+ * Copyright (c) David L. Mills 1999-2009 *
+ * *
+ * Permission to use, copy, modify, and distribute this software and *
+ * its documentation for any purpose and with or without fee is hereby *
+ * granted, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission *
+ * notice appear in supporting documentation, and that the name *
+ * University of Delaware not be used in advertising or publicity *
+ * pertaining to distribution of the software without specific, *
+ * written prior permission. The University of Delaware makes no *
+ * representations about the suitability this software for any *
+ * purpose. It is provided "as is" without express or implied *
+ * warranty. *
+ * *
+ ***********************************************************************
+ * *
+ * This header file complies with "Pulse-Per-Second API for UNIX-like *
+ * Operating Systems, Version 1.0", rfc2783. Credit is due Jeff Mogul *
+ * and Marc Brett, from whom much of this code was shamelessly stolen. *
+ * *
+ * This modified timepps.h can be used to provide a PPSAPI interface *
+ * to a machine running Windows with one or more backend provider DLLs *
+ * implementing the provider interfaces defined herein. *
+ * *
+ * This Windows version was derived by Dave Hart *
+ * from Mills' timepps-Solaris.h *
+ * *
+ ***********************************************************************
+ * *
+ * Some of this include file *
+ * Copyright (c) 1999 by Ulrich Windl, *
+ * based on code by Reg Clemens *
+ * based on code by Poul-Henning Kamp *
+ * *
+ ***********************************************************************
+ * *
+ * "THE BEER-WARE LICENSE" (Revision 42): *
+ * wrote this file. As long as you retain this *
+ * notice you can do whatever you want with this stuff. If we meet some*
+ * day, and you think this stuff is worth it, you can buy me a beer *
+ * in return. Poul-Henning Kamp *
+ * *
+ **********************************************************************/
+
+#ifndef TIMEPPS_H
+#define TIMEPPS_H
+
+#include "sys/time.h" /* in ntp ref source declares struct timespec */
+
+/*
+ * The following definitions are architecture independent
+ */
+
+#define PPS_API_VERS_1 1 /* API version number */
+#define PPS_JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
+#define PPS_NANOSECOND 1000000000L /* one nanosecond in decimal */
+#define PPS_FRAC 4294967296. /* 2^32 as a double */
+#define PPS_HECTONANOSECONDS 10000000 /* 100ns units in a second */
+#define PPS_FILETIME_1970 0x019db1ded53e8000 /* unix epoch to Windows */
+
+#define PPS_NORMALIZE(x) /* normalize timespec */ \
+ do { \
+ if ((x).tv_nsec >= PPS_NANOSECOND) { \
+ (x).tv_nsec -= PPS_NANOSECOND; \
+ (x).tv_sec++; \
+ } else if ((x).tv_nsec < 0) { \
+ (x).tv_nsec += PPS_NANOSECOND; \
+ (x).tv_sec--; \
+ } \
+ } while (0)
+
+#define PPS_TSPECTONTP(x) /* convert timespec to ntp_fp */ \
+ do { \
+ double d_frac; \
+ \
+ d_frac = ((struct timespec)&(x))->tv_nsec \
+ * PPS_FRAC / PPS_NANOSECOND; \
+ (x).integral = ((struct timespec)&(x))->tv_sec \
+ + PPS_JAN_1970; \
+ (x).fractional = (unsigned int)d_frac; \
+ if (d_frac >= PPS_FRAC) \
+ (x).integral++; \
+ } while (0)
+
+#define PPS_NTPTOTSPEC(x) /* convert ntp_fp to timespec */ \
+ do { \
+ double d_frac; \
+ \
+ /* careful, doing in place and tv_sec may be 64bit */ \
+ d_frac = (double)((ntp_fp_t *)&(x))->fractional \
+ * PPS_NANOSECOND / PPS_FRAC; \
+ (x).tv_sec = ((ntp_fp_t *)&(x))->integral \
+ - (time_t)PPS_JAN_1970; \
+ (x).tv_nsec = (long)d_frac; \
+ } while (0)
+
+
+/*
+ * Device/implementation parameters (mode)
+ */
+
+#define PPS_CAPTUREASSERT 0x01 /* capture assert events */
+#define PPS_CAPTURECLEAR 0x02 /* capture clear events */
+#define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */
+
+#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert ev. */
+#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear ev. */
+#define PPS_OFFSETBOTH 0x30 /* apply compensation for both */
+
+#define PPS_CANWAIT 0x100 /* Can we wait for an event? */
+#define PPS_CANPOLL 0x200 /* "This bit is reserved for */
+
+/*
+ * Kernel actions (mode)
+ */
+
+#define PPS_ECHOASSERT 0x40 /* feed back assert event to output */
+#define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */
+
+/*
+ * Timestamp formats (tsformat)
+ */
+
+#define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */
+#define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */
+#define PPS_TSFMT_BOTH (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)
+
+/*
+ * Kernel discipline actions (not used in Windows yet)
+ */
+
+#define PPS_KC_HARDPPS 0 /* enable kernel consumer */
+#define PPS_KC_HARDPPS_PLL 1 /* phase-lock mode */
+#define PPS_KC_HARDPPS_FLL 2 /* frequency-lock mode */
+
+/*
+ * Type definitions
+ */
+
+typedef unsigned long pps_seq_t; /* sequence number */
+
+#pragma warning(push)
+#pragma warning(disable: 201) /* nonstd extension nameless union */
+
+typedef struct ntp_fp {
+ union ntp_fp_sec {
+ unsigned int integral;
+ int s_integral;
+ };
+ unsigned int fractional;
+} ntp_fp_t; /* NTP-compatible time stamp */
+
+#pragma warning(pop)
+
+typedef union pps_timeu { /* timestamp format */
+ struct timespec tspec;
+ ntp_fp_t ntpfp;
+ unsigned long longpad[3];
+} pps_timeu_t; /* generic data type to represent time stamps */
+
+/* addition of NTP fixed-point format */
+
+#define NTPFP_M_ADD(r_i, r_f, a_i, a_f) /* r += a */ \
+ do { \
+ register u_int32 lo_tmp; \
+ register u_int32 hi_tmp; \
+ \
+ lo_tmp = ((r_f) & 0xffff) + ((a_f) & 0xffff); \
+ hi_tmp = (((r_f) >> 16) & 0xffff) + (((a_f) >> 16) & 0xffff); \
+ if (lo_tmp & 0x10000) \
+ hi_tmp++; \
+ (r_f) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); \
+ \
+ (r_i) += (a_i); \
+ if (hi_tmp & 0x10000) \
+ (r_i)++; \
+ } while (0)
+
+#define NTPFP_L_ADDS(r, a) NTPFP_M_ADD((r)->integral, (r)->fractional, \
+ (a)->s_integral, (a)->fractional)
+
+
+/*
+ * Timestamp information structure
+ */
+
+typedef struct pps_info {
+ pps_seq_t assert_sequence; /* seq. num. of assert event */
+ pps_seq_t clear_sequence; /* seq. num. of clear event */
+ pps_timeu_t assert_tu; /* time of assert event */
+ pps_timeu_t clear_tu; /* time of clear event */
+ int current_mode; /* current mode bits */
+} pps_info_t;
+
+#define assert_timestamp assert_tu.tspec
+#define clear_timestamp clear_tu.tspec
+
+#define assert_timestamp_ntpfp assert_tu.ntpfp
+#define clear_timestamp_ntpfp clear_tu.ntpfp
+
+/*
+ * Parameter structure
+ */
+
+typedef struct pps_params {
+ int api_version; /* API version # */
+ int mode; /* mode bits */
+ pps_timeu_t assert_off_tu; /* offset compensation for assert */
+ pps_timeu_t clear_off_tu; /* offset compensation for clear */
+} pps_params_t;
+
+#define assert_offset assert_off_tu.tspec
+#define clear_offset clear_off_tu.tspec
+
+#define assert_offset_ntpfp assert_off_tu.ntpfp
+#define clear_offset_ntpfp clear_off_tu.ntpfp
+
+/*
+ *------ Here begins the implementation-specific part! ------
+ */
+
+#include
+#include
+#include /* offsetof() */
+#include /* _get_osfhandle() */
+
+#ifndef EOPNOTSUPP
+#define EOPNOTSUPP 45
+#endif
+
+typedef UINT_PTR pps_handle_t; /* pps handlebars */
+
+#ifndef inline
+#define inline __inline
+#endif
+
+/*
+ * ntpd on Windows is typically distributed as a binary as few users
+ * have the tools needed to build from source. Rather than build
+ * a single timepps.h for Windows which knows how to talk to all
+ * PPS implementations frozen in time as of compiling, this timepps.h
+ * allows one or more backend providers to be used by naming a DLL
+ * which exports the provider interfaces defined here.
+ */
+typedef enum ppsapi_magic_tag {
+ PPSAPI_MAGIC_UNIT = 0x70707355, /* ppsU */
+} ppsapi_magic;
+
+typedef struct {
+ struct pps_provider_tag *provider;
+ void * context;/* provider's unit pointer */
+ ppsapi_magic magic; /* to detect invalid handles */
+ pps_params_t params; /* PPS parameters set by user */
+} pps_unit_t;
+
+typedef void (*ppps_ntp_timestamp_from_counter)(
+ ntp_fp_t *result,
+ ULONGLONG Timestamp,
+ ULONGLONG Counterstamp
+ );
+
+typedef pps_handle_t (*pcreate_pps_handle)(
+ void * prov_context
+ );
+
+/*
+ * ppsapi_prov_init() - exported by backend DLLs
+ *
+ * Return value is pps capabilities available to PPSAPI consumers
+ * via time_pps_getcaps().
+ */
+#define PPSAPI_TIMEPPS_PROV_VER 2
+
+typedef int (WINAPI *pppsapi_prov_init)(
+ int ppsapi_timepps_prov_ver,
+ pcreate_pps_handle create_pps_handle,
+ ppps_ntp_timestamp_from_counter ntp_timestamp_from_counter,
+ char * short_name_buf,
+ size_t short_name_size,
+ char * full_name_buf,
+ size_t full_name_size
+ );
+
+typedef int (WINAPI *provtime_pps_create)(
+ HANDLE winhandle, /* user device handle */
+ pps_handle_t *phandle /* returned handle */
+ );
+
+typedef int (WINAPI *provtime_pps_destroy)(
+ pps_unit_t * unit,
+ void * context
+ );
+
+typedef int (WINAPI *provtime_pps_setparams)(
+ pps_unit_t * unit,
+ void * context,
+ const pps_params_t * params
+ );
+
+typedef int (WINAPI *provtime_pps_fetch)(
+ pps_unit_t * unit,
+ void * context,
+ const int tsformat,
+ pps_info_t * pinfo,
+ const struct timespec * timeout
+ );
+
+typedef int (WINAPI *provtime_pps_kcbind)(
+ pps_unit_t * unit,
+ void * context,
+ const int kernel_consumer,
+ const int edge,
+ const int tsformat
+ );
+
+typedef struct pps_provider_tag {
+ struct pps_provider_tag *next;
+ int caps;
+ char * short_name;
+ char * full_name;
+ provtime_pps_create ptime_pps_create;
+ provtime_pps_destroy ptime_pps_destroy;
+ provtime_pps_setparams ptime_pps_setparams;
+ provtime_pps_fetch ptime_pps_fetch;
+ provtime_pps_kcbind ptime_pps_kcbind;
+} ppsapi_provider;
+
+static ppsapi_provider * g_provider_list;
+static ppsapi_provider * g_curr_provider;
+
+
+static inline pps_handle_t
+internal_create_pps_handle(
+ void * prov_context
+ )
+{
+ pps_unit_t * punit;
+
+ if (NULL == g_curr_provider) {
+ fprintf(stderr, "create_pps_handle: provider backend called me outside time_pps_create\n");
+ punit = NULL;
+ } else
+ punit = malloc(sizeof(*punit));
+ if (punit != NULL) {
+ punit->provider = g_curr_provider;
+ punit->context = prov_context;
+ punit->magic = PPSAPI_MAGIC_UNIT;
+ memset(&punit->params, 0, sizeof(punit->params));
+ }
+ return (pps_handle_t)punit;
+}
+
+static inline pps_unit_t *
+unit_from_ppsapi_handle(
+ pps_handle_t handle
+ )
+{
+ pps_unit_t *punit;
+
+ punit = (pps_unit_t *)handle;
+ if (PPSAPI_MAGIC_UNIT != punit->magic)
+ punit = NULL;
+ return punit;
+}
+
+/*
+ * ntpd on Windows only looks to errno after finding
+ * GetLastError returns NO_ERROR. To accomodate its
+ * use of msyslog in portable code such as refclock_atom.c,
+ * this implementation always clears the Windows
+ * error code using SetLastError(NO_ERROR) when
+ * returning an errno. This is also a good idea
+ * for any non-ntpd clients as they should rely only
+ * the errno for PPSAPI functions.
+ */
+#define RETURN_PPS_ERRNO(e) \
+do { \
+ SetLastError(NO_ERROR); \
+ errno = (e); \
+ return -1; \
+} while (0)
+
+
+#ifdef OWN_PPS_NTP_TIMESTAMP_FROM_COUNTER
+extern void pps_ntp_timestamp_from_counter(ntp_fp_t *, ULONGLONG, ULONGLONG);
+#else
+/*
+ * helper routine for serialpps.sys ioctl which returns
+ * performance counter "timestamp" as well as a system
+ * FILETIME timestamp. Converts one of the inputs to
+ * NTP fixed-point format.
+ *
+ * You will probably want to supply your own and #define
+ * OWN_PPS_NTP_TIMESTAMP_FROM_COUNTER, as this stub
+ * converts only the low-resolution system timestamp.
+ *
+ * When implementing a provider, use the pointer to this
+ * conversion function supplied to your prov_init(), as
+ * the copy in your DLL will likely be the stub below,
+ * where you want the one provided by the PPSAPI client
+ * such as ntpd.
+ */
+static inline void
+pps_ntp_timestamp_from_counter(
+ ntp_fp_t *result,
+ ULONGLONG Timestamp,
+ ULONGLONG Counterstamp)
+{
+ ULONGLONG BiasedTimestamp;
+
+ /* convert from 100ns units to NTP fixed point format */
+
+ BiasedTimestamp = Timestamp - PPS_FILETIME_1970;
+ result->integral = PPS_JAN_1970 +
+ (unsigned)(BiasedTimestamp / PPS_HECTONANOSECONDS);
+ result->fractional =
+ (unsigned) ((BiasedTimestamp % PPS_HECTONANOSECONDS) *
+ (PPS_FRAC / PPS_HECTONANOSECONDS));
+}
+#endif
+
+
+static inline int
+load_pps_provider(
+ char * dllpath
+ )
+{
+ char short_name[16];
+ char full_name[64];
+ ppsapi_provider * prov;
+ HMODULE hmod;
+ pppsapi_prov_init pprov_init;
+
+ prov = malloc(sizeof(*prov));
+ if (NULL == prov)
+ return ENOMEM;
+
+ hmod = LoadLibrary(dllpath);
+ if (NULL == hmod) {
+ fprintf(stderr, "load_pps_provider: LoadLibrary(%s) error %u\n", dllpath, GetLastError());
+ free(prov);
+ return ENOENT;
+ }
+
+ pprov_init = (pppsapi_prov_init)GetProcAddress(hmod, "ppsapi_prov_init");
+ if (NULL == pprov_init) {
+ fprintf(stderr, "load_pps_provider: entrypoint ppsapi_prov_init not found in %s\n", dllpath);
+ free(prov);
+ FreeLibrary(hmod);
+ return EFAULT;
+ }
+
+ prov->caps = (*pprov_init)(PPSAPI_TIMEPPS_PROV_VER,
+ &internal_create_pps_handle,
+ &pps_ntp_timestamp_from_counter,
+ short_name, sizeof(short_name),
+ full_name, sizeof(full_name));
+
+ if (!prov->caps) {
+ free(prov);
+ FreeLibrary(hmod);
+ return EACCES;
+ }
+
+ prov->short_name = _strdup(short_name);
+ prov->full_name = _strdup(full_name);
+
+ if (NULL == prov->short_name || !prov->short_name[0]
+ || NULL == prov->full_name || !prov->full_name[0]) {
+
+ if (prov->short_name)
+ free(prov->short_name);
+ if (prov->full_name)
+ free(prov->full_name);
+ free(prov);
+ FreeLibrary(hmod);
+ return EINVAL;
+ }
+
+ prov->ptime_pps_create = (provtime_pps_create)
+ GetProcAddress(hmod, "prov_time_pps_create");
+ prov->ptime_pps_destroy = (provtime_pps_destroy)
+ GetProcAddress(hmod, "prov_time_pps_destroy");
+ prov->ptime_pps_setparams = (provtime_pps_setparams)
+ GetProcAddress(hmod, "prov_time_pps_setparams");
+ prov->ptime_pps_fetch = (provtime_pps_fetch)
+ GetProcAddress(hmod, "prov_time_pps_fetch");
+ prov->ptime_pps_kcbind = (provtime_pps_kcbind)
+ GetProcAddress(hmod, "prov_time_pps_kcbind");
+
+ if (NULL == prov->ptime_pps_create
+ || NULL == prov->ptime_pps_destroy
+ || NULL == prov->ptime_pps_setparams
+ || NULL == prov->ptime_pps_fetch
+ || NULL == prov->ptime_pps_kcbind) {
+
+ fprintf(stderr, "PPSAPI provider %s missing entrypoint\n",
+ prov->short_name);
+ free(prov->short_name);
+ free(prov->full_name);
+ free(prov);
+ FreeLibrary(hmod);
+ return EINVAL;
+ }
+
+ fprintf(stderr, "loaded PPSAPI provider %s caps 0x%x provider %p\n",
+ prov->full_name, prov->caps, prov);
+
+ prov->next = g_provider_list;
+ g_provider_list = prov;
+
+ return 0;
+}
+
+
+/*
+ * time_pps_create - create PPS handle from file descriptor
+ *
+ * This is the initial entrypoint of PPSAPI from the client. Note
+ * to maintain source compatibility with Unix, the input file
+ * descriptor really is a descriptor from the C runtime low-numbered
+ * descriptor namespace, though it may have been converted from a
+ * native Windows HANDLE using _open_osfhandle().
+ */
+static inline int
+time_pps_create(
+ int filedes,/* device file descriptor */
+ pps_handle_t * phandle /* returned handle */
+ )
+{
+ HANDLE winhandle;
+ char * dlls;
+ char * dll;
+ char * pch;
+ ppsapi_provider * prov;
+ pps_handle_t ppshandle;
+ int err;
+
+ if (NULL == phandle)
+ RETURN_PPS_ERRNO(EFAULT);
+
+ winhandle = (HANDLE)_get_osfhandle(filedes);
+ fprintf(stderr, "time_pps_create(%d) got winhandle %p\n", filedes, winhandle);
+ if (INVALID_HANDLE_VALUE == winhandle)
+ RETURN_PPS_ERRNO(EBADF);
+
+ /*
+ * For initial testing the list of PPSAPI backend
+ * providers is provided by the environment variable
+ * PPSAPI_DLLS, separated by semicolons such as
+ * PPSAPI_DLLS=c:\ntp\serial_ppsapi.dll;..\parport_ppsapi.dll
+ * There are a million better ways, such as a well-known
+ * registry key under which a value is created for each
+ * provider DLL installed, or even a platform-specific
+ * ntp.conf directive or command-line switch.
+ */
+ dlls = getenv("PPSAPI_DLLS");
+ if (dlls != NULL && NULL == g_provider_list) {
+ dlls = dll = _strdup(dlls);
+ fprintf(stderr, "getenv(PPSAPI_DLLS) gives %s\n", dlls);
+ } else
+ dlls = dll = NULL;
+
+ while (dll != NULL && dll[0]) {
+ pch = strchr(dll, ';');
+ if (pch != NULL)
+ *pch = 0;
+ err = load_pps_provider(dll);
+ if (err) {
+ fprintf(stderr, "load_pps_provider(%s) got errno %d\n", dll, err);
+ RETURN_PPS_ERRNO(err);
+ }
+ dll = (NULL == pch)
+ ? NULL
+ : pch + 1;
+ }
+
+ if (NULL != dlls)
+ free(dlls);
+ dlls = dll = NULL;
+
+ /*
+ * Hand off to each provider in turn until one returns a PPS
+ * handle or they've all declined.
+ */
+ for (prov = g_provider_list; prov != NULL; prov = prov->next) {
+ ppshandle = 0;
+ g_curr_provider = prov;
+ err = (*prov->ptime_pps_create)(winhandle, &ppshandle);
+ g_curr_provider = NULL;
+ fprintf(stderr, "%s prov_time_pps_create(%p) returned %d\n",
+ prov->short_name, winhandle, err);
+ if (!err && ppshandle) {
+ *phandle = ppshandle;
+ return 0;
+ }
+ }
+
+ fprintf(stderr, "PPSAPI provider list %p\n", g_provider_list);
+
+ RETURN_PPS_ERRNO(ENOEXEC);
+}
+
+
+/*
+ * release PPS handle
+ */
+
+static inline int
+time_pps_destroy(
+ pps_handle_t handle
+ )
+{
+ pps_unit_t * punit;
+ int err;
+
+ if (!handle)
+ RETURN_PPS_ERRNO(EBADF);
+
+ punit = unit_from_ppsapi_handle(handle);
+
+ if (NULL == punit)
+ RETURN_PPS_ERRNO(EBADF);
+
+ err = (*punit->provider->ptime_pps_destroy)(punit, punit->context);
+
+ free(punit);
+
+ if (err)
+ RETURN_PPS_ERRNO(err);
+ else
+ return 0;
+}
+
+/*
+ * set parameters for handle
+ */
+
+static inline int
+time_pps_setparams(
+ pps_handle_t handle,
+ const pps_params_t *params
+ )
+{
+ pps_unit_t * punit;
+ int err;
+
+ /*
+ * Check for valid arguments and set parameters.
+ */
+ if (!handle)
+ RETURN_PPS_ERRNO(EBADF);
+
+ punit = unit_from_ppsapi_handle(handle);
+
+ if (NULL == punit)
+ RETURN_PPS_ERRNO(EBADF);
+
+ if (NULL == params)
+ RETURN_PPS_ERRNO(EFAULT);
+
+ err = (*punit->provider->ptime_pps_setparams)(punit, punit->context, params);
+
+ if (err)
+ RETURN_PPS_ERRNO(err);
+ else
+ return 0;
+}
+
+/*
+ * get parameters for handle
+ */
+
+static inline int
+time_pps_getparams(
+ pps_handle_t handle,
+ pps_params_t *params_buf
+ )
+{
+ pps_unit_t * punit;
+
+ /*
+ * Check for valid arguments and get parameters.
+ */
+ if (!handle)
+ RETURN_PPS_ERRNO(EBADF);
+
+ punit = unit_from_ppsapi_handle(handle);
+
+ if (NULL == punit)
+ RETURN_PPS_ERRNO(EBADF);
+
+ if (NULL == params_buf)
+ RETURN_PPS_ERRNO(EFAULT);
+
+ *params_buf = punit->params;
+ return 0;
+}
+
+
+/*
+ * time_pps_getcap - get capabilities for handle
+ */
+static inline int
+time_pps_getcap(
+ pps_handle_t handle,
+ int *pmode
+ )
+{
+ pps_unit_t * punit;
+
+ /*
+ * Check for valid arguments and get capabilities.
+ */
+ if (!handle)
+ RETURN_PPS_ERRNO(EBADF);
+
+ punit = unit_from_ppsapi_handle(handle);
+
+ if (NULL == punit)
+ RETURN_PPS_ERRNO(EBADF);
+
+ if (NULL == pmode)
+ RETURN_PPS_ERRNO(EFAULT);
+
+ *pmode = punit->provider->caps;
+ return 0;
+}
+
+/*
+ * Fetch timestamps
+ */
+
+static inline int
+time_pps_fetch(
+ pps_handle_t handle,
+ const int tsformat,
+ pps_info_t * pinfo,
+ const struct timespec * ptimeout
+ )
+{
+ pps_unit_t * punit;
+ int err;
+
+ /*
+ * Check for valid arguments and fetch timestamps
+ */
+ if (!handle)
+ RETURN_PPS_ERRNO(EBADF);
+
+ if (NULL == pinfo)
+ RETURN_PPS_ERRNO(EFAULT);
+
+ punit = unit_from_ppsapi_handle(handle);
+
+ if (NULL == punit)
+ RETURN_PPS_ERRNO(EBADF);
+
+ err = (*punit->provider->ptime_pps_fetch)(punit,
+ punit->context,
+ tsformat,
+ pinfo,
+ ptimeout);
+
+ if (err)
+ RETURN_PPS_ERRNO(err);
+ else
+ return 0;
+}
+
+/*
+ * time_pps_kcbind - specify kernel consumer
+ *
+ * Not supported so far by Windows.
+ */
+
+static inline int
+time_pps_kcbind(
+ pps_handle_t handle,
+ const int kernel_consumer,
+ const int edge, const int tsformat
+ )
+{
+ pps_unit_t * punit;
+ int err;
+
+ if (!handle)
+ RETURN_PPS_ERRNO(EBADF);
+
+ punit = unit_from_ppsapi_handle(handle);
+
+ if (NULL == punit)
+ RETURN_PPS_ERRNO(EBADF);
+
+ err = (*punit->provider->ptime_pps_kcbind)(
+ punit,
+ punit->context,
+ kernel_consumer,
+ edge,
+ tsformat);
+
+ if (err)
+ RETURN_PPS_ERRNO(err);
+ else
+ return 0;
+}
+
+
+#endif /* TIMEPPS_H */
diff --git a/ports/winnt/include/unistd.h b/ports/winnt/include/unistd.h
new file mode 100644
index 000000000000..5e1599737300
--- /dev/null
+++ b/ports/winnt/include/unistd.h
@@ -0,0 +1,4 @@
+/**************************************************************
+ * Dummy Header for Unix to Windows NT portability
+ * Created for NTP package
+ **************************************************************/
diff --git a/ports/winnt/include/win32_io.h b/ports/winnt/include/win32_io.h
new file mode 100644
index 000000000000..8f67ca1d1896
--- /dev/null
+++ b/ports/winnt/include/win32_io.h
@@ -0,0 +1,7 @@
+#ifndef WIN32_IO_H
+#define WIN32_IO_H
+
+extern void InitSockets(void);
+extern void connection_reset_fix(SOCKET fd, sockaddr_u *addr);
+
+#endif /* WIN32_IO_H */
diff --git a/ports/winnt/instsrv/instsrv.c b/ports/winnt/instsrv/instsrv.c
new file mode 100644
index 000000000000..b3acc9f3921d
--- /dev/null
+++ b/ports/winnt/instsrv/instsrv.c
@@ -0,0 +1,461 @@
+/*
+ * File: instsrv.c
+ * Purpose: To install a new service and to insert registry entries.
+ *
+ */
+#ifndef __RPCASYNC_H__
+#define __RPCASYNC_H__ /* Skip asynch rpc inclusion */
+#endif
+
+#include
+#include
+
+#define PERR(api) printf("\n%s: Error %d from %s on line %d", \
+ __FILE__, GetLastError(), api, __LINE__);
+
+#define MSG_FOR_ACCESS_DENIED "You aren't authorized to do this - please see your system Administrator"
+#define MSG_1_FOR_BAD_PATH "The fully qualified path name to the .exe must be given, and"
+#define MSG_2_FOR_BAD_PATH " the drive letter must be for a fixed disk (e.g., not a net drive)"
+
+SC_HANDLE schService;
+SC_HANDLE schSCManager;
+int ok2;
+
+VOID DisplayHelp(VOID);
+
+/* --------------------------------------------------------------------------------------- */
+
+int InstallService(LPCTSTR serviceName, LPCTSTR displayName, LPCTSTR serviceExe)
+{
+ LPCTSTR lpszBinaryPathName = serviceExe;
+ TCHAR lpszRootPathName[] ="?:\\";
+
+ if ( (':' != *(lpszBinaryPathName+1)) || ('\\' != *(lpszBinaryPathName+2)) )
+ { printf("\n%s",MSG_1_FOR_BAD_PATH);
+ printf("\n%s\n",MSG_2_FOR_BAD_PATH);
+ return 1;
+ }
+
+ #define DRIVE_TYPE_INDETERMINATE 0
+ #define ROOT_DIR_DOESNT_EXIST 1
+
+ *lpszRootPathName = *(lpszBinaryPathName+0) ;
+
+ switch ( GetDriveType(lpszRootPathName) )
+ {
+ case DRIVE_FIXED :
+ { // OK
+ break;
+ }
+ case ROOT_DIR_DOESNT_EXIST :
+ { printf("\n%s",MSG_1_FOR_BAD_PATH);
+ printf("\n the root directory where the .exe is specified to be must exist, and");
+ printf("\n%s\n",MSG_2_FOR_BAD_PATH);
+ return 1;
+ }
+ case DRIVE_TYPE_INDETERMINATE :
+ case DRIVE_REMOVABLE :
+ case DRIVE_REMOTE :
+ case DRIVE_CDROM :
+ case DRIVE_RAMDISK :
+ { printf("\n%s",MSG_1_FOR_BAD_PATH);
+ printf("\n%s\n",MSG_2_FOR_BAD_PATH);
+ return 1;
+ }
+ default :
+ { printf("\n%s",MSG_1_FOR_BAD_PATH);
+ printf("\n%s\n",MSG_2_FOR_BAD_PATH);
+ return 1;
+ }
+ }
+
+ if (INVALID_HANDLE_VALUE == CreateFile(lpszBinaryPathName,
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL))
+ {
+ printf("\n%s",MSG_1_FOR_BAD_PATH);
+ printf("\n the file must exist, and");
+ printf("\n%s\n",MSG_2_FOR_BAD_PATH);
+ return 1;
+ }
+
+ schService = CreateService(
+ schSCManager, // SCManager database
+ serviceName, // name of service
+ displayName, // name to display
+ SERVICE_ALL_ACCESS, // desired access
+ SERVICE_WIN32_OWN_PROCESS, // service type
+ SERVICE_AUTO_START, // start type
+ SERVICE_ERROR_NORMAL, // error control type
+ lpszBinaryPathName, // service's binary
+ NULL, // no load ordering group
+ NULL, // no tag identifier
+ NULL, // no dependencies
+ NULL, // Local System account
+ NULL); // null password
+
+ if (NULL == schService)
+ { switch (GetLastError())
+ {
+ case ERROR_ACCESS_DENIED :
+ { printf("\n%s",MSG_FOR_ACCESS_DENIED);
+ break;
+ }
+ case ERROR_SERVICE_EXISTS :
+ { printf("\nThe %s service is already installed",serviceName);
+ printf("\nRemove it first if you need to re-install a new version\n");
+ break;
+ }
+ default :
+ { PERR("CreateService");
+ }
+ }
+ return 1;
+ }
+ else
+
+ CloseServiceHandle(schService);
+ return 0;
+}
+
+/* --------------------------------------------------------------------------------------- */
+
+int RemoveService(LPCTSTR serviceName)
+{
+ {
+ #define SZ_ENUM_BUF 4096
+ ENUM_SERVICE_STATUS essServiceStatus[SZ_ENUM_BUF];
+ DWORD dwBufSize = sizeof(essServiceStatus);
+ DWORD dwBytesNeeded = 0;
+ DWORD dwServicesReturned = 0;
+ DWORD dwResumeHandle = 0;
+ DWORD dwI = 0;
+ BOOLEAN bFound = FALSE;
+
+ if (!EnumServicesStatus(schSCManager,
+ SERVICE_WIN32,
+ SERVICE_ACTIVE,
+ (LPENUM_SERVICE_STATUS)&essServiceStatus,
+ dwBufSize,
+ &dwBytesNeeded,
+ &dwServicesReturned,
+ &dwResumeHandle))
+ { switch (GetLastError())
+ {
+ case ERROR_ACCESS_DENIED :
+ { printf("\n%s",MSG_FOR_ACCESS_DENIED);
+ break;
+ }
+ default :
+ { PERR("EnumServicesStatus");
+ }
+ }
+ return 1;
+ }
+
+ for (dwI=0; dwI 256)
+ {
+ printf("\nThe service name cannot be longer than 256 characters\n");
+ return(1);
+ }
+
+
+
+ bRemovingService = (!stricmp(argv[1], "remove"));
+ schSCManager = OpenSCManager(
+ NULL, // machine (NULL == local)
+ NULL, // database (NULL == default)
+ SC_MANAGER_ALL_ACCESS); // access required
+
+ if (NULL == schSCManager)
+ { switch (GetLastError())
+ {
+ case ERROR_ACCESS_DENIED :
+ { printf("\n%s",MSG_FOR_ACCESS_DENIED);
+ break;
+ }
+ default :
+ { PERR("OpenSCManager");
+ }
+ }
+ return (0);
+ }
+
+ if (bRemovingService)
+ {
+ ok = RemoveService(lpszServName);
+ }
+ else
+ {
+ /* get the exe name */
+ strcpy(lpszExeName,argv[1]);
+ ok = InstallService(lpszServName, lpszDispName, lpszExeName);
+ }
+
+ CloseServiceHandle(schSCManager);
+
+ if (!bRemovingService)
+ {
+ if (ok == 0)
+ { /* Set the Event-ID message-file name. */
+ ok = addSourceToRegistry("NTP", lpszExeName);
+ if (ok == 0)
+ ok = addKeysToRegistry();
+ else return ok;
+
+ if (ok == 0)
+ {
+ printf("\nThe \"Network Time Protocol\" service was successfully created.\n");
+ printf("\nDon't forget!!! You must now go to the Control Panel and");
+ printf("\n use the Services applet to change the account name and");
+ printf("\n password that the NTP Service will use when");
+ printf("\n it starts.");
+ printf("\nTo do this: use the Startup button in the Services applet,");
+ printf("\n and (for example) specify the desired account and");
+ printf("\n correct password.");
+ printf("\nAlso, use the Services applet to ensure this newly installed");
+ printf("\n service starts automatically on bootup.\n");
+ return 0;
+ }
+ }
+ else return ok;
+ }
+ return 0;
+}
+
+/* --------------------------------------------------------------------------------------- */
+
+VOID DisplayHelp(VOID)
+{
+ printf("Installs or removes the NTP service.\n");
+ printf("To install the NTP service,\n");
+ printf("type INSTSRV \n");
+ printf("Where:\n");
+ printf(" path Absolute path to the NTP service, name.exe. You must\n");
+ printf(" use a fully qualified path and the drive letter must be for a\n");
+ printf(" fixed, local drive.\n\n");
+ printf("For example, INSTSRV i:\\winnt\\system32\\ntpd.exe\n");
+ printf("To remove the NTP service,\n");
+ printf("type INSTSRV remove \n");
+
+}
+
+/* EOF */
diff --git a/ports/winnt/libntp/MSG00001.bin b/ports/winnt/libntp/MSG00001.bin
new file mode 100644
index 000000000000..320ee54d1e2c
Binary files /dev/null and b/ports/winnt/libntp/MSG00001.bin differ
diff --git a/ports/winnt/libntp/SetSystemTime.c b/ports/winnt/libntp/SetSystemTime.c
new file mode 100644
index 000000000000..8cb43173f22e
--- /dev/null
+++ b/ports/winnt/libntp/SetSystemTime.c
@@ -0,0 +1,34 @@
+
+#include
+
+#include "clockstuff.h"
+#include "ntp_stdlib.h"
+#include "ntp_unixtime.h"
+
+pset_tod_using set_tod_using = NULL;
+
+int
+ntp_set_tod(
+ struct timeval *tv,
+ void *tzp
+ )
+{
+ SYSTEMTIME st;
+ union {
+ FILETIME ft;
+ ULONGLONG ull;
+ } t;
+
+ UNUSED_ARG(tzp);
+
+ t.ull = FILETIME_1970 +
+ (ULONGLONG)tv->tv_sec * 10 * 1000 * 1000 +
+ (ULONGLONG)tv->tv_usec * 10;
+
+ if (!FileTimeToSystemTime(&t.ft, &st) || !SetSystemTime(&st)) {
+ msyslog(LOG_ERR, "SetSystemTime failed: %m");
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/ports/winnt/libntp/getclock.c b/ports/winnt/libntp/getclock.c
new file mode 100644
index 000000000000..68496bd53078
--- /dev/null
+++ b/ports/winnt/libntp/getclock.c
@@ -0,0 +1,63 @@
+/*
+ * getclock.c - Emulate Unix getclock(3) nanosecond interface for libntp/ntpd
+ */
+#include "config.h"
+
+#include "ntp_unixtime.h"
+#include "clockstuff.h"
+#include "ntp_stdlib.h"
+
+/*
+ * getclock() is in libntp. To use interpolation,
+ * ports/winnt/ntpd/nt_clockstuff.c overrides GetSystemTimeAsFileTime
+ * via the pointer get_sys_time_as_filetime.
+ */
+PGSTAFT get_sys_time_as_filetime;
+PGSTAFT pGetSystemTimePreciseAsFileTime;
+
+
+int
+getclock(
+ int clktyp,
+ struct timespec *ts
+ )
+{
+ union {
+ FILETIME ft;
+ ULONGLONG ull;
+ } uNow;
+
+ if (clktyp != TIMEOFDAY) {
+ TRACE(1, ("getclock() supports only TIMEOFDAY clktyp\n"));
+ errno = EINVAL;
+ return -1;
+ }
+
+ (*get_sys_time_as_filetime)(&uNow.ft);
+
+ /*
+ * Convert the hecto-nano second time to timespec format
+ */
+ uNow.ull -= FILETIME_1970;
+ ts->tv_sec = (time_t)( uNow.ull / HECTONANOSECONDS);
+ ts->tv_nsec = (long)(( uNow.ull % HECTONANOSECONDS) * 100);
+
+ return 0;
+}
+
+
+void
+init_win_precise_time(void)
+{
+ HANDLE hDll;
+ FARPROC pfn;
+
+ hDll = LoadLibrary("kernel32");
+ pfn = GetProcAddress(hDll, "GetSystemTimePreciseAsFileTime");
+ if (NULL != pfn) {
+ pGetSystemTimePreciseAsFileTime = (PGSTAFT)pfn;
+ get_sys_time_as_filetime = pGetSystemTimePreciseAsFileTime;
+ } else {
+ get_sys_time_as_filetime = &GetSystemTimeAsFileTime;
+ }
+}
diff --git a/ports/winnt/libntp/messages.h b/ports/winnt/libntp/messages.h
new file mode 100644
index 000000000000..475371169a2a
--- /dev/null
+++ b/ports/winnt/libntp/messages.h
@@ -0,0 +1,199 @@
+ /*
+ Microsoft Developer Support
+ Copyright (c) 1992 Microsoft Corporation
+
+ This file contains the message definitions for the Win32
+ syslog support messages for the nntp firewall
+-------------------------------------------------------------------------
+ HEADER SECTION
+
+ The header section defines names and language identifiers for use
+ by the message definitions later in this file. The MessageIdTypedef,
+ SeverityNames, FacilityNames, and LanguageNames keywords are
+ optional and not required.
+
+
+
+ The MessageIdTypedef keyword gives a typedef name that is used in a
+ type cast for each message code in the generated include file. Each
+ message code appears in the include file with the format: #define
+ name ((type) 0xnnnnnnnn) The default value for type is empty, and no
+ type cast is generated. It is the programmer's responsibility to
+ specify a typedef statement in the application source code to define
+ the type. The type used in the typedef must be large enough to
+ accomodate the entire 32-bit message code.
+
+
+
+ The SeverityNames keyword defines the set of names that are allowed
+ as the value of the Severity keyword in the message definition. The
+ set is delimited by left and right parentheses. Associated with each
+ severity name is a number that, when shifted left by 30, gives the
+ bit pattern to logical-OR with the Facility value and MessageId
+ value to form the full 32-bit message code. The default value of
+ this keyword is:
+
+ SeverityNames=(
+ Success=0x0
+ Informational=0x1
+ Warning=0x2
+ Error=0x3
+ )
+
+ Severity values occupy the high two bits of a 32-bit message code.
+ Any severity value that does not fit in two bits is an error. The
+ severity codes can be given symbolic names by following each value
+ with :name
+
+
+FacilityNames=(System=0x0:FACILITY_SYSTEM
+ Runtime=0x2:FACILITY_RUNTIME
+ Stubs=0x3:FACILITY_STUBS
+ Io=0x4:FACILITY_IO_ERROR_CODE
+ )
+
+ The FacilityNames keyword defines the set of names that are allowed
+ as the value of the Facility keyword in the message definition. The
+ set is delimited by left and right parentheses. Associated with each
+ facility name is a number that, when shift it left by 16 bits, gives
+ the bit pattern to logical-OR with the Severity value and MessageId
+ value to form the full 32-bit message code. The default value of
+ this keyword is:
+
+ FacilityNames=(
+ System=0x0FF
+ Application=0xFFF
+ )
+
+ Facility codes occupy the low order 12 bits of the high order
+ 16-bits of a 32-bit message code. Any facility code that does not
+ fit in 12 bits is an error. This allows for 4,096 facility codes.
+ The first 256 codes are reserved for use by the system software. The
+ facility codes can be given symbolic names by following each value
+ with :name
+
+
+ The LanguageNames keyword defines the set of names that are allowed
+ as the value of the Language keyword in the message definition. The
+ set is delimited by left and right parentheses. Associated with each
+ language name is a number and a file name that are used to name the
+ generated resource file that contains the messages for that
+ language. The number corresponds to the language identifier to use
+ in the resource table. The number is separated from the file name
+ with a colon. The initial value of LanguageNames is:
+
+ LanguageNames=(English=1:MSG00001)
+
+ Any new names in the source file which don't override the built-in
+ names are added to the list of valid languages. This allows an
+ application to support private languages with descriptive names.
+
+
+-------------------------------------------------------------------------
+ MESSAGE DEFINITION SECTION
+
+ Following the header section is the body of the Message Compiler
+ source file. The body consists of zero or more message definitions.
+ Each message definition begins with one or more of the following
+ statements:
+
+ MessageId = [number|+number]
+ Severity = severity_name
+ Facility = facility_name
+ SymbolicName = name
+
+ The MessageId statement marks the beginning of the message
+ definition. A MessageID statement is required for each message,
+ although the value is optional. If no value is specified, the value
+ used is the previous value for the facility plus one. If the value
+ is specified as +number then the value used is the previous value
+ for the facility, plus the number after the plus sign. Otherwise, if
+ a numeric value is given, that value is used. Any MessageId value
+ that does not fit in 16 bits is an error.
+
+ The Severity and Facility statements are optional. These statements
+ specify additional bits to OR into the final 32-bit message code. If
+ not specified they default to the value last specified for a message
+ definition. The initial values prior to processing the first message
+ definition are:
+
+ Severity=Success
+ Facility=Application
+
+ The value associated with Severity and Facility must match one of
+ the names given in the FacilityNames and SeverityNames statements in
+ the header section. The SymbolicName statement allows you to
+ associate a C/C++ symbolic constant with the final 32-bit message
+ code.
+ */
+//
+// Values are 32 bit values laid out as follows:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// +---+-+-+-----------------------+-------------------------------+
+// |Sev|C|R| Facility | Code |
+// +---+-+-+-----------------------+-------------------------------+
+//
+// where
+//
+// Sev - is the severity code
+//
+// 00 - Success
+// 01 - Informational
+// 10 - Warning
+// 11 - Error
+//
+// C - is the Customer code flag
+//
+// R - is a reserved bit
+//
+// Facility - is the facility code
+//
+// Code - is the facility's status code
+//
+//
+// Define the facility codes
+//
+
+
+//
+// Define the severity codes
+//
+#define STATUS_SEVERITY_WARNING 0x2
+#define STATUS_SEVERITY_SUCCESS 0x0
+#define STATUS_SEVERITY_INFORMATIONAL 0x1
+#define STATUS_SEVERITY_ERROR 0x3
+
+
+//
+// MessageId: NTP_ERROR
+//
+// MessageText:
+//
+// %1
+//
+#define NTP_ERROR ((DWORD)0xC0000001L)
+
+//
+// MessageId: NTP_WARNING
+//
+// MessageText:
+//
+// %1
+//
+//
+#define NTP_WARNING ((DWORD)0x80000002L)
+
+//
+// MessageId: NTP_INFO
+//
+// MessageText:
+//
+// %1
+//
+//
+//
+//
+#define NTP_INFO ((DWORD)0x40000003L)
+
diff --git a/ports/winnt/libntp/messages.mc b/ports/winnt/libntp/messages.mc
new file mode 100644
index 000000000000..3a6bc7d22c0f
--- /dev/null
+++ b/ports/winnt/libntp/messages.mc
@@ -0,0 +1,161 @@
+; /*
+; Microsoft Developer Support
+; Copyright (c) 1992 Microsoft Corporation
+;
+; This file contains the message definitions for the Win32
+; syslog support messages for the nntp firewall
+
+;-------------------------------------------------------------------------
+; HEADER SECTION
+;
+; The header section defines names and language identifiers for use
+; by the message definitions later in this file. The MessageIdTypedef,
+; SeverityNames, FacilityNames, and LanguageNames keywords are
+; optional and not required.
+;
+;
+MessageIdTypedef=DWORD
+;
+; The MessageIdTypedef keyword gives a typedef name that is used in a
+; type cast for each message code in the generated include file. Each
+; message code appears in the include file with the format: #define
+; name ((type) 0xnnnnnnnn) The default value for type is empty, and no
+; type cast is generated. It is the programmer's responsibility to
+; specify a typedef statement in the application source code to define
+; the type. The type used in the typedef must be large enough to
+; accomodate the entire 32-bit message code.
+;
+;
+SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS
+ Informational=0x1:STATUS_SEVERITY_INFORMATIONAL
+ Warning=0x2:STATUS_SEVERITY_WARNING
+ Error=0x3:STATUS_SEVERITY_ERROR
+ )
+;
+; The SeverityNames keyword defines the set of names that are allowed
+; as the value of the Severity keyword in the message definition. The
+; set is delimited by left and right parentheses. Associated with each
+; severity name is a number that, when shifted left by 30, gives the
+; bit pattern to logical-OR with the Facility value and MessageId
+; value to form the full 32-bit message code. The default value of
+; this keyword is:
+;
+; SeverityNames=(
+; Success=0x0
+; Informational=0x1
+; Warning=0x2
+; Error=0x3
+; )
+;
+; Severity values occupy the high two bits of a 32-bit message code.
+; Any severity value that does not fit in two bits is an error. The
+; severity codes can be given symbolic names by following each value
+; with :name
+;
+;
+;FacilityNames=(System=0x0:FACILITY_SYSTEM
+; Runtime=0x2:FACILITY_RUNTIME
+; Stubs=0x3:FACILITY_STUBS
+; Io=0x4:FACILITY_IO_ERROR_CODE
+; )
+;
+; The FacilityNames keyword defines the set of names that are allowed
+; as the value of the Facility keyword in the message definition. The
+; set is delimited by left and right parentheses. Associated with each
+; facility name is a number that, when shift it left by 16 bits, gives
+; the bit pattern to logical-OR with the Severity value and MessageId
+; value to form the full 32-bit message code. The default value of
+; this keyword is:
+;
+; FacilityNames=(
+; System=0x0FF
+; Application=0xFFF
+; )
+;
+; Facility codes occupy the low order 12 bits of the high order
+; 16-bits of a 32-bit message code. Any facility code that does not
+; fit in 12 bits is an error. This allows for 4,096 facility codes.
+; The first 256 codes are reserved for use by the system software. The
+; facility codes can be given symbolic names by following each value
+; with :name
+;
+;
+; The LanguageNames keyword defines the set of names that are allowed
+; as the value of the Language keyword in the message definition. The
+; set is delimited by left and right parentheses. Associated with each
+; language name is a number and a file name that are used to name the
+; generated resource file that contains the messages for that
+; language. The number corresponds to the language identifier to use
+; in the resource table. The number is separated from the file name
+; with a colon. The initial value of LanguageNames is:
+;
+; LanguageNames=(English=1:MSG00001)
+;
+; Any new names in the source file which don't override the built-in
+; names are added to the list of valid languages. This allows an
+; application to support private languages with descriptive names.
+;
+;
+;-------------------------------------------------------------------------
+; MESSAGE DEFINITION SECTION
+;
+; Following the header section is the body of the Message Compiler
+; source file. The body consists of zero or more message definitions.
+; Each message definition begins with one or more of the following
+; statements:
+;
+; MessageId = [number|+number]
+; Severity = severity_name
+; Facility = facility_name
+; SymbolicName = name
+;
+; The MessageId statement marks the beginning of the message
+; definition. A MessageID statement is required for each message,
+; although the value is optional. If no value is specified, the value
+; used is the previous value for the facility plus one. If the value
+; is specified as +number then the value used is the previous value
+; for the facility, plus the number after the plus sign. Otherwise, if
+; a numeric value is given, that value is used. Any MessageId value
+; that does not fit in 16 bits is an error.
+;
+; The Severity and Facility statements are optional. These statements
+; specify additional bits to OR into the final 32-bit message code. If
+; not specified they default to the value last specified for a message
+; definition. The initial values prior to processing the first message
+; definition are:
+;
+; Severity=Success
+; Facility=Application
+;
+; The value associated with Severity and Facility must match one of
+; the names given in the FacilityNames and SeverityNames statements in
+; the header section. The SymbolicName statement allows you to
+; associate a C/C++ symbolic constant with the final 32-bit message
+; code.
+; */
+
+MessageId=0x1
+Severity=Error
+Facility=Application
+SymbolicName=NTP_ERROR
+Language=English
+%1
+.
+
+MessageId=0x2
+Severity=Warning
+Facility=Application
+SymbolicName=NTP_WARNING
+Language=English
+%1
+
+.
+MessageId=0x3
+Severity=Informational
+Facility=Application
+SymbolicName=NTP_INFO
+Language=English
+%1
+
+
+
diff --git a/ports/winnt/libntp/messages.rc b/ports/winnt/libntp/messages.rc
new file mode 100644
index 000000000000..0abcb0fa2c57
--- /dev/null
+++ b/ports/winnt/libntp/messages.rc
@@ -0,0 +1,2 @@
+LANGUAGE 0x9,0x1
+1 11 "MSG00001.bin"
diff --git a/ports/winnt/libntp/randfile.c b/ports/winnt/libntp/randfile.c
new file mode 100644
index 000000000000..7de80b80d6a4
--- /dev/null
+++ b/ports/winnt/libntp/randfile.c
@@ -0,0 +1,109 @@
+/*
+ * Make sure that there is a good source of random characters
+ * so that OpenSSL can work properly and securely.
+ */
+
+#include
+#include
+
+#include
+
+unsigned int getrandom_chars(int desired, unsigned char *buf, int lenbuf);
+BOOL create_random_file(char *filename);
+
+BOOL
+init_randfile()
+{
+ FILE *rf;
+ char *randfile;
+ char *homedir;
+ char tmp[256];
+ /* See if the environmental variable RANDFILE is defined
+ * and the file exists
+ */
+ randfile = getenv("RANDFILE");
+ if (randfile != NULL) {
+ rf = fopen(randfile, "rb");
+ if (rf != NULL) {
+ fclose(rf);
+ return (TRUE);
+ }
+ else {
+ /* The environmental variable exists but not the file */
+ return (create_random_file(randfile));
+ }
+ }
+ /*
+ * If the RANDFILE environmental variable does not exist,
+ * see if the HOME enviromental variable exists and
+ * a .rnd file is in there.
+ */
+ homedir = getenv("HOME");
+ if (homedir != NULL &&
+ (strlen(homedir) + 5 /* \.rnd */) < sizeof(tmp)) {
+ snprintf(tmp, sizeof(tmp), "%s\\.rnd", homedir);
+ rf = fopen(tmp, "rb");
+ if (rf != NULL) {
+ fclose(rf);
+ return (TRUE);
+ }
+ else {
+ /* The HOME environmental variable exists but not the file */
+ return (create_random_file(tmp));
+ }
+ }
+ /*
+ * Final try. Look for it on the C:\ directory
+ * NOTE: This is a really bad place for it security-wise
+ * However, OpenSSL looks for it there if it can't find it elsewhere
+ */
+ rf = fopen("C:\\.rnd", "rb");
+ if (rf != NULL) {
+ fclose(rf);
+ return (TRUE);
+ }
+ /* The file does not exist */
+ return (create_random_file("C:\\.rnd"));
+}
+/*
+ * Routine to create the random file with 1024 random characters
+ */
+BOOL
+create_random_file(char *filename) {
+ FILE *rf;
+ int nchars;
+ unsigned char buf[1025];
+
+ nchars = getrandom_chars(1024, buf, sizeof(buf));
+ rf = fopen(filename, "wb");
+ if (rf == NULL)
+ return (FALSE);
+ fwrite(buf, sizeof(unsigned char), nchars, rf);
+ fclose(rf);
+ return (TRUE);
+}
+
+unsigned int
+getrandom_chars(int desired, unsigned char *buf, int lenbuf) {
+ HCRYPTPROV hcryptprov;
+ BOOL err;
+
+ if (buf == NULL || lenbuf <= 0 || desired > lenbuf)
+ return (0);
+ /*
+ * The first time we just try to acquire the context
+ */
+ err = CryptAcquireContext(&hcryptprov, NULL, NULL, PROV_RSA_FULL,
+ CRYPT_VERIFYCONTEXT);
+ if (!err){
+ return (0);
+ }
+ if (!CryptGenRandom(hcryptprov, desired, buf)) {
+ CryptReleaseContext(hcryptprov, 0);
+ return (0);
+ }
+
+ CryptReleaseContext(hcryptprov, 0);
+ return (desired);
+}
+
diff --git a/ports/winnt/libntp/setpriority.c b/ports/winnt/libntp/setpriority.c
new file mode 100644
index 000000000000..52ab78529422
--- /dev/null
+++ b/ports/winnt/libntp/setpriority.c
@@ -0,0 +1,76 @@
+#include
+#include
+#include /* our private version */
+#include "ntp_stdlib.h"
+#include "ntp_syslog.h"
+#include "ntp_debug.h"
+#include "ntp_fp.h"
+#include "ntp.h"
+#include "clockstuff.h"
+
+
+/*
+ * setpriority
+ *
+ * to reduce the #ifdef forest in the portable code,
+ * we emulate the BSD setpriority interface:
+ *
+ * if (-1 == setpriority(PRIO_PROCESS, 0, NTP_PRIO))
+ * msyslog(LOG_ERR, "setpriority() error: %m");
+ *
+ * However, since the Windows port of ntpd has always raised its
+ * priority (to realtime if allowed, or silently downgraded to
+ * high by the system if not) with or without -N. Changing that
+ * now would endanger users who upgrade the binary without adding
+ * -N to its invocation. Instsrv assumes ntpd.exe is installed
+ * with no command-line arguments.
+ *
+ * This routine is used by utilities as well as ntpd itself, so
+ * it checks if the priority is already high or realtime and
+ * logs no complaints in that case, to avoid duplicating. ntpd
+ * will have raised the priority to one of those in
+ * init_winnt_time, while the utilities will rely on this
+ * code.
+ *
+ */
+
+int setpriority(
+ int which,
+ int who,
+ int prio
+ )
+{
+ BOOL success;
+ DWORD prio_class;
+
+ if (PRIO_PROCESS != which || who || NTP_PRIO != prio)
+ TRACE(1, ("windows setpriority() clone needs work.\n"));
+
+ prio_class = GetPriorityClass(GetCurrentProcess());
+
+ if (HIGH_PRIORITY_CLASS == prio_class ||
+ REALTIME_PRIORITY_CLASS == prio_class)
+ return 0;
+
+ success = SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
+
+ if (!success) {
+ msyslog(LOG_ERR, "Unable to raise priority: %m");
+ errno = EPERM;
+ return -1;
+ }
+
+ prio_class = GetPriorityClass(GetCurrentProcess());
+
+ if (REALTIME_PRIORITY_CLASS == prio_class)
+ msyslog(LOG_INFO, "Raised to realtime priority class");
+ else if (HIGH_PRIORITY_CLASS == prio_class)
+ msyslog(LOG_ERR, "Raised to high priority class, realtime "
+ "requires Increase Scheduling Priority "
+ "privilege (enabled with secpol.msc).");
+ else
+ msyslog(LOG_ERR, "Unexpected process priority class %d",
+ prio_class);
+
+ return 0;
+}
diff --git a/ports/winnt/libntp/syslog.c b/ports/winnt/libntp/syslog.c
new file mode 100644
index 000000000000..71c90c237ec3
--- /dev/null
+++ b/ports/winnt/libntp/syslog.c
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* From BIND 9 lib/isc/win32/: syslog.c,v 1.6 2002/08/03 01:34:14 mayer */
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "ntp_stdlib.h"
+
+#include "messages.h"
+
+static HANDLE hAppLog = NULL;
+static FILE *log_stream;
+static int debug_level = 0;
+static char progname[51] = "NTP";
+static int logmask = 0;
+
+static struct dsn_c_pvt_sfnt {
+ int val;
+ const char *strval;
+} facilities[] = {
+ { LOG_KERN, "kern" },
+ { LOG_USER, "user" },
+ { LOG_MAIL, "mail" },
+ { LOG_DAEMON, "daemon" },
+ { LOG_AUTH, "auth" },
+ { LOG_SYSLOG, "syslog" },
+ { LOG_LPR, "lpr" },
+#ifdef LOG_NEWS
+ { LOG_NEWS, "news" },
+#endif
+#ifdef LOG_UUCP
+ { LOG_UUCP, "uucp" },
+#endif
+#ifdef LOG_CRON
+ { LOG_CRON, "cron" },
+#endif
+#ifdef LOG_AUTHPRIV
+ { LOG_AUTHPRIV, "authpriv" },
+#endif
+#ifdef LOG_FTP
+ { LOG_FTP, "ftp" },
+#endif
+ { LOG_LOCAL0, "local0"},
+ { LOG_LOCAL1, "local1"},
+ { LOG_LOCAL2, "local2"},
+ { LOG_LOCAL3, "local3"},
+ { LOG_LOCAL4, "local4"},
+ { LOG_LOCAL5, "local5"},
+ { LOG_LOCAL6, "local6"},
+ { LOG_LOCAL7, "local7"},
+ { 0, NULL }
+};
+
+#if 0
+BOOL
+isc_syslog_facilityfromstring(const char *str, int *facilityp) {
+ int i;
+
+ REQUIRE(str != NULL);
+ REQUIRE(facilityp != NULL);
+
+ for (i = 0 ; facilities[i].strval != NULL ; i++) {
+ if (strcasecmp(facilities[i].strval, str) == 0) {
+ *facilityp = facilities[i].val;
+ return (TRUE);
+ }
+ }
+ return (FALSE);
+}
+#endif
+/*
+ * Log to the NT Event Log
+ */
+void
+syslog(int level, const char *fmt, ...) {
+ va_list ap;
+ char buf[1024];
+ char *str[1];
+
+ str[0] = buf;
+
+ va_start(ap, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+
+ /* Make sure that the channel is open to write the event */
+ if (hAppLog == NULL) {
+ openlog(progname, LOG_PID);
+ }
+ switch (level) {
+ case LOG_INFO:
+ case LOG_NOTICE:
+ case LOG_DEBUG:
+ ReportEvent(hAppLog, EVENTLOG_INFORMATION_TYPE, 0,
+ NTP_INFO, NULL, 1, 0, str, NULL);
+ break;
+ case LOG_WARNING:
+ ReportEvent(hAppLog, EVENTLOG_WARNING_TYPE, 0,
+ NTP_WARNING, NULL, 1, 0, str, NULL);
+ break;
+ default:
+ ReportEvent(hAppLog, EVENTLOG_ERROR_TYPE, 0,
+ NTP_ERROR, NULL, 1, 0, str, NULL);
+ break;
+ }
+}
+
+/*
+ * Initialize event logging
+ */
+void
+openlog(const char *name, int flags, ...) {
+ /* Get a handle to the Application event log */
+ hAppLog = RegisterEventSource(NULL, progname);
+ strlcpy(progname, name, sizeof(progname));
+}
+
+/*
+ * Close the Handle to the application Event Log
+ * We don't care whether or not we succeeded so ignore return values
+ * In fact if we failed then we would have nowhere to put the message
+ */
+void
+closelog() {
+ DeregisterEventSource(hAppLog);
+}
+
+/*
+ * Keep event logging synced with the current debug level
+ */
+void
+ModifyLogLevel(int level) {
+ debug_level = level;
+}
+/*
+ * Set the log priority mask to the given value.
+ * Return the previous priority mask
+ * Note that this setting is ignored in Win32
+ */
+int
+setlogmask(int maskpri) {
+ int temp = logmask;
+ logmask = maskpri;
+ return (temp);
+}
+
+/*
+ * Initialize logging for the port section of libbind.
+ * Piggyback onto stream given.
+ */
+void
+InitNTLogging(FILE *stream, int debug) {
+ log_stream = stream;
+ ModifyLogLevel(debug);
+}
+/*
+ * This function is for reporting errors to the application
+ * event log in case the regular syslog is not available
+ * mainly during startup. It should not be used under normal
+ * circumstances.
+ */
+void
+NTReportError(const char *name, const char *str) {
+ HANDLE hNTAppLog = NULL;
+ const char *buf[1];
+
+ buf[0] = str;
+
+ hNTAppLog = RegisterEventSource(NULL, name);
+
+ ReportEvent(hNTAppLog, EVENTLOG_ERROR_TYPE, 0,
+ NTP_ERROR, NULL, 1, 0, buf, NULL);
+
+ DeregisterEventSource(hNTAppLog);
+}
+
+
+/*
+ * ntp_strerror() - provide strerror()-compatible wrapper for libisc's
+ * isc__strerror(), which knows about Windows as well as
+ * C runtime error messages.
+ */
+
+char *
+ntp_strerror(
+ int code
+ )
+{
+ char * buf;
+
+ LIB_GETBUF(buf);
+ isc__strerror(code, buf, LIB_BUFLENGTH);
+
+ return buf;
+}
diff --git a/ports/winnt/libntp/termios.c b/ports/winnt/libntp/termios.c
new file mode 100644
index 000000000000..3fe4e4859c01
--- /dev/null
+++ b/ports/winnt/libntp/termios.c
@@ -0,0 +1,789 @@
+/* This file implements system calls that are not compatible with UNIX */
+/* Moved to libntp/termios.c */
+
+#include
+#include
+#include
+
+#include "ntp.h"
+#include "ntp_tty.h"
+#include "lib_strbuf.h"
+#include "ntp_assert.h"
+#include "win32_io.h"
+
+#define MAX_SERIAL 255 /* COM1: - COM255: */
+
+typedef struct comhandles_tag {
+ HANDLE h;
+ size_t opens;
+ HANDLE * dupes;
+} comhandles;
+
+comhandles * hnds; /* handle/dupes array */
+size_t c_hnds; /* current array size */
+
+/*
+ * common_serial_open ensures duplicate opens of the same port
+ * work by duplicating the handle for the 2nd open, allowing
+ * refclock_atom to share a GPS refclock's comm port.
+ */
+HANDLE common_serial_open(
+ char * dev,
+ char ** pwindev
+ )
+{
+ char * windev;
+ HANDLE handle;
+ size_t unit;
+ size_t prev_c_hnds;
+ size_t opens;
+ char * pch;
+
+ /*
+ * This is odd, but we'll take any unix device path
+ * by looking for the initial '/' and strip off everything
+ * before the final digits, then translate that to COM__:
+ * maintaining backward compatibility with NTP practice of
+ * mapping unit 0 to the nonfunctional COM0:
+ *
+ * To ease the job of taking the windows COMx: device names
+ * out of reference clocks, we'll also work with those
+ * equanimously.
+ */
+
+ TRACE(1, ("common_serial_open given %s\n", dev));
+
+ pch = NULL;
+ if ('/' == dev[0]) {
+ pch = dev + strlen(dev) - 1;
+
+ if (isdigit(pch[0])) {
+ while (isdigit(pch[0])) {
+ pch--;
+ }
+ pch++;
+ }
+ TRACE(1, ("common_serial_open skipped to ending digits leaving %s\n", pch));
+ } else if ('c' == tolower(dev[0])
+ && 'o' == tolower(dev[1])
+ && 'm' == tolower(dev[2])) {
+ pch = dev + 3;
+ TRACE(1, ("common_serial_open skipped COM leaving %s\n", pch));
+ }
+
+ if (!pch || !isdigit(pch[0])) {
+ TRACE(1, ("not a digit: %s\n", pch ? pch : "[NULL]"));
+ return INVALID_HANDLE_VALUE;
+ }
+
+ if (1 != sscanf(pch, "%d", &unit)
+ || unit > MAX_SERIAL
+ || unit < 0) {
+ TRACE(1, ("sscanf failure of %s\n", pch));
+ return INVALID_HANDLE_VALUE;
+ }
+
+
+ if (c_hnds < unit + 1) {
+ prev_c_hnds = c_hnds;
+ c_hnds = unit + 1;
+ /* round up to closest multiple of 4 to avoid churn */
+ c_hnds = (c_hnds + 3) & ~3;
+ hnds = erealloc_zero(hnds, c_hnds * sizeof(hnds[0]),
+ prev_c_hnds * sizeof(hnds[0]));
+ }
+
+ if (NULL == hnds[unit].h) {
+ NTP_ENSURE(0 == hnds[unit].opens);
+ LIB_GETBUF(windev);
+ snprintf(windev, LIB_BUFLENGTH, "\\\\.\\COM%d", unit);
+ TRACE(1, ("windows device %s\n", windev));
+ *pwindev = windev;
+ hnds[unit].h =
+ CreateFile(
+ windev,
+ GENERIC_READ | GENERIC_WRITE,
+ 0, /* sharing prohibited */
+ NULL, /* default security */
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
+ NULL);
+ if (INVALID_HANDLE_VALUE == hnds[unit].h)
+ hnds[unit].h = NULL;
+ }
+
+ if (NULL != hnds[unit].h) {
+ /* think handle = dup(hnds[unit].h); */
+ DuplicateHandle(
+ GetCurrentProcess(),
+ hnds[unit].h,
+ GetCurrentProcess(),
+ &handle,
+ 0,
+ FALSE,
+ DUPLICATE_SAME_ACCESS
+ );
+ hnds[unit].opens++;
+ opens = hnds[unit].opens;
+ hnds[unit].dupes = erealloc(hnds[unit].dupes, opens *
+ sizeof(hnds[unit].dupes[0]));
+ hnds[unit].dupes[opens - 1] = handle;
+ return handle;
+ }
+
+ return INVALID_HANDLE_VALUE;
+}
+
+
+/*
+ * closeserial() is used in place of close by ntpd refclock I/O for ttys
+ */
+int
+closeserial(int fd)
+{
+ HANDLE h;
+ BOOL found;
+ size_t u;
+ size_t d;
+
+ h = (HANDLE)_get_osfhandle(fd);
+ if (INVALID_HANDLE_VALUE == h) {
+ errno = EBADF;
+ return -1;
+ }
+
+ d = 0; /* silence potent. uninit. warning */
+ found = FALSE;
+ for (u = 0; u < c_hnds; u++) {
+ for (d = 0; d < hnds[u].opens; d++) {
+ if (hnds[u].dupes[d] == h) {
+ found = TRUE;
+ break;
+ }
+ }
+ if (found)
+ break;
+ }
+ if (found) {
+ hnds[u].opens--;
+ if (d < hnds[u].opens)
+ memmove(&hnds[u].dupes[d],
+ &hnds[u].dupes[d + 1],
+ hnds[u].opens - d *
+ sizeof(hnds[u].dupes[d]));
+ if (0 == hnds[u].opens) {
+ CloseHandle(hnds[u].h);
+ hnds[u].h = NULL;
+ }
+ }
+
+ return close(fd);
+}
+
+/*
+ * isserialhandle() -- check if a handle is a COM port handle
+ */
+int isserialhandle(
+ HANDLE h
+ )
+{
+ size_t u;
+ size_t d;
+
+
+ for (u = 0; u < c_hnds; u++)
+ for (d = 0; d < hnds[u].opens; d++)
+ if (hnds[u].dupes[d] == h)
+ return TRUE;
+ return FALSE;
+}
+
+
+/*
+ * tty_open - open serial port for refclock special uses
+ *
+ * This routine opens a serial port for and returns the
+ * file descriptor if success and -1 if failure.
+ */
+int tty_open(
+ char *dev, /* device name pointer */
+ int access, /* O_RDWR */
+ int mode /* unused */
+ )
+{
+ HANDLE Handle;
+ char * windev;
+
+ /*
+ * open communication port handle
+ */
+ windev = NULL;
+ Handle = common_serial_open(dev, &windev);
+ windev = (windev)
+ ? windev
+ : dev;
+
+ if (Handle == INVALID_HANDLE_VALUE) {
+ msyslog(LOG_ERR, "tty_open: device %s CreateFile error: %m", windev);
+ errno = EMFILE; /* lie, lacking conversion from GetLastError() */
+ return -1;
+ }
+
+ return (int)_open_osfhandle((int)Handle, _O_TEXT);
+}
+
+
+/*
+ * refclock_open - open serial port for reference clock
+ *
+ * This routine opens a serial port for I/O and sets default options. It
+ * returns the file descriptor or -1 indicating failure.
+ */
+int refclock_open(
+ char * dev, /* device name pointer */
+ u_int speed, /* serial port speed (code) */
+ u_int flags /* line discipline flags */
+ )
+{
+ char * windev;
+ HANDLE h;
+ COMMTIMEOUTS timeouts;
+ DCB dcb;
+ DWORD dwEvtMask;
+ int fd;
+ int translate;
+
+ /*
+ * open communication port handle
+ */
+ windev = NULL;
+ h = common_serial_open(dev, &windev);
+ windev = (windev) ? windev : dev;
+
+ if (INVALID_HANDLE_VALUE == h) {
+ SAVE_ERRNO(
+ msyslog(LOG_ERR, "CreateFile(%s) error: %m",
+ windev);
+ )
+ return -1;
+ }
+
+ /* Change the input/output buffers to be large. */
+ if (!SetupComm(h, 1024, 1024)) {
+ SAVE_ERRNO(
+ msyslog(LOG_ERR, "SetupComm(%s) error: %m",
+ windev);
+ )
+ return -1;
+ }
+
+ dcb.DCBlength = sizeof(dcb);
+
+ if (!GetCommState(h, &dcb)) {
+ SAVE_ERRNO(
+ msyslog(LOG_ERR,
+ "GetCommState(%s) error: %m",
+ windev);
+ )
+ return -1;
+ }
+
+ switch (speed) {
+
+ case B300:
+ dcb.BaudRate = 300;
+ break;
+
+ case B1200:
+ dcb.BaudRate = 1200;
+ break;
+
+ case B2400:
+ dcb.BaudRate = 2400;
+ break;
+
+ case B4800:
+ dcb.BaudRate = 4800;
+ break;
+
+ case B9600:
+ dcb.BaudRate = 9600;
+ break;
+
+ case B19200:
+ dcb.BaudRate = 19200;
+ break;
+
+ case B38400:
+ dcb.BaudRate = 38400;
+ break;
+
+ case B57600:
+ dcb.BaudRate = 57600;
+ break;
+
+ case B115200:
+ dcb.BaudRate = 115200;
+ break;
+
+ default:
+ msyslog(LOG_ERR, "%s unsupported bps code %u", windev,
+ speed);
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return -1;
+ }
+
+ dcb.fBinary = TRUE;
+ dcb.fParity = TRUE;
+ dcb.fOutxCtsFlow = 0;
+ dcb.fOutxDsrFlow = 0;
+ dcb.fDtrControl = DTR_CONTROL_ENABLE;
+ dcb.fDsrSensitivity = 0;
+ dcb.fTXContinueOnXoff = TRUE;
+ dcb.fOutX = 0;
+ dcb.fInX = 0;
+ dcb.fErrorChar = 0;
+ dcb.fNull = 0;
+ dcb.fRtsControl = RTS_CONTROL_DISABLE;
+ dcb.fAbortOnError = 0;
+ dcb.ByteSize = 8;
+ dcb.StopBits = ONESTOPBIT;
+ dcb.Parity = NOPARITY;
+ dcb.ErrorChar = 0;
+ dcb.EofChar = 0;
+ if (LDISC_RAW & flags)
+ dcb.EvtChar = 0;
+ else
+ dcb.EvtChar = '\r';
+
+ if (!SetCommState(h, &dcb)) {
+ SAVE_ERRNO(
+ msyslog(LOG_ERR, "SetCommState(%s) error: %m",
+ windev);
+ )
+ return -1;
+ }
+
+ /* watch out for CR (dcb.EvtChar) as well as the CD line */
+ dwEvtMask = EV_RLSD;
+ if (LDISC_RAW & flags)
+ dwEvtMask |= EV_RXCHAR;
+ else
+ dwEvtMask |= EV_RXFLAG;
+ if (!SetCommMask(h, dwEvtMask)) {
+ SAVE_ERRNO(
+ msyslog(LOG_ERR, "SetCommMask(%s) error: %m",
+ windev);
+ )
+ return -1;
+ }
+
+ /* configure the handle to never block */
+ timeouts.ReadIntervalTimeout = MAXDWORD;
+ timeouts.ReadTotalTimeoutMultiplier = 0;
+ timeouts.ReadTotalTimeoutConstant = 0;
+ timeouts.WriteTotalTimeoutMultiplier = 0;
+ timeouts.WriteTotalTimeoutConstant = 0;
+
+ if (!SetCommTimeouts(h, &timeouts)) {
+ SAVE_ERRNO(
+ msyslog(LOG_ERR,
+ "Device %s SetCommTimeouts error: %m",
+ windev);
+ )
+ return -1;
+ }
+
+ translate = (LDISC_RAW & flags)
+ ? 0
+ : _O_TEXT;
+ fd = _open_osfhandle((int)h, translate);
+ /* refclock_open() long returned 0 on failure, avoid it. */
+ if (0 == fd) {
+ fd = _dup(0);
+ _close(0);
+ }
+
+ return fd;
+}
+
+
+int
+ioctl_tiocmget(
+ HANDLE h,
+ int *pi
+ )
+{
+ DWORD dw;
+
+ if (!GetCommModemStatus(h, &dw)) {
+ errno = ENOTTY;
+ return -1;
+ }
+
+ *pi = ((dw & MS_CTS_ON) ? TIOCM_CTS : 0)
+ | ((dw & MS_DSR_ON) ? TIOCM_DSR : 0)
+ | ((dw & MS_RLSD_ON) ? TIOCM_CAR : 0)
+ | ((dw & MS_RING_ON) ? TIOCM_RI : 0);
+
+ return 0;
+}
+
+
+int
+ioctl_tiocmset(
+ HANDLE h,
+ int *pi
+ )
+{
+ BOOL failed;
+ int result;
+
+ failed = !EscapeCommFunction(
+ h,
+ (*pi & TIOCM_RTS)
+ ? SETRTS
+ : CLRRTS
+ );
+
+ if (!failed)
+ failed = !EscapeCommFunction(
+ h,
+ (*pi & TIOCM_DTR)
+ ? SETDTR
+ : CLRDTR
+ );
+
+ if (failed) {
+ errno = ENOTTY;
+ result = -1;
+ } else
+ result = 0;
+
+ return result;
+}
+
+
+int
+ioctl(
+ int fd,
+ int op,
+ int *pi
+ )
+{
+ HANDLE h;
+ int result;
+ int modctl;
+
+ h = (HANDLE)_get_osfhandle(fd);
+
+ if (INVALID_HANDLE_VALUE == h) {
+ /* errno already set */
+ return -1;
+ }
+
+ switch (op) {
+
+ case TIOCMGET:
+ result = ioctl_tiocmget(h, pi);
+ break;
+
+ case TIOCMSET:
+ result = ioctl_tiocmset(h, pi);
+ break;
+
+ case TIOCMBIC:
+ result = ioctl_tiocmget(h, &modctl);
+ if (result < 0)
+ return result;
+ modctl &= ~(*pi);
+ result = ioctl_tiocmset(h, &modctl);
+ break;
+
+ case TIOCMBIS:
+ result = ioctl_tiocmget(h, &modctl);
+ if (result < 0)
+ return result;
+ modctl |= *pi;
+ result = ioctl_tiocmset(h, &modctl);
+ break;
+
+ default:
+ errno = EINVAL;
+ result = -1;
+ }
+
+ return result;
+}
+
+
+int
+tcsetattr(
+ int fd,
+ int optional_actions,
+ const struct termios * tios
+ )
+{
+ DCB dcb;
+ HANDLE h;
+
+ UNUSED_ARG(optional_actions);
+
+ h = (HANDLE)_get_osfhandle(fd);
+
+ if (INVALID_HANDLE_VALUE == h) {
+ /* errno already set */
+ return -1;
+ }
+
+ dcb.DCBlength = sizeof(dcb);
+ if (!GetCommState(h, &dcb)) {
+ errno = ENOTTY;
+ return -1;
+ }
+
+ switch (max(tios->c_ospeed, tios->c_ispeed)) {
+
+ case B300:
+ dcb.BaudRate = 300;
+ break;
+
+ case B1200:
+ dcb.BaudRate = 1200;
+ break;
+
+ case B2400:
+ dcb.BaudRate = 2400;
+ break;
+
+ case B4800:
+ dcb.BaudRate = 4800;
+ break;
+
+ case B9600:
+ dcb.BaudRate = 9600;
+ break;
+
+ case B19200:
+ dcb.BaudRate = 19200;
+ break;
+
+ case B38400:
+ dcb.BaudRate = 38400;
+ break;
+
+ case B57600:
+ dcb.BaudRate = 57600;
+ break;
+
+ case B115200:
+ dcb.BaudRate = 115200;
+ break;
+
+ default:
+ msyslog(LOG_ERR, "unsupported serial baud rate");
+ errno = EINVAL;
+ return -1;
+ }
+
+ switch (tios->c_cflag & CSIZE) {
+
+ case CS5:
+ dcb.ByteSize = 5;
+ break;
+
+ case CS6:
+ dcb.ByteSize = 6;
+ break;
+
+ case CS7:
+ dcb.ByteSize = 7;
+ break;
+
+ case CS8:
+ dcb.ByteSize = 8;
+ break;
+
+ default:
+ msyslog(LOG_ERR, "unsupported serial word size");
+ errno = EINVAL;
+ return FALSE;
+ }
+
+ if (PARENB & tios->c_cflag) {
+ dcb.fParity = TRUE;
+ dcb.Parity = (tios->c_cflag & PARODD)
+ ? ODDPARITY
+ : EVENPARITY;
+ } else {
+ dcb.fParity = FALSE;
+ dcb.Parity = NOPARITY;
+ }
+
+ dcb.StopBits = (CSTOPB & tios->c_cflag)
+ ? TWOSTOPBITS
+ : ONESTOPBIT;
+
+ if (!SetCommState(h, &dcb)) {
+ errno = ENOTTY;
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int
+tcgetattr(
+ int fd,
+ struct termios *tios
+ )
+{
+ DCB dcb;
+ HANDLE h;
+
+ h = (HANDLE)_get_osfhandle(fd);
+
+ if (INVALID_HANDLE_VALUE == h) {
+ /* errno already set */
+ return -1;
+ }
+
+ dcb.DCBlength = sizeof(dcb);
+
+ if (!GetCommState(h, &dcb)) {
+ errno = ENOTTY;
+ return -1;
+ }
+
+ /* Set c_ispeed & c_ospeed */
+
+ switch (dcb.BaudRate) {
+
+ case 300:
+ tios->c_ispeed = tios->c_ospeed = B300;
+ break;
+
+ case 1200:
+ tios->c_ispeed = tios->c_ospeed = B1200;
+ break;
+
+ case 2400:
+ tios->c_ispeed = tios->c_ospeed = B2400;
+ break;
+
+ case 4800:
+ tios->c_ispeed = tios->c_ospeed = B4800;
+ break;
+
+ case 9600:
+ tios->c_ispeed = tios->c_ospeed = B9600;
+ break;
+
+ case 19200:
+ tios->c_ispeed = tios->c_ospeed = B19200;
+ break;
+
+ case 38400:
+ tios->c_ispeed = tios->c_ospeed = B38400;
+ break;
+
+ case 57600:
+ tios->c_ispeed = tios->c_ospeed = B57600;
+ break;
+
+ case 115200:
+ tios->c_ispeed = tios->c_ospeed = B115200;
+ break;
+
+ default:
+ tios->c_ispeed = tios->c_ospeed = B9600;
+ }
+
+
+ switch (dcb.ByteSize) {
+ case 5:
+ tios->c_cflag = CS5;
+ break;
+
+ case 6:
+ tios->c_cflag = CS6;
+ break;
+
+ case 7:
+ tios->c_cflag = CS7;
+ break;
+
+ case 8:
+ default:
+ tios->c_cflag = CS8;
+ }
+
+ if (dcb.fParity) {
+ tios->c_cflag |= PARENB;
+
+ if (ODDPARITY == dcb.Parity)
+ tios->c_cflag |= PARODD;
+ }
+
+ if (TWOSTOPBITS == dcb.StopBits)
+ tios->c_cflag |= CSTOPB;
+
+ tios->c_iflag = 0;
+ tios->c_lflag = 0;
+ tios->c_line = 0;
+ tios->c_oflag = 0;
+
+ return 0;
+}
+
+
+int
+tcflush(
+ int fd,
+ int mode
+ )
+{
+ HANDLE h;
+ BOOL success;
+ DWORD flags;
+ int result;
+
+ h = (HANDLE)_get_osfhandle(fd);
+
+ if (INVALID_HANDLE_VALUE == h) {
+ /* errno already set */
+ return -1;
+ }
+
+ switch (mode) {
+
+ case TCIFLUSH:
+ flags = PURGE_RXCLEAR;
+ break;
+
+ case TCOFLUSH:
+ flags = PURGE_TXABORT;
+ break;
+
+ case TCIOFLUSH:
+ flags = PURGE_RXCLEAR | PURGE_TXABORT;
+ break;
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+
+ success = PurgeComm(h, flags);
+
+ if (success)
+ result = 0;
+ else {
+ errno = ENOTTY;
+ result = -1;
+ }
+
+ return result;
+}
+
diff --git a/ports/winnt/libntp/util_clockstuff.c b/ports/winnt/libntp/util_clockstuff.c
new file mode 100644
index 000000000000..e4bd0de3dd24
--- /dev/null
+++ b/ports/winnt/libntp/util_clockstuff.c
@@ -0,0 +1,26 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ntp_syslog.h"
+#include "ntp_stdlib.h"
+#include "ntp_unixtime.h"
+#include "clockstuff.h"
+
+int
+gettimeofday(
+ struct timeval * tv,
+ void * ignored
+ )
+{
+ struct timespec ts;
+
+ UNUSED_ARG(ignored);
+
+ getclock(TIMEOFDAY, &ts);
+
+ tv->tv_sec = ts.tv_sec;
+ tv->tv_usec = ts.tv_nsec / 10;
+
+ return 0;
+}
diff --git a/ports/winnt/libntp/win32_io.c b/ports/winnt/libntp/win32_io.c
new file mode 100644
index 000000000000..9e7a86179853
--- /dev/null
+++ b/ports/winnt/libntp/win32_io.c
@@ -0,0 +1,81 @@
+/* This file implements i/o calls that are specific to Windows */
+
+#include
+#include
+#include "ntp_fp.h"
+#include "ntp_net.h"
+#include "ntp_stdlib.h"
+#include "ntp_syslog.h"
+#include "win32_io.h"
+#include
+
+/*
+ * Define this macro to control the behavior of connection
+ * resets on UDP sockets. See Microsoft KnowledgeBase Article Q263823
+ * for details.
+ * Based on that article, it is surprising that a much newer winsock2.h
+ * does not define SIO_UDP_CONNRESET (the one that comes with VS 2008).
+ * NOTE: This requires that Windows 2000 systems install Service Pack 2
+ * or later.
+ */
+#ifndef SIO_UDP_CONNRESET
+#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
+#endif
+
+void
+InitSockets(
+ void
+ )
+{
+ WORD wVersionRequested;
+ WSADATA wsaData;
+ int err;
+
+ /* Need Winsock 2.0 or better */
+ wVersionRequested = MAKEWORD(2, 0);
+
+ err = WSAStartup(wVersionRequested, &wsaData);
+ if ( err != 0 ) {
+ SetLastError(err);
+ mfprintf(stderr, "No usable winsock: %m\n");
+ SetLastError(err);
+ msyslog(LOG_ERR, "No usable winsock: %m");
+ exit(1);
+ }
+}
+
+/*
+ * Windows 2000 systems incorrectly cause UDP sockets using WASRecvFrom
+ * to not work correctly, returning a WSACONNRESET error when a WSASendTo
+ * fails with an "ICMP port unreachable" response and preventing the
+ * socket from using the WSARecvFrom in subsequent operations.
+ * The function below fixes this, but requires that Windows 2000
+ * Service Pack 2 or later be installed on the system. NT 4.0
+ * systems are not affected by this and work correctly.
+ * See Microsoft Knowledge Base Article Q263823 for details of this.
+ */
+void
+connection_reset_fix(
+ SOCKET fd,
+ sockaddr_u * addr
+ )
+{
+ DWORD dw;
+ BOOL bNewBehavior = FALSE;
+ DWORD status;
+
+ /*
+ * disable bad behavior using IOCTL: SIO_UDP_CONNRESET
+ * NT 4.0 has no problem
+ */
+ if (isc_win32os_majorversion() >= 5) {
+ status = WSAIoctl(fd, SIO_UDP_CONNRESET, &bNewBehavior,
+ sizeof(bNewBehavior), NULL, 0,
+ &dw, NULL, NULL);
+ if (SOCKET_ERROR == status)
+ msyslog(LOG_ERR,
+ "connection_reset_fix() failed for address %s: %m",
+ stoa(addr));
+ }
+}
+
diff --git a/ports/winnt/ntpd/hopf_PCI_io.c b/ports/winnt/ntpd/hopf_PCI_io.c
new file mode 100644
index 000000000000..a1ba200f1171
--- /dev/null
+++ b/ports/winnt/ntpd/hopf_PCI_io.c
@@ -0,0 +1,335 @@
+/*
+ * hopf_PCI_io.c
+ * Read data from a hopf PCI clock using the ATLSoft WinNT driver.
+ *
+ * Date: 21.03.2000 Revision: 01.10
+ *
+ * Copyright (C) 1999, 2000 by Bernd Altmeier altmeier@ATLSoft.de
+ *
+ */
+
+/*
+ * Ignore nonstandard extension warning.
+ * This happens when including winioctl.h
+ */
+#pragma warning(disable: 4201)
+#define _FILESYSTEMFSCTL_
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "ntp_stdlib.h"
+#include "hopf_PCI_io.h"
+
+
+#define ATL_PASSTHROUGH_READ_TOSIZE (3 * sizeof(ULONG))
+#define ATL_PASSTHROUGH_READ_FROMSIZE 0
+#define IOCTL_ATLSOFT_PASSTHROUGH_READ CTL_CODE( \
+ FILE_DEVICE_UNKNOWN, \
+ 0x805, \
+ METHOD_BUFFERED, \
+ FILE_ANY_ACCESS)
+
+
+HANDLE hDevice = NULL; // this is the handle to the PCI Device
+
+HANDLE hRdEvent;
+OVERLAPPED Rdoverlapped;
+OVERLAPPED * pRdOverlapped;
+
+ULONG iobuffer[256];
+DWORD cbReturned;
+BOOL HaveBoard = FALSE;
+
+struct {
+ ULONG region;
+ ULONG offset;
+ ULONG count;
+} io_params;
+
+
+BOOL
+OpenHopfDevice(void)
+{
+ OSVERSIONINFO VersionInfo;
+ ULONG deviceNumber;
+ CHAR deviceName[255];
+
+ VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&VersionInfo);
+ switch (VersionInfo.dwPlatformId) {
+
+ case VER_PLATFORM_WIN32_WINDOWS: // Win95/98
+ return FALSE; // "NTP does not support Win 95-98."
+ break;
+
+ case VER_PLATFORM_WIN32_NT: // WinNT
+ deviceNumber = 0;
+ snprintf(deviceName, sizeof(deviceName),
+ "\\\\.\\hclk6039%d", deviceNumber + 1);
+ hDevice = CreateFile(
+ deviceName,
+ GENERIC_WRITE | GENERIC_READ,
+ FILE_SHARE_WRITE | FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_DELETE_ON_CLOSE | FILE_FLAG_OVERLAPPED,
+ NULL);
+ break;
+
+ default:
+ hDevice = INVALID_HANDLE_VALUE;
+ break;
+ } // end switch
+
+ if (INVALID_HANDLE_VALUE == hDevice) // the system didn't return a handle
+ return FALSE; //"A handle to the driver could not be obtained properly"
+
+ // an event to be used for async transfers
+ hRdEvent = CreateEvent(
+ NULL,
+ TRUE,
+ FALSE,
+ NULL);
+
+ if (INVALID_HANDLE_VALUE == hRdEvent)
+ return FALSE; // the system didn't return a handle
+
+ pRdOverlapped = &Rdoverlapped;
+ pRdOverlapped->hEvent = hRdEvent;
+
+ HaveBoard = TRUE; // board installed and we have access
+
+ return TRUE;
+} // end of OpenHopfDevice()
+
+
+BOOL
+CloseHopfDevice(void)
+{
+ CloseHandle(hRdEvent);// When done, close the handle to the driver
+
+ return CloseHandle(hDevice);
+} // end of CloseHopfDevice()
+
+
+void
+ReadHopfDevice(void)
+{
+ if (!HaveBoard)
+ return;
+
+ DeviceIoControl(
+ hDevice,
+ IOCTL_ATLSOFT_PASSTHROUGH_READ,
+ &io_params,
+ ATL_PASSTHROUGH_READ_TOSIZE,
+ iobuffer,
+ ATL_PASSTHROUGH_READ_FROMSIZE
+ + io_params.count * sizeof(ULONG),
+ &cbReturned,
+ pRdOverlapped
+ );
+}
+
+
+#ifdef NOTUSED
+void
+GetHardwareData(
+ LPDWORD Data32,
+ WORD Ofs
+ )
+{
+ io_params.region = 1;
+ io_params.offset = Ofs;
+ io_params.count = 1;
+ ReadHopfDevice();
+ *Data32 = iobuffer[0];
+}
+#endif /* NOTUSED */
+
+
+void
+GetHopfTime(
+ LPHOPFTIME Data,
+ DWORD Offset
+ )
+{
+ io_params.region = 1;
+ io_params.offset = Offset;
+ io_params.count = 4;
+
+ ReadHopfDevice();
+
+ Data->wHour = 0;
+ Data->wMinute = 0;
+ Data->wSecond = 0;
+ while (iobuffer[0] >= 60 * 60 * 1000) {
+ iobuffer[0] = iobuffer[0] - 60 * 60 * 1000;
+ Data->wHour++;
+ }
+ while (iobuffer[0] >= 60 * 1000) {
+ iobuffer[0] = iobuffer[0] - 60 * 1000;
+ Data->wMinute++;
+ }
+ while (iobuffer[0] >= 1000) {
+ iobuffer[0] = iobuffer[0] - 1000;
+ Data->wSecond++;
+ }
+ Data->wMilliseconds = LOWORD(iobuffer[0]);
+ Data->wDay = HIBYTE(HIWORD(iobuffer[1]));
+ Data->wMonth = LOBYTE(HIWORD(iobuffer[1]));
+ Data->wYear = LOWORD(iobuffer[1]);
+ Data->wDayOfWeek = HIBYTE(HIWORD(iobuffer[2]));
+ if (Data->wDayOfWeek == 7) // Dow Korrektur
+ Data->wDayOfWeek = 0;
+
+ io_params.region = 1;
+ io_params.offset += 0x08;
+ io_params.count = 1;
+
+ ReadHopfDevice();
+
+ Data->wStatus = LOBYTE(HIWORD(iobuffer[0]));
+}
+
+
+#ifdef NOTUSED
+void
+GetHopfLocalTime(
+ LPHOPFTIME Data
+ )
+{
+ DWORD Offset = 0;
+
+ GetHopfTime(Data, Offset);
+}
+#endif /* NOTUSED */
+
+
+void
+GetHopfSystemTime(
+ LPHOPFTIME Data
+ )
+{
+ DWORD Offset = 0x10;
+
+ GetHopfTime(Data,Offset);
+}
+
+
+#ifdef NOTUSED
+void
+GetSatData(
+ LPSATSTAT Data
+ )
+{
+ io_params.region = 1;
+ io_params.offset = 0xb0;
+ io_params.count = 5;
+
+ ReadHopfDevice();
+
+ Data->wVisible = HIBYTE(HIWORD(iobuffer[0]));
+ Data->wMode = LOBYTE(LOWORD(iobuffer[0]));
+ Data->wSat0 = HIBYTE(HIWORD(iobuffer[1]));
+ Data->wRat0 = LOBYTE(HIWORD(iobuffer[1]));
+ Data->wSat1 = HIBYTE(LOWORD(iobuffer[1]));
+ Data->wRat1 = LOBYTE(LOWORD(iobuffer[1]));
+ Data->wSat2 = HIBYTE(HIWORD(iobuffer[2]));
+ Data->wRat2 = LOBYTE(HIWORD(iobuffer[2]));
+ Data->wSat3 = HIBYTE(LOWORD(iobuffer[2]));
+ Data->wRat3 = LOBYTE(LOWORD(iobuffer[2]));
+ Data->wSat4 = HIBYTE(HIWORD(iobuffer[3]));
+ Data->wRat4 = LOBYTE(HIWORD(iobuffer[3]));
+ Data->wSat5 = HIBYTE(LOWORD(iobuffer[3]));
+ Data->wRat5 = LOBYTE(LOWORD(iobuffer[3]));
+ Data->wSat6 = HIBYTE(HIWORD(iobuffer[4]));
+ Data->wRat6 = LOBYTE(HIWORD(iobuffer[4]));
+ Data->wSat7 = HIBYTE(LOWORD(iobuffer[4]));
+ Data->wRat7 = LOBYTE(LOWORD(iobuffer[4]));
+}
+
+
+void
+GetDiffTime(
+ LPLONG Data
+ )
+{
+ io_params.region = 1;
+ io_params.offset = 0x0c;
+ io_params.count = 1;
+
+ ReadHopfDevice();
+
+ *Data = iobuffer[0];
+}
+
+
+void
+GetPosition(
+ LPGPSPOS Data
+ )
+{
+ io_params.region = 1;
+ io_params.offset = 0x90; // Positionsdaten Länge
+ io_params.count = 1;
+
+ ReadHopfDevice();
+
+ Data->wLongitude = iobuffer[0]; //in Millisekunden
+ io_params.region = 1;
+ io_params.offset = 0xa0; // Positionsdaten Breite
+ io_params.count = 1;
+
+ ReadHopfDevice();
+
+ Data->wLatitude = iobuffer[0];
+ Data->wAltitude = 0;
+}
+
+
+void
+GetHardwareVersion(
+ LPCLOCKVER Data
+ )
+{
+ int i;
+
+ io_params.region = 1;
+ io_params.offset = 0x50;
+ io_params.count = 12;
+
+ ReadHopfDevice();
+
+ Data->cVersion[0] = '\0';
+ iobuffer[13] = 0;
+ for (i = 0; i < 13; i++) {
+ Data->cVersion[i * 4 ] = HIBYTE(HIWORD(iobuffer[i]));
+ Data->cVersion[i * 4 + 1] = LOBYTE(HIWORD(iobuffer[i]));
+ Data->cVersion[i * 4 + 2] = HIBYTE(LOWORD(iobuffer[i]));
+ Data->cVersion[i * 4 + 3] = LOBYTE(LOWORD(iobuffer[i]));
+ }
+}
+
+
+void
+GetDCFAntenne(
+ LPDCFANTENNE Data
+ )
+{
+ io_params.region = 1;
+ io_params.offset = 0xcc;
+ io_params.count = 1;
+
+ ReadHopfDevice();
+ Data->bStatus1 = HIBYTE(HIWORD(iobuffer[0]));
+ Data->bStatus = LOBYTE(HIWORD(iobuffer[0]));
+ Data->wAntValue = LOWORD(iobuffer[0]);
+}
+#endif /* NOTUSED */
+
diff --git a/ports/winnt/ntpd/nt_clockstuff.c b/ports/winnt/ntpd/nt_clockstuff.c
new file mode 100644
index 000000000000..907c9f4ee3e0
--- /dev/null
+++ b/ports/winnt/ntpd/nt_clockstuff.c
@@ -0,0 +1,1748 @@
+/* Windows NT Clock Routines
+ *
+ * Created by Sven Dietrich sven@inter-yacht.com
+ *
+ * New interpolation scheme by Dave Hart in
+ * February 2009 overcomes 500us-1ms inherent jitter with the older
+ * scheme, first identified by Peter Rosin (nee Ekberg)
+ * in 2003 [Bug 216].
+ *
+ * Note: The Windows port of ntpd uses the C99-snprintf replacement for
+ * (v)snprintf(), also used by msyslog(), which does not understand the
+ * printf format specifier %I64d, only the more common %lld. With the
+ * minimum supported compiler raised to Visual C++ 2005 in ntp-dev in
+ * August 2011, all MS C runtime routines also understand %lld and %llu.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include /* our private version */
+
+#if defined(_MSC_VER) && _MSC_VER >= 1400 /* VS 2005 */
+#include /* for __rdtsc() */
+#endif
+
+#ifdef HAVE_PPSAPI
+#include
+/*
+ * ports/winnt/include/timepps.h defines EOPNOTSUPP for compatibility
+ * with PPSAPI on other platforms. ports/winnt/include/isc/net.h has
+ * #define EOPNOTSUPP WSAEOPNOTSUPP, so to avoid a macro redefinition
+ * warning undefine it.
+ */
+#undef EOPNOTSUPP
+#endif /* HAVE_PPSAPI */
+
+#include "ntp_stdlib.h"
+#include "ntp_unixtime.h"
+#include "ntp_timer.h"
+#include "ntp_assert.h"
+#include "ntp_leapsec.h"
+#include "clockstuff.h"
+#include "ntservice.h"
+#include "ntpd.h"
+#include "ntpd-opts.h"
+
+extern double sys_residual; /* residual from previous adjustment */
+
+/*
+ * Include code to possibly modify the MM timer while the service is active.
+ */
+
+/*
+ * Whether or not MM timer modifications takes place is still controlled
+ * by the variable below which is initialized by a default value but
+ * might be changed depending on a command line switch.
+ */
+static int modify_mm_timer = MM_TIMER_LORES;
+
+#define MM_TIMER_INTV 1 /* the interval we'd want to set the MM timer to [ms] */
+
+static UINT wTimerRes;
+
+BOOL init_randfile();
+
+static long last_Adj = 0;
+
+#define LS_CORR_INTV_SECS 2 /* seconds to apply leap second correction */
+#define LS_CORR_INTV ( 1000ul * LS_CORR_INTV_SECS )
+#define LS_CORR_LIMIT ( 250ul ) // quarter second
+
+typedef union ft_ull {
+ FILETIME ft;
+ ULONGLONG ull;
+ LONGLONG ll;
+ LARGE_INTEGER li;
+} FT_ULL;
+
+/* leap second stuff */
+static FT_ULL ls_ft;
+static DWORD ls_time_adjustment;
+
+static BOOL winnt_time_initialized = FALSE;
+static BOOL winnt_use_interpolation = FALSE;
+static unsigned clock_thread_id;
+
+
+void WINAPI GetInterpTimeAsFileTime(LPFILETIME pft);
+static void StartClockThread(void);
+static void tune_ctr_freq(LONGLONG, LONGLONG);
+void StopClockThread(void);
+void atexit_revert_mm_timer(void);
+void win_time_stepped(void);
+
+static HANDLE clock_thread = NULL;
+static HANDLE TimerThreadExitRequest = NULL;
+
+/*
+ * interp_time estimates time in 100ns units
+ * based on a performance counter value given.
+ * The 2nd parameter indicates if this is
+ * part of a current time-of-day calculation.
+ */
+ULONGLONG interp_time(ULONGLONG, BOOL);
+
+/*
+ * add_counter_time_pair is called by the
+ * high priority clock thread with a new
+ * sample.
+ */
+void add_counter_time_pair(ULONGLONG, LONGLONG);
+
+/*
+ * globals used by the above two functions to
+ * implement the counter/time history
+ */
+#define BASELINES_TOT 256
+#define BASELINES_USED 64
+
+static volatile int newest_baseline = 0;
+static volatile int newest_baseline_gen = 0;
+static ULONGLONG baseline_counts[BASELINES_TOT] = {0};
+static LONGLONG baseline_times[BASELINES_TOT] = {0};
+
+#define CLOCK_BACK_THRESHOLD 100 /* < 10us unremarkable */
+static ULONGLONG clock_backward_max = CLOCK_BACK_THRESHOLD;
+static int clock_backward_count;
+
+/**
+ * A flag set on Windows versions which ignore small time adjustments.
+ *
+ * Windows Vista and Windows 7 ignore TimeAdjustment less than 16.
+ * @note Has to be checked for Windows Server 2008/2012 and Windows 8.
+ * Ref: http://support.microsoft.com/kb/2537623, bug #2328
+ */
+static BOOL os_ignores_small_adjustment;
+
+/*
+ * clockperiod is the period used for SetSystemTimeAdjustment
+ * slewing calculations but does not necessarily correspond
+ * to the precision of the OS clock. Prior to Windows Vista
+ * (6.0) the two were identical. In 100ns units.
+ */
+static DWORD clockperiod;
+
+/*
+ * os_clock_precision is the observed precision of the OS
+ * clock, meaning the increment between discrete values. This
+ * is currently calculated once at startup. 100ns units.
+ */
+static ULONGLONG os_clock_precision;
+
+/*
+ * NomPerfCtrFreq is from QueryPerformanceFrequency and is the
+ * number of performance counter beats per second. PerfCtrFreq
+ * starts from NomPerfCtrFreq but is maintained using a sliding
+ * window average based on actual performance counter behavior,
+ * to allow us to better tolerate powersaving measures that
+ * alter the effective frequency of the processor cycle counter
+ * (TSC) which sometimes underlies QueryPerformanceCounter.
+ *
+ * Note that the OS is unlikely to be so subtle in its internal
+ * scheduling of waitable timers, presumably done using the
+ * performance counter. Therefore our calculations for
+ * interpolated time should be based on PerfCtrFreq but our
+ * calculations for SetWaitableTimer should assume the OS will
+ * convert from FILETIME 100ns units to performance counter
+ * beats using the nominal frequency.
+ */
+
+volatile ULONGLONG PerfCtrFreq = 0;
+ ULONGLONG NomPerfCtrFreq = 0;
+
+/*
+ * If we're using RDTSC beating at the same rate as
+ * QueryPerformanceCounter, there is a systemic
+ * offset we need to account for when using
+ * counterstamps from serialpps.sys, which are
+ * always from QPC (actually KeQueryPerformanceCounter).
+ */
+static LONGLONG QPC_offset = 0;
+
+/*
+ * Substitute RDTSC for QueryPerformanceCounter()?
+ */
+static int use_pcc = -1;
+
+/*
+ * Restrict threads that call QPC/RDTSC to one CPU?
+ */
+static int lock_interp_threads = -1;
+
+/*
+ * ppm_per_adjust_unit is parts per million effect on the OS
+ * clock per slewing adjustment unit per second. Per haps.
+ */
+static DOUBLE ppm_per_adjust_unit;
+
+/*
+ * wintickadj emulates the functionality provided by unix tickadj,
+ * providing a baseline clock correction if needed to get the
+ * clock within a few hundred PPM of correct frequency.
+ */
+static long wintickadj;
+
+static void choose_interp_counter(void);
+static int is_qpc_built_on_pcc(void);
+
+/*
+ * performance counter frequency observations
+ */
+#define TUNE_CTR_DEPTH 3 /* running avg depth */
+
+static HANDLE ctr_freq_timer = INVALID_HANDLE_VALUE;
+static ULONGLONG tune_ctr_freq_max_interval;
+static unsigned tune_ctr_period;
+void start_ctr_freq_timer(ULONGLONG now_time);
+void reset_ctr_freq_timer(ULONGLONG when, ULONGLONG now);
+void reset_ctr_freq_timer_abs(ULONGLONG when);
+
+/* round a Windows time to the next bottom of the second */
+
+#define ROUND_TO_NEXT_SEC_BOTTOM(t) \
+do { \
+ (t) += 3 * HECTONANOSECONDS / 2 - 1; \
+ (t) /= HECTONANOSECONDS; \
+ (t) *= HECTONANOSECONDS; \
+ (t) -= HECTONANOSECONDS / 2; \
+} while (0)
+
+/*
+ * NT native time format is 100's of nanoseconds since 1601-01-01.
+ * Helpers for converting between "hectonanoseconds" and the
+ * performance counter scale from which interpolated time is
+ * derived.
+ */
+#define HNS2PERF(hns) ((hns) * PerfCtrFreq / HECTONANOSECONDS)
+#define PERF2HNS(ctr) ((ctr) * HECTONANOSECONDS / PerfCtrFreq)
+
+
+#if defined(_MSC_VER) && _MSC_VER >= 1400 /* VS 2005 */
+#define get_pcc() __rdtsc()
+#else
+/*
+ * something like this can be used for a compiler without __rdtsc()
+ */
+ULONGLONG __forceinline
+get_pcc(void)
+{
+ /* RDTSC returns in EDX:EAX, same as C compiler */
+ __asm {
+ RDTSC
+ }
+}
+#endif
+
+
+/*
+ * perf_ctr() returns the current performance counter value,
+ * from QueryPerformanceCounter or RDTSC.
+ */
+ULONGLONG WINAPI
+perf_ctr(void)
+{
+ FT_ULL ft;
+
+ if (use_pcc)
+ return get_pcc();
+ else {
+ QueryPerformanceCounter(&ft.li);
+ return ft.ull;
+ }
+}
+
+
+/*
+ * init_small_adjustment
+ *
+ * Set variable os_ignores_small_adjustment
+ *
+ */
+static void init_small_adjustment(void)
+{
+ OSVERSIONINFO vi;
+ memset(&vi, 0, sizeof(vi));
+ vi.dwOSVersionInfoSize = sizeof(vi);
+
+ if (!GetVersionEx(&vi)) {
+ msyslog(LOG_WARNING, "GetVersionEx failed with error code %d.", GetLastError());
+ os_ignores_small_adjustment = FALSE;
+ return;
+ }
+
+ if (vi.dwMajorVersion == 6 && vi.dwMinorVersion == 1) {
+ // Windows 7 and Windows Server 2008 R2
+ //
+ // Windows 7 is documented as affected.
+ // Windows Server 2008 R2 is assumed affected.
+ os_ignores_small_adjustment = TRUE;
+ } else if (vi.dwMajorVersion == 6 && vi.dwMinorVersion == 0) {
+ // Windows Vista and Windows Server 2008
+ //
+ // Windows Vista is documented as affected.
+ // Windows Server 2008 is assumed affected.
+ os_ignores_small_adjustment = TRUE;
+ } else {
+ os_ignores_small_adjustment = FALSE;
+ }
+}
+
+
+/*
+ * choose_interp_counter - select between QueryPerformanceCounter and
+ * the x86 processor cycle counter (TSC).
+ */
+static void
+choose_interp_counter(void)
+{
+ const char * ntpd_pcc_freq_text;
+ int qpc_built_on_pcc;
+
+ /*
+ * Regardless of whether we actually use RDTSC, first determine
+ * if QueryPerformanceCounter is built on it, so that we can
+ * decide whether it's prudent to lock QPC-consuming threads to
+ * a particular CPU.
+ */
+ qpc_built_on_pcc = is_qpc_built_on_pcc();
+ lock_interp_threads = qpc_built_on_pcc;
+
+ /*
+ * It's time to make some more permanent knobs,
+ * but for right now the RDTSC aka PCC dance on x86 is:
+ *
+ * 1. With none of these variables defined, only QPC
+ * is used because there is no reliable way to
+ * detect counter frequency variation after ntpd
+ * startup implemented.
+ * 2. We need a better knob, but for now if you know
+ * your RDTSC / CPU frequency is invariant, set
+ * NTPD_PCC and assuming your QPC is based on the
+ * PCC as well, RDTSC will be substituted.
+ * 3. More forcefully, you can jam in a desired exact
+ * processor frequency, expressed in cycles per
+ * second by setting NTPD_PCC_FREQ=398125000, for
+ * example, if yor actual known CPU frequency is
+ * 398.125 MHz, and NTPD_PCC doesn't work because
+ * QueryPerformanceCounter is implemented using
+ * another counter. It is very easy to make ntpd
+ * fall down if the NTPD_PCC_FREQ value isn't very
+ * close to the observed RDTSC units per second.
+ *
+ * Items 2 and 3 could probably best be combined into one
+ * new windows-specific command line switch such as
+ * ntpd --pcc
+ * or
+ * ntpd --pcc=398125000
+ *
+ * They are currently tied to Windows because that is
+ * the only ntpd port with its own interpolation, and
+ * to x86/x64 because no one has ported the Windows
+ * ntpd port to the sole remaining alternative, Intel
+ * Itanium.
+ */
+ if (HAVE_OPT(PCCFREQ))
+ ntpd_pcc_freq_text = OPT_ARG(PCCFREQ);
+ else
+ ntpd_pcc_freq_text = getenv("NTPD_PCC_FREQ");
+
+ if (!HAVE_OPT(USEPCC)
+ && NULL == ntpd_pcc_freq_text
+ && NULL == getenv("NTPD_PCC")) {
+ use_pcc = 0;
+ return;
+ }
+
+ if (!qpc_built_on_pcc && NULL == ntpd_pcc_freq_text) {
+ use_pcc = 0;
+ return;
+ }
+
+ use_pcc = 1;
+ if (ntpd_pcc_freq_text != NULL)
+ sscanf(ntpd_pcc_freq_text,
+ "%llu",
+ &NomPerfCtrFreq);
+
+ NLOG(NLOG_CLOCKINFO)
+ msyslog(LOG_INFO,
+ "using processor cycle counter "
+ "%.3f MHz",
+ NomPerfCtrFreq / 1e6);
+ return;
+}
+
+
+/*
+ * is_qpc_built_on_pcc - test if QueryPerformanceCounter runs at the
+ * same rate as the processor cycle counter (TSC).
+ */
+static int
+is_qpc_built_on_pcc(void)
+{
+ LONGLONG offset;
+ FT_ULL ft1;
+ FT_ULL ft2;
+ FT_ULL ft3;
+ FT_ULL ft4;
+ FT_ULL ft5;
+
+ NTP_REQUIRE(NomPerfCtrFreq != 0);
+
+ QueryPerformanceCounter(&ft1.li);
+ ft2.ull = get_pcc();
+ Sleep(1);
+ QueryPerformanceCounter(&ft3.li);
+ Sleep(1);
+ ft4.ull = get_pcc();
+ Sleep(1);
+ QueryPerformanceCounter(&ft5.li);
+
+ offset = ft2.ull - ft1.ull;
+ ft3.ull += offset;
+ ft5.ull += offset;
+
+ if (ft2.ull <= ft3.ull &&
+ ft3.ull <= ft4.ull &&
+ ft4.ull <= ft5.ull) {
+
+ QPC_offset = offset;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+/*
+ * Request Multimedia Timer
+ */
+void
+set_mm_timer(
+ int timerres
+ )
+{
+ modify_mm_timer = timerres;
+}
+
+/*
+ * adj_systime - called once every second to discipline system clock.
+ * Normally, the offset passed in (parameter now) is in the range
+ * [-NTP_MAXFREQ, NTP_MAXFREQ]. However, at EVNT_NSET, a much larger
+ * slew is requested if the initial offset is less than the step
+ * threshold, in the range [-step, step] where step is the step
+ * threshold, 128 msec by default. For the remainder of the frequency
+ * training interval, adj_systime is called with 0 offset each second
+ * and slew the large offset at 500 PPM (500 usec/sec).
+ * Returns 1 if okay, 0 if trouble.
+ */
+int
+adj_systime(
+ double now
+ )
+{
+ /* ntp time scale origin as ticks since 1601-01-01 */
+ static const ULONGLONG HNS_JAN_1900 = 94354848000000000ull;
+
+ static DWORD ls_start_tick; /* start of slew in 1ms ticks */
+
+ static double adjtime_carry;
+ double dtemp;
+ u_char isneg;
+ BOOL rc;
+ long TimeAdjustment;
+ SYSTEMTIME st;
+ DWORD ls_elapsed;
+ FT_ULL curr_ft;
+ leap_result_t lsi;
+
+ /*
+ * Add the residual from the previous adjustment to the new
+ * adjustment, bound and round.
+ */
+ dtemp = adjtime_carry + sys_residual + now;
+ adjtime_carry = 0.;
+ sys_residual = 0.;
+ if (dtemp < 0) {
+ isneg = TRUE;
+ dtemp = -dtemp;
+ } else {
+ isneg = FALSE;
+ }
+
+ if (dtemp > NTP_MAXFREQ) {
+ adjtime_carry = dtemp - NTP_MAXFREQ;
+ dtemp = NTP_MAXFREQ;
+ }
+
+ if (isneg) {
+ dtemp = -dtemp;
+ adjtime_carry = -adjtime_carry;
+ }
+
+ dtemp = dtemp * 1e6;
+
+ /*
+ * dtemp is in micro seconds. NT uses 100 ns units,
+ * so a unit change in TimeAdjustment corresponds
+ * to slewing 10 ppm on a 100 Hz system. Calculate
+ * the number of 100ns units to add, using OS tick
+ * frequency as per suggestion from Harry Pyle,
+ * and leave the remainder in dtemp
+ */
+ TimeAdjustment = (long)(dtemp / ppm_per_adjust_unit +
+ ((isneg)
+ ? -0.5
+ : 0.5));
+
+ if (os_ignores_small_adjustment) {
+ /*
+ * As the OS ignores adjustments smaller than 16, we need to
+ * leave these small adjustments in sys_residual, causing
+ * the small values to be averaged over time.
+ */
+ if (TimeAdjustment > -16 && TimeAdjustment < 16) {
+ TimeAdjustment = 0;
+ }
+ }
+
+ dtemp -= TimeAdjustment * ppm_per_adjust_unit;
+
+
+ /* If a piping-hot close leap second is pending for the end
+ * of this day, determine the UTC time stamp when the transition
+ * must take place. (Calculated in the current leap era!)
+ */
+ if (leapsec >= LSPROX_ALERT) {
+ if (0 == ls_ft.ull && leapsec_frame(&lsi)) {
+ if (lsi.tai_diff > 0) {
+ /* A leap second insert is scheduled at the end
+ * of the day. Since we have not yet computed the
+ * time stamp, do it now. Signal electric mode
+ * for this insert. We start processing 1 second early
+ * because we want to slew over 2 seconds.
+ */
+ ls_ft.ull = lsi.ttime.Q_s * HECTONANOSECONDS
+ + HNS_JAN_1900;
+ FileTimeToSystemTime(&ls_ft.ft, &st);
+ msyslog(LOG_NOTICE,
+ "Detected positive leap second announcement "
+ "for %04d-%02d-%02d %02d:%02d:%02d UTC",
+ st.wYear, st.wMonth, st.wDay,
+ st.wHour, st.wMinute, st.wSecond);
+ /* slew starts with last second before insertion!
+ * And we have to tell the core that we deal with it.
+ */
+ ls_ft.ull -= (HECTONANOSECONDS + HECTONANOSECONDS/2);
+ leapsec_electric(TRUE);
+ } else if (lsi.tai_diff < 0) {
+ /* Do not handle negative leap seconds here. If this
+ * happens, let the system step.
+ */
+ leapsec_electric(FALSE);
+ }
+ }
+ } else {
+ /* The leap second announcement is gone. Happens primarily after
+ * the leap transition, but can also be due to a clock step.
+ * Disarm the leap second, but only if there is one scheduled
+ * and not currently in progress!
+ */
+ if (ls_ft.ull != 0 && ls_time_adjustment == 0) {
+ ls_ft.ull = 0;
+ msyslog(LOG_NOTICE, "Leap second announcement disarmed");
+ }
+ }
+
+ /*
+ * If the time stamp for the next leap second has been set
+ * then check if the leap second must be handled. We use
+ * free-running milliseconds from 'GetTickCount()', which
+ * is documented as not affected by clock and/or speed
+ * adjustments.
+ */
+ if (ls_ft.ull != 0) {
+ if (0 == ls_time_adjustment) { /* has not yet been scheduled */
+ GetSystemTimeAsFileTime(&curr_ft.ft);
+ if (curr_ft.ull >= ls_ft.ull) {
+ ls_ft.ull = _UI64_MAX; /* guard against second schedule */
+ ls_time_adjustment = clockperiod / LS_CORR_INTV_SECS;
+ ls_start_tick = GetTickCount();
+ msyslog(LOG_NOTICE, "Started leap second insertion.");
+ }
+ ls_elapsed = 0;
+ } else { /* leap sec adjustment has been scheduled previously */
+ ls_elapsed = GetTickCount() - ls_start_tick;
+ }
+
+ if (ls_time_adjustment != 0) { /* leap second adjustment is currently active */
+ if (ls_elapsed > (LS_CORR_INTV - LS_CORR_LIMIT)) {
+ ls_time_adjustment = 0; /* leap second adjustment done */
+ msyslog(LOG_NOTICE, "Finished leap second insertion.");
+ }
+
+ /*
+ * NOTE: While the system time is slewed during the leap second
+ * the interpolation function which is based on the performance
+ * counter does not account for the slew.
+ */
+ TimeAdjustment -= ls_time_adjustment;
+ }
+ }
+
+
+ sys_residual = dtemp / 1e6;
+ DPRINTF(3, ("adj_systime: %.9f -> %.9f residual %.9f",
+ now, 1e-6 * (TimeAdjustment * ppm_per_adjust_unit),
+ sys_residual));
+ if (0. == adjtime_carry)
+ DPRINTF(3, ("\n"));
+ else
+ DPRINTF(3, (" adjtime %.9f\n", adjtime_carry));
+
+ /* only adjust the clock if adjustment changes */
+ TimeAdjustment += wintickadj;
+ if (last_Adj != TimeAdjustment) {
+ last_Adj = TimeAdjustment;
+ DPRINTF(2, ("SetSystemTimeAdjustment(%+ld)\n", TimeAdjustment));
+ rc = SetSystemTimeAdjustment(clockperiod + TimeAdjustment, FALSE);
+ if (!rc)
+ msyslog(LOG_ERR, "Can't adjust time: %m");
+ } else {
+ rc = TRUE;
+ }
+
+ return rc;
+}
+
+
+void
+init_winnt_time(void)
+{
+ static const char settod[] = "settimeofday=\"SetSystemTime\"";
+ char szMsgPath[MAX_PATH+1];
+ HANDLE hToken = INVALID_HANDLE_VALUE;
+ TOKEN_PRIVILEGES tkp;
+ TIMECAPS tc;
+ BOOL noslew;
+ DWORD adjclockperiod;
+ LARGE_INTEGER Freq;
+ FT_ULL initial_hectonanosecs;
+ FT_ULL next_hectonanosecs;
+ double adjppm;
+ double rawadj;
+ char * pch;
+
+ if (winnt_time_initialized)
+ return;
+
+ /*
+ * Make sure the service is initialized
+ * before we do anything else
+ */
+ ntservice_init();
+
+ /* Set up the Console Handler */
+ if (!SetConsoleCtrlHandler(OnConsoleEvent, TRUE)) {
+ msyslog(LOG_ERR, "Can't set console control handler: %m");
+ }
+
+ /* Set the Event-ID message-file name. */
+ if (!GetModuleFileName(NULL, szMsgPath, sizeof(szMsgPath))) {
+ msyslog(LOG_ERR, "GetModuleFileName(PGM_EXE_FILE) failed: %m");
+ exit(1);
+ }
+
+ /* Initialize random file before OpenSSL checks */
+ if (!init_randfile())
+ msyslog(LOG_ERR, "Unable to initialize .rnd file");
+
+#pragma warning(push)
+#pragma warning(disable: 4127) /* conditional expression is constant */
+
+#ifdef DEBUG
+ if (SIZEOF_TIME_T != sizeof(time_t)
+ || SIZEOF_INT != sizeof(int)
+ || SIZEOF_SIGNED_CHAR != sizeof(char)) {
+ msyslog(LOG_ERR, "config.h SIZEOF_* macros wrong, fatal");
+ exit(1);
+ }
+#endif
+
+#pragma warning(pop)
+
+ init_small_adjustment();
+ leapsec_electric(TRUE);
+
+ /*
+ * Get privileges needed for fiddling with the clock
+ */
+
+ /* get the current process token handle */
+ if (!OpenProcessToken(
+ GetCurrentProcess(),
+ TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
+ &hToken)) {
+ msyslog(LOG_ERR, "OpenProcessToken failed: %m");
+ exit(-1);
+ }
+ /* get the LUID for system-time privilege. */
+ LookupPrivilegeValue(NULL, SE_SYSTEMTIME_NAME, &tkp.Privileges[0].Luid);
+ tkp.PrivilegeCount = 1; /* one privilege to set */
+ tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+
+ /* get set-time privilege for this process. */
+ AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
+ (PTOKEN_PRIVILEGES) NULL, 0);
+
+ /* cannot use return value of AdjustTokenPrivileges. */
+ /* (success does not indicate all privileges were set) */
+ if (GetLastError() != ERROR_SUCCESS) {
+ msyslog(LOG_ERR, "AdjustTokenPrivileges failed: %m");
+ /* later set time call will probably fail */
+ }
+
+ CloseHandle(hToken);
+ hToken = INVALID_HANDLE_VALUE;
+
+ /*
+ * Say how we're setting the time of day
+ */
+ set_sys_var(settod, sizeof(settod), RO);
+
+ /*
+ * ntpd on Windows has always raised its priority, without
+ * requiring -N as on Unix. Since Windows ntpd doesn't share
+ * the history of unix ntpd of once having no -N and therefore
+ * needing to be invoked under nice, there is no reason to
+ * bring it in line with the Unix version in this regard.
+ * Instsrv assumes ntpd is invoked with no arguments, and
+ * upgrading users would be negatively surprised by the
+ * poor timekeeping if they failed to add -N as part of
+ * upgrading were we to correct this platform difference.
+ */
+ if (-1 == setpriority(PRIO_PROCESS, 0, NTP_PRIO))
+ exit(-1);
+
+ /* Determine the existing system time slewing */
+ if (!GetSystemTimeAdjustment(&adjclockperiod, &clockperiod, &noslew)) {
+ msyslog(LOG_ERR, "GetSystemTimeAdjustment failed: %m");
+ exit(-1);
+ }
+
+ /*
+ * If there is no slewing before ntpd, adjclockperiod and clockperiod
+ * will be equal. Any difference is carried into adj_systime's first
+ * pass as the previous adjustment.
+ */
+ last_Adj = adjclockperiod - clockperiod;
+
+ if (last_Adj)
+ msyslog(LOG_INFO,
+ "Clock interrupt period %.3f msec "
+ "(startup slew %.1f usec/period)",
+ clockperiod / 1e4,
+ last_Adj / 10.);
+ else
+ msyslog(LOG_INFO,
+ "Clock interrupt period %.3f msec",
+ clockperiod / 1e4);
+
+ /*
+ * Calculate the time adjustment resulting from incrementing
+ * units per tick by 1 unit for 1 second
+ */
+ ppm_per_adjust_unit = 1e6 / clockperiod;
+
+ pch = getenv("NTPD_TICKADJ_PPM");
+ if (pch != NULL && 1 == sscanf(pch, "%lf", &adjppm)) {
+ rawadj = adjppm / ppm_per_adjust_unit;
+ rawadj += (rawadj < 0)
+ ? -0.5
+ : 0.5;
+ wintickadj = (long)rawadj;
+ msyslog(LOG_INFO,
+ "Using NTPD_TICKADJ_PPM %+g ppm (%+ld)",
+ adjppm, wintickadj);
+ }
+
+ /* get the performance counter ticks per second */
+ if (!QueryPerformanceFrequency(&Freq) || !Freq.QuadPart) {
+ msyslog(LOG_ERR, "QueryPerformanceFrequency failed: %m");
+ exit(-1);
+ }
+
+ NomPerfCtrFreq = PerfCtrFreq = Freq.QuadPart;
+ msyslog(LOG_INFO,
+ "Performance counter frequency %.3f MHz",
+ PerfCtrFreq / 1e6);
+
+ /*
+ * With a precise system clock, our interpolation decision is
+ * a slam dunk.
+ */
+ if (NULL != pGetSystemTimePreciseAsFileTime) {
+ winnt_use_interpolation = FALSE;
+ winnt_time_initialized = TRUE;
+
+ return;
+ }
+
+ /*
+ * Implement any multimedia timer manipulation requested via -M
+ * option. This is rumored to be unneeded on Win8 with the
+ * introduction of the precise (interpolated) system clock.
+ */
+ if (modify_mm_timer) {
+ if (timeGetDevCaps(&tc, sizeof(tc)) == TIMERR_NOERROR) {
+ wTimerRes = min(max(tc.wPeriodMin, MM_TIMER_INTV), tc.wPeriodMax);
+ timeBeginPeriod(wTimerRes);
+ atexit(atexit_revert_mm_timer);
+
+ msyslog(LOG_INFO, "MM timer resolution: %u..%u msec, set to %u msec",
+ tc.wPeriodMin, tc.wPeriodMax, wTimerRes );
+ } else {
+ msyslog(LOG_ERR, "Multimedia timer unavailable");
+ }
+ }
+
+ /*
+ * Spin on GetSystemTimeAsFileTime to determine its
+ * granularity. Prior to Windows Vista this is
+ * typically the same as the clock period.
+ */
+ GetSystemTimeAsFileTime(&initial_hectonanosecs.ft);
+ do {
+ GetSystemTimeAsFileTime(&next_hectonanosecs.ft);
+ } while (initial_hectonanosecs.ull == next_hectonanosecs.ull);
+
+ os_clock_precision = next_hectonanosecs.ull -
+ initial_hectonanosecs.ull;
+
+ msyslog(LOG_INFO,
+ "Windows clock precision %.3f msec, min. slew %.3f ppm/s",
+ os_clock_precision / 1e4, ppm_per_adjust_unit);
+
+ winnt_time_initialized = TRUE;
+
+ choose_interp_counter();
+
+ if (getenv("NTPD_USE_SYSTEM_CLOCK") ||
+ (os_clock_precision < 4 * 10000 &&
+ !getenv("NTPD_USE_INTERP_DANGEROUS"))) {
+ msyslog(LOG_INFO, "using Windows clock directly");
+ } else {
+ winnt_use_interpolation = TRUE;
+ get_sys_time_as_filetime = GetInterpTimeAsFileTime;
+ StartClockThread();
+ }
+}
+
+
+void
+atexit_revert_mm_timer(void)
+{
+ timeEndPeriod(wTimerRes);
+ DPRINTF(1, ("MM timer resolution reset\n"));
+}
+
+
+void
+reset_winnt_time(void)
+{
+ SYSTEMTIME st;
+
+ /*
+ * If we're in the 2-second slew right after a leap second,
+ * we don't want to continue that extreme slew, in that case
+ * disable our slewing and return clock discipline to the
+ * kernel. Similarly if we are not yet synchronized,
+ * our current slew may not be a good ongoing trim.
+ * Otherwise, our leave in place the last SetSystemTimeAdjustment
+ * as an ongoing frequency correction, better than nothing.
+ * TODO:
+ * Verify this will not call SetSystemTimeAdjustment if
+ * ntpd is running in ntpdate mode.
+ */
+ if (sys_leap == LEAP_NOTINSYNC || ls_time_adjustment != 0)
+ SetSystemTimeAdjustment(0, TRUE);
+
+ /*
+ * Read the current system time, and write it back to
+ * force CMOS update, only if we are exiting because
+ * the computer is shutting down and we are already
+ * synchronized.
+ */
+ if (ntservice_systemisshuttingdown() && sys_leap != LEAP_NOTINSYNC) {
+ GetSystemTime(&st);
+ SetSystemTime(&st);
+ NLOG(NLOG_SYSEVENT | NLOG_CLOCKINFO)
+ msyslog(LOG_NOTICE, "system is shutting down, CMOS time reset.");
+ }
+}
+
+
+/*
+ * GetSystemTimeAsFileTime() interface clone is used by getclock() in ntpd.
+ */
+
+void WINAPI
+GetInterpTimeAsFileTime(
+ LPFILETIME pft
+ )
+{
+ static ULONGLONG last_interp_time;
+ FT_ULL now_time;
+ FT_ULL now_count;
+ ULONGLONG clock_backward;
+
+ /*
+ * Mark a mark ASAP. The latency to here should be reasonably
+ * deterministic
+ */
+
+ now_count.ull = perf_ctr();
+ now_time.ull = interp_time(now_count.ull, TRUE);
+
+ if (last_interp_time <= now_time.ull) {
+ last_interp_time = now_time.ull;
+ } else {
+ clock_backward = last_interp_time - now_time.ull;
+ if (clock_backward > clock_backward_max) {
+ clock_backward_max = clock_backward;
+ clock_backward_count++;
+ }
+ now_time.ull = last_interp_time;
+ }
+ *pft = now_time.ft;
+
+ return;
+}
+
+
+/*
+ * TimerApcFunction is invoked on the high-priority clock
+ * thread to capture a new baseline system time and
+ * performance counter correlation every 43 msec (64Hz
+ * OS clock precision).
+ */
+static void CALLBACK
+TimerApcFunction(
+ LPVOID lpArgToCompletionRoutine,
+ DWORD dwTimerLowValue,
+ DWORD dwTimerHighValue
+ )
+{
+ static BOOL ctr_freq_timer_started = FALSE;
+ static ULONGLONG prev_count;
+ ULONGLONG now_time;
+ FT_ULL now_count;
+
+ /* Grab the counter first of all */
+ now_count.ull = perf_ctr();
+
+ now_time = (((ULONGLONG)dwTimerHighValue << 32) |
+ dwTimerLowValue);
+
+ /*
+ * Save this correlation in the history.
+ */
+ add_counter_time_pair(now_count.ull, now_time);
+
+ /*
+ * Once we're synchronized start the counter frequency
+ * tuning timer.
+ */
+ if (INVALID_HANDLE_VALUE == ctr_freq_timer &&
+ LEAP_NOTINSYNC != sys_leap)
+ start_ctr_freq_timer(now_time);
+}
+
+
+unsigned WINAPI
+ClockThread(
+ void *arg
+ )
+{
+ LARGE_INTEGER DueTime;
+ HANDLE timer;
+ double HZ;
+ double TimerHz;
+ DWORD timer_period_msec;
+ DWORD res;
+ char *ntpd_int_int_text;
+
+ UNUSED_ARG(arg);
+
+ timer = CreateWaitableTimer(NULL, FALSE, NULL);
+
+ ntpd_int_int_text = getenv("NTPD_INT_INT");
+
+ HZ = (double)HECTONANOSECONDS / clockperiod;
+
+ if (HZ > 63 && HZ < 65) {
+ timer_period_msec = 43;
+ } else if (HZ > 98 && HZ < 102) {
+ timer_period_msec = 27;
+ if (NULL == ntpd_int_int_text)
+ msyslog(LOG_WARNING,
+ "%.3f Hz system clock may benefit from "
+ "custom NTPD_INT_INT env var timer interval "
+ "override between approx. 20 and 50 msecs.",
+ HZ);
+ } else {
+ timer_period_msec = (DWORD)(0.5 + (2.752 * clockperiod / 10000));
+ if (NULL == ntpd_int_int_text)
+ msyslog(LOG_WARNING,
+ "unfamiliar %.3f Hz system clock may benefit "
+ "from custom NTPD_INT_INT env var timer "
+ "interval override between approx. 20 and 50 "
+ "msecs.",
+ HZ);
+ }
+
+ if (ntpd_int_int_text != NULL) {
+ timer_period_msec = atoi(ntpd_int_int_text);
+ timer_period_msec = max(9, timer_period_msec);
+ msyslog(LOG_NOTICE,
+ "using NTPD_INT_INT env var override %u",
+ timer_period_msec);
+ }
+
+ TimerHz = 1e3 / timer_period_msec;
+ msyslog(LOG_NOTICE, "HZ %.3f using %u msec timer %.3f Hz %d deep",
+ HZ,
+ timer_period_msec,
+ TimerHz,
+ BASELINES_USED);
+
+ /* negative DueTime means relative to now */
+ DueTime.QuadPart = -(int)timer_period_msec;
+
+ SetWaitableTimer(
+ timer,
+ &DueTime, /* first fire */
+ timer_period_msec, /* period thereafter */
+ TimerApcFunction, /* callback routine */
+ &timer, /* context for callback */
+ FALSE); /* do not interfere with power saving */
+
+ /*
+ * The clock thread spends the rest of its life in the TimerApcFunction
+ * and ctr_freq_timer_fired timer APC callbacks, which can only occur
+ * while this thread is in an alertable wait. Note the Ex on
+ * WaitForSingleObjectEx and TRUE for fAlertable. The wait will return
+ * after each APC callback in which case we simply wait again. We will
+ * break out of the loop when StopClockThread signals our exit event.
+ */
+ do res = WaitForSingleObjectEx(
+ TimerThreadExitRequest,
+ INFINITE,
+ TRUE);
+ while (WAIT_OBJECT_0 != res);
+
+ CloseHandle(timer);
+
+ if (ctr_freq_timer != INVALID_HANDLE_VALUE) {
+ CloseHandle(ctr_freq_timer);
+ ctr_freq_timer = INVALID_HANDLE_VALUE;
+ }
+
+ return 0;
+}
+
+
+static void
+StartClockThread(void)
+{
+ static BOOL done_once = FALSE;
+ FT_ULL StartTime;
+
+ /* init variables with the time now */
+ GetSystemTimeAsFileTime(&StartTime.ft);
+ baseline_times[0] = StartTime.ull;
+ baseline_counts[0] = perf_ctr();
+
+ /* init sync objects */
+ TimerThreadExitRequest = CreateEvent(NULL, FALSE, FALSE, NULL);
+
+ clock_thread =
+ (HANDLE)_beginthreadex(
+ NULL,
+ 0,
+ ClockThread,
+ NULL,
+ CREATE_SUSPENDED,
+ &clock_thread_id);
+
+ if (clock_thread != NULL) {
+ /* remember the thread priority is only within the process class */
+ if (!SetThreadPriority(clock_thread, THREAD_PRIORITY_TIME_CRITICAL)) {
+ DPRINTF(1, ("Error setting thread priority\n"));
+ }
+
+ lock_thread_to_processor(clock_thread);
+ ResumeThread(clock_thread);
+
+ if (FALSE == done_once) {
+ done_once = TRUE;
+ lock_thread_to_processor(GetCurrentThread());
+ atexit( StopClockThread );
+ }
+
+ /*
+ * Give the clock thread time to fill its counter/time
+ * sample buffer. This will underfill the buffer a
+ * bit for sample periods over 43 msec.
+ */
+ Sleep(BASELINES_USED * 43);
+ }
+}
+
+
+void
+StopClockThread(void)
+{
+ /*
+ * if the clock thread exit()s this routine
+ * will be called on the clock thread and
+ * we need not (and can't) use the normal
+ * TimerThreadExitRequest event.
+ */
+ if (GetCurrentThreadId() != clock_thread_id) {
+
+ if (!SetEvent(TimerThreadExitRequest) ||
+ WaitForSingleObject(clock_thread, 2 * 1000) !=
+ WAIT_OBJECT_0) {
+ msyslog(LOG_ERR, "Failed to stop clock thread.");
+ }
+ }
+ CloseHandle(TimerThreadExitRequest);
+ TimerThreadExitRequest = NULL;
+ CloseHandle(clock_thread);
+ clock_thread = NULL;
+}
+
+
+void
+lock_thread_to_processor(HANDLE thread)
+{
+ static DWORD_PTR ProcessAffinityMask;
+ static DWORD_PTR ThreadAffinityMask;
+ DWORD_PTR SystemAffinityMask;
+ char *cputext;
+ unsigned int cpu;
+
+ if ( ! winnt_time_initialized) {
+ DPRINTF(1, ("init_winnt_time() must be called before "
+ "lock_thread_to_processor(), exiting\n"));
+ exit(-1);
+ }
+
+ if (!winnt_use_interpolation)
+ return;
+
+ if (-1 == lock_interp_threads) {
+ DPRINTF(1, ("choose_interp_counter() is not called "
+ "before lock_thread_to_processor()\n"));
+ exit(-1);
+ } else if (!lock_interp_threads)
+ return;
+
+ /*
+ * Calculate the ThreadAffinityMask we'll use once on the
+ * first invocation.
+ */
+ if (!ProcessAffinityMask) {
+
+ /*
+ * Choose which processor to nail the main and clock threads to.
+ * If we have more than one, we simply choose the 2nd.
+ * Randomly choosing from 2 to n would be better, but in
+ * either case with clock and network interrupts more likely
+ * to be serviced by the first procecssor, let's stay away
+ * from it. QueryPerformanceCounter is not necessarily
+ * consistent across CPUs, hence the need to nail the two
+ * threads involved in QPC-based interpolation to the same
+ * CPU.
+ */
+
+ GetProcessAffinityMask(
+ GetCurrentProcess(),
+ &ProcessAffinityMask,
+ &SystemAffinityMask);
+
+ /*
+ * respect NTPD_CPU environment variable if present
+ * for testing. NTPD_CPU=0 means use all CPUs, 1-64
+ * means lock threads involved in interpolation to
+ * that CPU. Default to 2nd if more than 1.
+ */
+
+ cpu = 2;
+ cputext = getenv("NTPD_CPU");
+ if (cputext) {
+ cpu = (unsigned int) atoi(cputext);
+ cpu = min((8 * sizeof(DWORD_PTR)), cpu);
+ }
+
+ /*
+ * Clear all bits except the 2nd. If we have only one proc
+ * that leaves ThreadAffinityMask zeroed and we won't bother
+ * with SetThreadAffinityMask.
+ */
+
+ ThreadAffinityMask = (0 == cpu) ? 0 : (1 << (cpu - 1));
+
+ if (ThreadAffinityMask &&
+ !(ThreadAffinityMask & ProcessAffinityMask))
+
+ DPRINTF(1, ("Selected CPU %u (mask %x) is outside "
+ "process mask %x, using all CPUs.\n",
+ cpu, ThreadAffinityMask,
+ ProcessAffinityMask));
+ else
+ DPRINTF(1, ("Wiring to processor %u (0 means all) "
+ "affinity mask %x\n",
+ cpu, ThreadAffinityMask));
+
+ ThreadAffinityMask &= ProcessAffinityMask;
+ }
+
+ if (ThreadAffinityMask &&
+ !SetThreadAffinityMask(thread, ThreadAffinityMask))
+ msyslog(LOG_ERR,
+ "Unable to wire thread to mask %x: %m",
+ ThreadAffinityMask);
+}
+
+
+#ifdef HAVE_PPSAPI
+static inline void ntp_timestamp_from_counter(l_fp *, ULONGLONG,
+ ULONGLONG);
+
+/*
+ * helper routine for serial PPS which returns QueryPerformanceCounter
+ * timestamp and needs to interpolate it to an NTP timestamp.
+ */
+void
+pps_ntp_timestamp_from_counter(
+ ntp_fp_t *result,
+ ULONGLONG Timestamp,
+ ULONGLONG Counterstamp
+ )
+{
+ /*
+ * convert between equivalent l_fp and PPSAPI ntp_fp_t
+ */
+ ntp_timestamp_from_counter(
+ (l_fp *)result,
+ Timestamp,
+ Counterstamp);
+}
+
+
+static inline
+void
+ntp_timestamp_from_counter(
+ l_fp *result,
+ ULONGLONG Timestamp,
+ ULONGLONG Counterstamp
+ )
+{
+ FT_ULL Now;
+ FT_ULL Ctr;
+ LONGLONG CtrDelta;
+ double seconds;
+ ULONGLONG InterpTimestamp;
+
+ if (winnt_use_interpolation) {
+ if (0 == Counterstamp) {
+ DPRINTF(1, ("ntp_timestamp_from_counter rejecting 0 counter.\n"));
+ ZERO(*result);
+ return;
+ }
+
+ InterpTimestamp = interp_time(Counterstamp + QPC_offset, FALSE);
+ } else { /* ! winnt_use_interpolation */
+ if (NULL != pGetSystemTimePreciseAsFileTime &&
+ 0 != Counterstamp) {
+ QueryPerformanceCounter(&Ctr.li);
+ (*pGetSystemTimePreciseAsFileTime)(&Now.ft);
+ CtrDelta = Ctr.ull - Counterstamp;
+ seconds = (double)CtrDelta / PerfCtrFreq;
+ InterpTimestamp = Now.ull -
+ (ULONGLONG)(seconds * HECTONANOSECONDS);
+ } else {
+ /* have to simply use the driver's system time timestamp */
+ InterpTimestamp = Timestamp;
+ GetSystemTimeAsFileTime(&Now.ft);
+ }
+ }
+
+ /* convert from 100ns units to NTP fixed point format */
+
+ InterpTimestamp -= FILETIME_1970;
+ result->l_ui = JAN_1970 + (u_int32)(InterpTimestamp / HECTONANOSECONDS);
+ result->l_uf = (u_int32)((InterpTimestamp % HECTONANOSECONDS) *
+ (ULONGLONG)FRAC / HECTONANOSECONDS);
+}
+#endif /* HAVE_PPSAPI */
+
+
+void
+win_time_stepped(void)
+{
+ /*
+ * called back by ntp_set_tod after the system
+ * time has been stepped (set).
+ *
+ * We normally prevent the reported time from going backwards
+ * but need to allow it in this case.
+ */
+ if (FALSE == winnt_use_interpolation)
+ return;
+
+
+ /*
+ * Restart the clock thread to get a new baseline
+ * time/counter correlation.
+ */
+ StopClockThread();
+
+ /*
+ * newest_baseline_gen is a generation counter
+ * incremented once each time newest_baseline
+ * is reset.
+ */
+ newest_baseline_gen++;
+
+ clock_backward_max = CLOCK_BACK_THRESHOLD;
+ clock_backward_count = 0;
+ newest_baseline = 0;
+ ZERO(baseline_counts);
+ ZERO(baseline_times);
+
+ StartClockThread();
+}
+
+
+/*
+ * log2ull - log base 2 of a unsigned 64-bit number
+ */
+int
+log2ull(
+ ULONGLONG n
+ )
+{
+ const ULONGLONG one = 1;
+ int log = 0;
+
+ if (n >= one<<32) { n >>= 32; log += 32; }
+ if (n >= one<<16) { n >>= 16; log += 16; }
+ if (n >= one<< 8) { n >>= 8; log += 8; }
+ if (n >= one<< 4) { n >>= 4; log += 4; }
+ if (n >= one<< 2) { n >>= 2; log += 2; }
+ if (n >= one<< 1) { log += 1; }
+
+ return (n) ? log : (-1);
+}
+
+
+/*
+ * ctr_freq_timer_fired is called once a few seconds before
+ * tune_ctr_period seconds have elapsed, to reset the timer
+ * and hopefully minimize error due to the system using the
+ * nominal performance counter frequency to set the timer
+ * internally, which is typically dozens of PPM from the
+ * actual performance counter rate. A few seconds later
+ * it is called again to observe the counter and estimate the
+ * counter frequency.
+ */
+static void CALLBACK
+ctr_freq_timer_fired(
+ LPVOID arg,
+ DWORD dwTimeLow,
+ DWORD dwTimeHigh
+ )
+{
+ static FT_ULL begin_time = {0};
+ static FT_ULL begin_count = {0};
+ static ULONGLONG next_period_time = 0;
+ static ULONGLONG report_systemtime = 0;
+ const ULONGLONG five_minutes = 5ui64 * 60 * HECTONANOSECONDS;
+ FT_ULL now_time;
+ FT_ULL now_count;
+
+ if (!begin_time.ull) {
+ begin_count.ull = perf_ctr();
+ begin_time.ft.dwLowDateTime = dwTimeLow;
+ begin_time.ft.dwHighDateTime = dwTimeHigh;
+
+ /*
+ * adapt perf ctr observation interval to the
+ * counter frequency
+ */
+ tune_ctr_period = 22680 / log2ull(NomPerfCtrFreq);
+
+ /*
+ * reset timer 2s before period ends to minimize
+ * error from OS timer routines using nominal
+ * performance frequency internally.
+ */
+ tune_ctr_freq_max_interval = tune_ctr_period - 2;
+
+ next_period_time = begin_time.ull +
+ (ULONGLONG)tune_ctr_period * HECTONANOSECONDS;
+
+ ROUND_TO_NEXT_SEC_BOTTOM(next_period_time);
+
+ reset_ctr_freq_timer(next_period_time, begin_time.ull);
+
+ return;
+ }
+
+ now_time.ft.dwLowDateTime = dwTimeLow;
+ now_time.ft.dwHighDateTime = dwTimeHigh;
+
+ if (now_time.ull >= next_period_time) {
+ now_count.ull = perf_ctr();
+ tune_ctr_freq(
+ now_count.ull - begin_count.ull,
+ now_time.ull - begin_time.ull);
+ next_period_time += (ULONGLONG)tune_ctr_period * HECTONANOSECONDS;
+ begin_count.ull = now_count.ull;
+ begin_time.ull = now_time.ull;
+ }
+
+ /*
+ * Log clock backward events no more often than 5 minutes.
+ */
+ if (!report_systemtime) {
+ report_systemtime = now_time.ull + five_minutes;
+ } else if (report_systemtime <= now_time.ull) {
+ report_systemtime += five_minutes;
+ if (clock_backward_count) {
+ msyslog(LOG_WARNING,
+ "clock would have gone backward %d times, "
+ "max %.1f usec",
+ clock_backward_count,
+ clock_backward_max / 10.);
+
+ clock_backward_max = CLOCK_BACK_THRESHOLD;
+ clock_backward_count = 0;
+ }
+ }
+ reset_ctr_freq_timer(next_period_time, now_time.ull);
+}
+
+
+void
+reset_ctr_freq_timer_abs(
+ ULONGLONG when
+ )
+{
+ FT_ULL fire_time;
+
+ fire_time.ull = when;
+ SetWaitableTimer(
+ ctr_freq_timer,
+ &fire_time.li, /* first fire */
+ 0, /* not periodic */
+ ctr_freq_timer_fired, /* callback routine */
+ NULL, /* context for callback */
+ FALSE); /* do not interfere with power saving */
+}
+
+
+void
+reset_ctr_freq_timer(
+ ULONGLONG when,
+ ULONGLONG now
+ )
+{
+ if (when - now >
+ (tune_ctr_freq_max_interval * HECTONANOSECONDS + HECTONANOSECONDS))
+ when = now + tune_ctr_freq_max_interval * HECTONANOSECONDS;
+
+ reset_ctr_freq_timer_abs(when);
+}
+
+
+void
+start_ctr_freq_timer(
+ ULONGLONG now_time
+ )
+{
+ ULONGLONG when;
+
+ ctr_freq_timer = CreateWaitableTimer(NULL, FALSE, NULL);
+ when = now_time;
+ ROUND_TO_NEXT_SEC_BOTTOM(when);
+
+ reset_ctr_freq_timer_abs(when);
+}
+
+
+/*
+ * tune_ctr_freq is called once per tune_ctr_period seconds
+ * with a counter difference and time difference.
+ */
+void
+tune_ctr_freq(
+ LONGLONG ctr_delta,
+ LONGLONG time_delta
+ )
+{
+ static unsigned count = 0;
+ static unsigned dispcount = 0;
+ static unsigned report_at_count = 0;
+ static int disbelieved = 0;
+ static int i = 0;
+ static double nom_freq = 0;
+ static LONGLONG diffs[TUNE_CTR_DEPTH] = {0};
+ static LONGLONG sum = 0;
+ char ctr_freq_eq[64];
+ LONGLONG delta;
+ LONGLONG deltadiff;
+ ULONGLONG ObsPerfCtrFreq;
+ double freq;
+ double this_freq;
+ BOOL isneg;
+
+ /* one-time initialization */
+ if (!report_at_count) {
+ report_at_count = 24 * 60 * 60 / tune_ctr_period;
+ nom_freq = NomPerfCtrFreq / 1e6;
+ }
+
+ /* delta is the per-second observed frequency this time */
+ delta = (LONGLONG)((double)ctr_delta * HECTONANOSECONDS /
+ time_delta);
+
+ /* disbelieve any delta more than +/- 976 PPM from nominal */
+ deltadiff = delta - NomPerfCtrFreq;
+ if (0 > deltadiff) {
+ isneg = TRUE;
+ deltadiff = -deltadiff;
+ } else {
+ isneg = FALSE;
+ }
+
+ if ((ULONGLONG)deltadiff > (NomPerfCtrFreq / 1024)) {
+ disbelieved++;
+ dispcount++;
+#ifdef DEBUG
+ msyslog(LOG_DEBUG, "ctr delta %s%lld exceeds limit %llu",
+ (isneg) ? "-" : "",
+ deltadiff,
+ NomPerfCtrFreq / 1024);
+#endif
+ } else {
+
+ /*
+ * collect average over TUNE_CTR_DEPTH samples
+ * for our PerfCtrFreq trimming.
+ */
+
+ if (isneg)
+ deltadiff = -deltadiff;
+ sum -= diffs[i];
+ diffs[i] = deltadiff;
+ sum += deltadiff;
+ i = (i + 1) % COUNTOF(diffs);
+ count++;
+ dispcount++;
+ }
+
+ this_freq = delta / 1e6;
+
+ ObsPerfCtrFreq = NomPerfCtrFreq + (sum / COUNTOF(diffs));
+
+#if 1 /* #if 0 to disable changing freq used */
+ /* get rid of ObsPerfCtrFreq when removing the #ifdef */
+ PerfCtrFreq = ObsPerfCtrFreq;
+#endif
+ freq = PerfCtrFreq / 1e6;
+
+ /*
+ * make the performance counter's frequency error from its
+ * nominal rate, expressed in PPM, available via ntpq as
+ * system variable "ctr_frequency". This is consistent with
+ * "frequency" which is the system clock drift in PPM.
+ */
+ snprintf(ctr_freq_eq, sizeof(ctr_freq_eq), "ctr_frequency=%.2f",
+ 1e6 * (freq - nom_freq) / nom_freq);
+ set_sys_var(ctr_freq_eq, strlen(ctr_freq_eq) + 1, RO | DEF);
+
+ /*
+ * report observed ctr freq each time the estimate used during
+ * startup moves toward the observed freq from the nominal.
+ */
+
+ if (count > COUNTOF(diffs) &&
+ /* (count % COUNTOF(diffs)) && */ /* enables reporting each */
+ dispcount < report_at_count) /* TUNE_CTR_DEPTH samples */
+ return;
+
+ NLOG(NLOG_CLOCKINFO)
+ if (count <= COUNTOF(diffs))
+ /* moving to observed freq. from nominal (startup) */
+ msyslog(LOG_INFO,
+ (freq > 100)
+ ? "ctr %.3f MHz %+6.2f PPM using %.3f MHz %+6.2f PPM"
+ : "ctr %.6f MHz %+6.2f PPM using %.6f MHz %+6.2f PPM",
+ this_freq,
+ 1e6 * (this_freq - nom_freq) / nom_freq,
+ freq,
+ 1e6 * (freq - nom_freq) / nom_freq);
+ else
+ /* steady state */
+ msyslog(LOG_INFO,
+ (freq > 100)
+ ? "ctr %.3f MHz %+.2f PPM"
+ : "ctr %.6f MHz %+.2f PPM",
+ freq,
+ 1e6 * (freq - nom_freq) / nom_freq);
+
+ if (disbelieved) {
+ msyslog(LOG_ERR,
+ "%d ctr samples exceed +/- 976 PPM range gate",
+ disbelieved);
+ disbelieved = 0;
+ }
+
+ dispcount = 0;
+}
+
+
+/*
+ * add_counter_time_pair is called by the
+ * high priority clock thread with each new
+ * baseline counter/time correlation.
+ */
+void
+add_counter_time_pair(
+ ULONGLONG ctr,
+ LONGLONG time
+ )
+{
+ int i;
+
+ i = (newest_baseline + 1) % BASELINES_TOT;
+
+ baseline_counts[i] = ctr;
+ baseline_times[i] = time;
+
+ newest_baseline = i;
+}
+
+
+/*
+ * interp_time estimates NT time in 100ns units
+ * based on a performance counter value given.
+ * This must tolerate recent historical counters
+ * as well as current. When current is FALSE
+ * we can't assume ctr is the latest/highest
+ * seen.
+ */
+ULONGLONG
+interp_time(
+ ULONGLONG ctr,
+ BOOL current
+ )
+{
+ static __declspec(thread) int last_newest = -1;
+ static __declspec(thread) int last_newest_gen;
+ static __declspec(thread) int best_index;
+ ULONGLONG this_ctr;
+ LONGLONG this_time;
+ LONGLONG latest_time;
+ LONGLONG ctr_diff;
+ int i;
+ int i_gen;
+ int c;
+
+ /*
+ * Use the system time (roughly synchronised to the tick, and
+ * extrapolated using the system performance counter.
+ *
+ * Cache the results per thread and only repeat the
+ * calculation when new data has arrived.
+ */
+ i = newest_baseline;
+ i_gen = newest_baseline_gen;
+
+ if (last_newest == i && last_newest_gen == i_gen) {
+ this_time = baseline_times[best_index];
+ ctr_diff = ctr - baseline_counts[best_index];
+ this_time += (LONGLONG)PERF2HNS((double)ctr_diff);
+
+ return this_time;
+ }
+
+ last_newest = i;
+ last_newest_gen = i_gen;
+
+ latest_time = 0;
+
+ /*
+ * Run through the history calculating the interpolated
+ * time based on each counter/time correlation in turn,
+ * and believe the latest one. This is akin to the NTP
+ * protocol minimum delay clock filter. Errors due to
+ * counter/time correlations with stale time are all
+ * negative.
+ */
+ for (c = 0; c < BASELINES_USED; c++) {
+ if (baseline_times[i]) {
+ this_time = baseline_times[i];
+ this_ctr = baseline_counts[i];
+
+ ctr_diff = ctr - this_ctr;
+
+ if (current && ctr_diff < 0) {
+ /*
+ * The performance counter apparently went
+ * backwards without rolling over. It might
+ * be nice to complain but we don't want
+ * to do it repeatedly.
+ */
+ ctr_diff = 0;
+ }
+
+ this_time += (LONGLONG)PERF2HNS((double)ctr_diff);
+
+ if (this_time > latest_time) {
+ latest_time = this_time;
+ best_index = i;
+ }
+ }
+ i = i ? (i - 1) : (BASELINES_TOT - 1);
+ }
+
+ return latest_time;
+}
diff --git a/ports/winnt/ntpd/ntp_iocompletionport.c b/ports/winnt/ntpd/ntp_iocompletionport.c
new file mode 100644
index 000000000000..046d6cda1e2b
--- /dev/null
+++ b/ports/winnt/ntpd/ntp_iocompletionport.c
@@ -0,0 +1,1639 @@
+/*
+-----------------------------------------------------------------------
+This is the IO completion port handling for async/overlapped IO on
+Windows >= Win2000.
+
+Some notes on the implementation:
+
++ Only one thread is used to serve the IO completion port, for several
+ reasons:
+
+ * First, there seems to be (have been?) trouble that locked up NTPD
+ when more than one thread was used for IOCPL.
+
+ * Second, for the sake of the time stamp interpolation the threads
+ must run on the same CPU as the time interpolation thread. This
+ makes using more than one thread useless, as they would compete for
+ the same core and create contention.
+
++ Some IO operations need a possibly lengthy postprocessing. Emulating
+ the UN*X line discipline is currently the only but prominent example.
+ To avoid the processing in the time-critical IOCPL thread, longer
+ processing is offloaded the worker thread pool.
+
++ A fact that seems not as well-known as it should be is that all
+ ressources passed to an overlapped IO operation must be considered
+ owned by the OS until the result has been fetched/dequeued. This
+ includes all overlapped structures and buffers involved, so cleaning
+ up on shutdown must be carefully constructed. (This includes closing
+ all the IO handles and waiting for the results to be dequeued.
+ 'CancleIo()' cannot be used since it's broken beyond repair.)
+
+ If this is not possible, then all ressources should be dropped into
+ oblivion -- otherwise "bad things (tm)" are bound to happen.
+
+ Using a private heap that is silently dropped but not deleted is a
+ good way to avoid cluttering memory stats with IO context related
+ objects. Leak tracing becomes more interesting, though.
+
+
+The current implementation is based on the work of Danny Mayer who improved
+the original implementation and Dave Hart who improved on the serial I/O
+routines. The true roots of this file seem to be shrouded by the mist of time...
+
+
+This version still provides the 'user space PPS' emulation
+feature.
+
+Juergen Perlinger (perlinger@ntp.org) Feb 2012
+
+-----------------------------------------------------------------------
+*/
+#ifdef HAVE_CONFIG_H
+# include
+#endif
+
+#ifdef HAVE_IO_COMPLETION_PORT
+
+#include
+#include
+#include
+#include
+
+#include "ntpd.h"
+#include "ntp_machine.h"
+#include "ntp_iocompletionport.h"
+#include "ntp_request.h"
+#include "ntp_assert.h"
+#include "ntp_io.h"
+#include "ntp_lists.h"
+
+
+#define CONTAINEROF(p, type, member) \
+ ((type *)((char *)(p) - offsetof(type, member)))
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable: 201) /* nonstd extension nameless union */
+#endif
+
+/*
+ * ---------------------------------------------------------------------
+ * storage type for PPS data (DCD change counts & times)
+ * ---------------------------------------------------------------------
+ */
+struct PpsData {
+ u_long cc_assert;
+ u_long cc_clear;
+ l_fp ts_assert;
+ l_fp ts_clear;
+};
+typedef struct PpsData PPSData_t;
+
+struct PpsDataEx {
+ u_long cov_count;
+ PPSData_t data;
+};
+typedef volatile struct PpsDataEx PPSDataEx_t;
+
+/*
+ * ---------------------------------------------------------------------
+ * device context; uses reference counting to avoid nasty surprises.
+ * Currently this stores only the PPS time stamps, but it could be
+ * easily extended.
+ * ---------------------------------------------------------------------
+ */
+#define PPS_QUEUE_LEN 8u /* must be power of two! */
+#define PPS_QUEUE_MSK (PPS_QUEUE_LEN-1) /* mask for easy MOD ops */
+
+struct DeviceContext {
+ volatile long ref_count;
+ volatile u_long cov_count;
+ PPSData_t pps_data;
+ PPSDataEx_t pps_buff[PPS_QUEUE_LEN];
+};
+
+typedef struct DeviceContext DevCtx_t;
+
+/*
+ * ---------------------------------------------------------------------
+ * I/O context structure
+ *
+ * This is an extended overlapped structure. Some fields are only used
+ * for serial I/O, others are used for all operations. The serial I/O is
+ * more interesting since the same context object is used for waiting,
+ * actual I/O and possibly offload processing in a worker thread until
+ * a complete operation cycle is done.
+ *
+ * In this case the I/O context is used to gather all the bits that are
+ * finally needed for the processing of the buffer.
+ * ---------------------------------------------------------------------
+ */
+//struct IoCtx;
+typedef struct IoCtx IoCtx_t;
+typedef struct refclockio RIO_t;
+
+typedef void (*IoCompleteFunc)(ULONG_PTR, IoCtx_t *);
+
+struct IoCtx {
+ OVERLAPPED ol; /* 'kernel' part of the context */
+ union {
+ recvbuf_t * recv_buf; /* incoming -> buffer structure */
+ void * trans_buf; /* outgoing -> char array */
+ PPSData_t * pps_buf; /* for reading PPS seq/stamps */
+ HANDLE ppswake; /* pps wakeup for attach */
+ };
+ IoCompleteFunc onIoDone; /* HL callback to execute */
+ RIO_t * rio; /* RIO backlink (for offload) */
+ DevCtx_t * devCtx;
+ l_fp DCDSTime; /* PPS-hack: time of DCD ON */
+ l_fp FlagTime; /* timestamp of flag/event char */
+ l_fp RecvTime; /* timestamp of callback */
+ DWORD errCode; /* error code of last I/O */
+ DWORD byteCount; /* byte count " */
+ DWORD com_events; /* buffer for COM events */
+ unsigned int flRawMem : 1; /* buffer is raw memory -> free */
+ unsigned int flTsDCDS : 1; /* DCDSTime valid? */
+ unsigned int flTsFlag : 1; /* FlagTime valid? */
+};
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+/*
+ * local function definitions
+ */
+static void ntpd_addremove_semaphore(HANDLE, int);
+static inline void set_serial_recv_time (recvbuf_t *, IoCtx_t *);
+
+/* Initiate/Request async IO operations */
+static BOOL QueueSerialWait (RIO_t *, recvbuf_t *, IoCtx_t *);
+static BOOL QueueSerialRead (RIO_t *, recvbuf_t *, IoCtx_t *);
+static BOOL QueueRawSerialRead(RIO_t *, recvbuf_t *, IoCtx_t *);
+static BOOL QueueSocketRecv (SOCKET , recvbuf_t *, IoCtx_t *);
+
+
+/* High-level IO callback functions */
+static void OnSocketRecv (ULONG_PTR, IoCtx_t *);
+static void OnSerialWaitComplete (ULONG_PTR, IoCtx_t *);
+static void OnSerialReadComplete (ULONG_PTR, IoCtx_t *);
+static void OnRawSerialReadComplete(ULONG_PTR, IoCtx_t *);
+static void OnSerialWriteComplete (ULONG_PTR, IoCtx_t *);
+
+/* worker pool offload functions */
+static DWORD WINAPI OnSerialReadWorker(void * ctx);
+
+
+/* keep a list to traverse to free memory on debug builds */
+#ifdef DEBUG
+static void free_io_completion_port_mem(void);
+#endif
+
+
+ HANDLE WaitableExitEventHandle;
+ HANDLE WaitableIoEventHandle;
+static HANDLE hIoCompletionPort;
+
+DWORD ActiveWaitHandles;
+HANDLE WaitHandles[16];
+
+/*
+ * -------------------------------------------------------------------
+ * We make a pool of our own for IO context objects -- the are owned by
+ * the system until a completion result is pulled from the queue, and
+ * they seriously go into the way of memory tracking until we can safely
+ * cancel an IO request.
+ * -------------------------------------------------------------------
+ */
+static HANDLE hHeapHandle;
+
+/*
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Create a new heap for IO context objects
+ */
+static void
+IoCtxPoolInit(
+ size_t initObjs
+ )
+{
+ hHeapHandle = HeapCreate(0, initObjs * sizeof(IoCtx_t), 0);
+ if (hHeapHandle == NULL) {
+ msyslog(LOG_ERR, "Can't initialize Heap: %m");
+ exit(1);
+ }
+}
+
+/*
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ *
+ * Delete the IO context heap
+ *
+ * Since we do not know what callbacks are pending, we just drop the
+ * pool into oblivion. New allocs and frees will fail from this moment,
+ * but we simply don't care. At least the normal heap dump stats will
+ * show no leaks from IO context blocks. On the downside, we have to
+ * track them ourselves if something goes wrong.
+ */
+static void
+IoCtxPoolDone(void)
+{
+ hHeapHandle = NULL;
+}
+
+/*
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Alloc & Free on local heap
+ *
+ * When the heap handle is NULL, these both will fail; Alloc with a NULL
+ * return and Free silently.
+ */
+static void * __fastcall
+LocalPoolAlloc(
+ size_t size,
+ const char * desc
+)
+{
+ void * ptr;
+
+ /* Windows heaps can't grok zero byte allocation.
+ * We just get one byte.
+ */
+ if (size == 0)
+ size = 1;
+ if (hHeapHandle != NULL)
+ ptr = HeapAlloc(hHeapHandle, HEAP_ZERO_MEMORY, size);
+ else
+ ptr = NULL;
+ DPRINTF(3, ("Allocate '%s', heap=%p, ptr=%p\n",
+ desc, hHeapHandle, ptr));
+
+ return ptr;
+}
+
+static void __fastcall
+LocalPoolFree(
+ void * ptr,
+ const char * desc
+ )
+{
+ DPRINTF(3, ("Free '%s', heap=%p, ptr=%p\n",
+ desc, hHeapHandle, ptr));
+ if (ptr != NULL && hHeapHandle != NULL)
+ HeapFree(hHeapHandle, 0, ptr);
+}
+
+/*
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Alloc & Free of Device context
+ *
+ * When the heap handle is NULL, these both will fail; Alloc with a NULL
+ * return and Free silently.
+ */
+static DevCtx_t * __fastcall
+DevCtxAlloc(void)
+{
+ DevCtx_t * devCtx;
+ u_long slot;
+
+ /* allocate struct and tag all slots as invalid */
+ devCtx = (DevCtx_t *)LocalPoolAlloc(sizeof(DevCtx_t), "DEV ctx");
+ if (devCtx != NULL)
+ {
+ /* The initial COV values make sure there is no busy
+ * loop on unused/empty slots.
+ */
+ devCtx->cov_count = 0;
+ for (slot = 0; slot < PPS_QUEUE_LEN; slot++)
+ devCtx->pps_buff[slot].cov_count = ~slot;
+ }
+ return devCtx;
+}
+
+static void __fastcall
+DevCtxFree(
+ DevCtx_t * devCtx
+ )
+{
+ /* this would be the place to get rid of managed ressources. */
+ LocalPoolFree(devCtx, "DEV ctx");
+}
+
+static DevCtx_t * __fastcall
+DevCtxAttach(
+ DevCtx_t * devCtx
+ )
+{
+ if (devCtx != NULL)
+ InterlockedIncrement(&devCtx->ref_count);
+ return devCtx;
+}
+
+static void __fastcall
+DevCtxDetach(
+ DevCtx_t * devCtx
+ )
+{
+ if (devCtx && !InterlockedDecrement(&devCtx->ref_count))
+ DevCtxFree(devCtx);
+}
+
+/*
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Alloc & Free of I/O context
+ *
+ * When the heap handle is NULL, these both will fail; Alloc with a NULL
+ * return and Free silently.
+ */
+static IoCtx_t * __fastcall
+IoCtxAlloc(
+ DevCtx_t * devCtx
+ )
+{
+ IoCtx_t * ioCtx;
+
+ ioCtx = (IoCtx_t *)LocalPoolAlloc(sizeof(IoCtx_t), "IO ctx");
+ if (ioCtx != NULL)
+ ioCtx->devCtx = DevCtxAttach(devCtx);
+ return ioCtx;
+}
+
+static void __fastcall
+IoCtxFree(
+ IoCtx_t * ctx
+ )
+{
+ if (ctx)
+ DevCtxDetach(ctx->devCtx);
+ LocalPoolFree(ctx, "IO ctx");
+}
+
+static void __fastcall
+IoCtxReset(
+ IoCtx_t * ctx
+ )
+{
+ RIO_t * rio;
+ DevCtx_t * dev;
+ if (ctx) {
+ rio = ctx->rio;
+ dev = ctx->devCtx;
+ ZERO(*ctx);
+ ctx->rio = rio;
+ ctx->devCtx = dev;
+ }
+}
+
+/*
+ * -------------------------------------------------------------------
+ * The IO completion thread and support functions
+ *
+ * There is only one completion thread, because it is locked to the same
+ * core as the time interpolation. Having more than one causes core
+ * contention and is not useful.
+ * -------------------------------------------------------------------
+ */
+static HANDLE hIoCompletionThread;
+static UINT tidCompletionThread;
+
+/*
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * The IO completion worker thread
+ *
+ * Note that this thread does not enter an alertable wait state and that
+ * the only waiting point is the IO completion port. If stopping this
+ * thread with a special queued result packet does not work,
+ * 'TerminateThread()' is the only remaining weapon in the arsenal. A
+ * dangerous weapon -- it's like SIGKILL.
+ */
+static unsigned WINAPI
+iocompletionthread(void *NotUsed)
+{
+ DWORD err;
+ DWORD octets;
+ ULONG_PTR key;
+ OVERLAPPED * pol;
+ IoCtx_t * lpo;
+
+ UNUSED_ARG(NotUsed);
+
+ /*
+ * Socket and refclock receive call gettimeofday() so the I/O
+ * thread needs to be on the same processor as the main and
+ * timing threads to ensure consistent QueryPerformanceCounter()
+ * results.
+ *
+ * This gets seriously into the way of efficient thread pooling
+ * on multicore systems.
+ */
+ lock_thread_to_processor(GetCurrentThread());
+
+ /*
+ * Set the thread priority high enough so I/O will preempt
+ * normal recv packet processing, but not higher than the timer
+ * sync thread.
+ */
+ if (!SetThreadPriority(GetCurrentThread(),
+ THREAD_PRIORITY_ABOVE_NORMAL))
+ msyslog(LOG_ERR, "Can't set thread priority: %m");
+
+ for(;;) {
+ if (GetQueuedCompletionStatus(
+ hIoCompletionPort,
+ &octets,
+ &key,
+ &pol,
+ INFINITE)) {
+ err = ERROR_SUCCESS;
+ } else {
+ err = GetLastError();
+ }
+ if (NULL == pol) {
+ DPRINTF(2, ("Overlapped IO Thread Exiting\n"));
+ break; /* fail */
+ }
+ lpo = CONTAINEROF(pol, IoCtx_t, ol);
+ get_systime(&lpo->RecvTime);
+ lpo->byteCount = octets;
+ lpo->errCode = err;
+ handler_calls++;
+ (*lpo->onIoDone)(key, lpo);
+ }
+
+ return 0;
+}
+
+/*
+ * -------------------------------------------------------------------
+ * Create/initialise the I/O creation port
+ */
+void
+init_io_completion_port(void)
+{
+#ifdef DEBUG
+ atexit(&free_io_completion_port_mem);
+#endif
+
+ /* Create the context pool first. */
+ IoCtxPoolInit(20);
+
+ /* Create the event used to signal an IO event */
+ WaitableIoEventHandle = CreateEvent(NULL, FALSE, FALSE, NULL);
+ if (WaitableIoEventHandle == NULL) {
+ msyslog(LOG_ERR, "Can't create I/O event handle: %m");
+ exit(1);
+ }
+ /* Create the event used to signal an exit event */
+ WaitableExitEventHandle = CreateEvent(NULL, FALSE, FALSE, NULL);
+ if (WaitableExitEventHandle == NULL) {
+ msyslog(LOG_ERR, "Can't create exit event handle: %m");
+ exit(1);
+ }
+
+ /* Create the IO completion port */
+ hIoCompletionPort = CreateIoCompletionPort(
+ INVALID_HANDLE_VALUE, NULL, 0, 0);
+ if (hIoCompletionPort == NULL) {
+ msyslog(LOG_ERR, "Can't create I/O completion port: %m");
+ exit(1);
+ }
+
+ /* Initialize the Wait Handles table */
+ WaitHandles[0] = WaitableIoEventHandle;
+ WaitHandles[1] = WaitableExitEventHandle; /* exit request */
+ WaitHandles[2] = WaitableTimerHandle;
+ ActiveWaitHandles = 3;
+
+ /*
+ * Supply ntp_worker.c with function to add or remove a
+ * semaphore to the ntpd I/O loop which is signalled by a worker
+ * when a response is ready. The callback is invoked in the
+ * parent.
+ */
+ addremove_io_semaphore = &ntpd_addremove_semaphore;
+
+ /*
+ * Have one thread servicing I/O. See rationale in front matter.
+ */
+ hIoCompletionThread = (HANDLE)_beginthreadex(
+ NULL,
+ 0,
+ iocompletionthread,
+ NULL,
+ 0,
+ &tidCompletionThread);
+}
+
+
+/*
+ * -------------------------------------------------------------------
+ * completion port teardown
+ */
+void
+uninit_io_completion_port(
+ void
+ )
+{
+ DWORD rc;
+
+ /* do noting if completion port already gone. */
+ if (NULL == hIoCompletionPort)
+ return;
+
+ /*
+ * Service thread seems running. Terminate him with grace
+ * first and force later...
+ */
+ if (tidCompletionThread != GetCurrentThreadId()) {
+ PostQueuedCompletionStatus(hIoCompletionPort, 0, 0, 0);
+ rc = WaitForSingleObject(hIoCompletionThread, 5000);
+ if (rc == WAIT_TIMEOUT) {
+ /* Thread lost. Kill off with TerminateThread. */
+ msyslog(LOG_ERR,
+ "IO completion thread refuses to terminate");
+ TerminateThread(hIoCompletionThread, ~0UL);
+ }
+ }
+
+ /* stop using the memory pool */
+ IoCtxPoolDone();
+
+ /* now reap all handles... */
+ CloseHandle(hIoCompletionThread);
+ hIoCompletionThread = NULL;
+ CloseHandle(hIoCompletionPort);
+ hIoCompletionPort = NULL;
+}
+
+
+/*
+ * -------------------------------------------------------------------
+ * external worker thread support (wait handle stuff)
+ *
+ * !Attention!
+ *
+ * - This function must only be called from the main thread. Changing
+ * a set of wait handles while someone is waiting on it creates
+ * undefined behaviour. Also there's no provision for mutual
+ * exclusion when accessing global values.
+ *
+ * - It's not possible to register a handle that is already in the table.
+ */
+static void
+ntpd_addremove_semaphore(
+ HANDLE sem,
+ int remove
+ )
+{
+ DWORD hi;
+
+ /* search for a matching entry first. */
+ for (hi = 3; hi < ActiveWaitHandles; hi++)
+ if (sem == WaitHandles[hi])
+ break;
+
+ if (remove) {
+ /*
+ * If found, eventually swap with last entry to keep
+ * the table dense.
+ */
+ if (hi < ActiveWaitHandles) {
+ ActiveWaitHandles--;
+ if (hi < ActiveWaitHandles)
+ WaitHandles[hi] =
+ WaitHandles[ActiveWaitHandles];
+ WaitHandles[ActiveWaitHandles] = NULL;
+ }
+ } else {
+ /*
+ * Make sure the entry is not found and there is enough
+ * room, then append to the table array.
+ */
+ if (hi >= ActiveWaitHandles) {
+ NTP_INSIST(ActiveWaitHandles < COUNTOF(WaitHandles));
+ WaitHandles[ActiveWaitHandles] = sem;
+ ActiveWaitHandles++;
+ }
+ }
+}
+
+
+#ifdef DEBUG
+static void
+free_io_completion_port_mem(
+ void
+ )
+{
+ /*
+ * At the moment, do absolutely nothing. Returning memory here
+ * requires NO PENDING OVERLAPPED OPERATIONS AT ALL at this
+ * point in time, and as long we cannot be reasonable sure about
+ * that the simple advice is:
+ *
+ * HANDS OFF!
+ */
+}
+#endif /* DEBUG */
+
+
+/*
+ * -------------------------------------------------------------------
+ * Serial IO stuff
+ *
+ * Prelude -- common error checking code
+ * -------------------------------------------------------------------
+ */
+extern char * NTstrerror(int err, BOOL *bfreebuf);
+
+static BOOL
+IoResultCheck(
+ DWORD err,
+ IoCtx_t * ctx,
+ const char * msg
+ )
+{
+ char * msgbuf;
+ BOOL dynbuf;
+
+ /* If the clock is not / no longer active, assume
+ * 'ERROR_OPERATION_ABORTED' and do the necessary cleanup.
+ */
+ if (ctx->rio && !ctx->rio->active)
+ err = ERROR_OPERATION_ABORTED;
+
+ switch (err)
+ {
+ /* The first ones are no real errors. */
+ case ERROR_SUCCESS: /* all is good */
+ case ERROR_IO_PENDING: /* callback pending */
+ return TRUE;
+
+ /* the next ones go silently -- only cleanup is done */
+ case ERROR_INVALID_PARAMETER: /* handle already closed */
+ case ERROR_OPERATION_ABORTED: /* handle closed while wait */
+ break;
+
+
+ default:
+ /*
+ * We have to resort to the low level error formatting
+ * functions here, since the error code can be an
+ * overlapped result. Relying the value to be the same
+ * as the 'GetLastError()' result at this point of
+ * execution is shaky at best, and using SetLastError()
+ * to force it seems too nasty.
+ */
+ msgbuf = NTstrerror(err, &dynbuf);
+ msyslog(LOG_ERR, "%s: err=%u, '%s'", msg, err, msgbuf);
+ if (dynbuf)
+ LocalFree(msgbuf);
+ break;
+ }
+
+ /* If we end here, we have to mop up the buffer and context */
+ if (ctx->flRawMem) {
+ if (ctx->trans_buf)
+ free(ctx->trans_buf);
+ } else {
+ if (ctx->recv_buf)
+ freerecvbuf(ctx->recv_buf);
+ }
+ IoCtxFree(ctx);
+ return FALSE;
+}
+
+/*
+ * -------------------------------------------------------------------
+ * Serial IO stuff
+ *
+ * Part 1 -- COMM event handling
+ * -------------------------------------------------------------------
+ */
+
+static BOOL
+QueueSerialWait(
+ RIO_t * rio,
+ recvbuf_t * buff,
+ IoCtx_t * lpo
+ )
+{
+ BOOL rc;
+
+ lpo->onIoDone = OnSerialWaitComplete;
+ lpo->recv_buf = buff;
+ lpo->flRawMem = 0;
+ lpo->rio = rio;
+ buff->fd = rio->fd;
+
+ rc = WaitCommEvent((HANDLE)_get_osfhandle(rio->fd),
+ &lpo->com_events, &lpo->ol);
+ if (!rc)
+ return IoResultCheck(GetLastError(), lpo,
+ "Can't wait on Refclock");
+ return TRUE;
+}
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+static void
+OnSerialWaitComplete(
+ ULONG_PTR key,
+ IoCtx_t * lpo
+ )
+{
+ RIO_t * rio;
+ DevCtx_t * dev;
+ recvbuf_t * buff;
+ PPSDataEx_t * ppsbuf;
+ DWORD modem_status;
+ u_long covc;
+
+ /* check and bail out if operation failed */
+ if (!IoResultCheck(lpo->errCode, lpo,
+ "WaitCommEvent failed"))
+ return;
+
+ /* get & validate context and buffer. */
+ rio = (RIO_t *)key;
+ buff = lpo->recv_buf;
+ dev = lpo->devCtx;
+
+ NTP_INSIST(rio == lpo->rio);
+
+#ifdef DEBUG
+ if (~(EV_RXFLAG | EV_RLSD | EV_RXCHAR) & lpo->com_events) {
+ msyslog(LOG_ERR, "WaitCommEvent returned unexpected mask %x",
+ lpo->com_events);
+ exit(-1);
+ }
+#endif
+ /*
+ * Take note of changes on DCD; 'user mode PPS hack'.
+ * perlinger@ntp.org suggested a way of solving several problems with
+ * this code that makes a lot of sense: move to a putative
+ * dcdpps-ppsapi-provider.dll.
+ */
+ if (EV_RLSD & lpo->com_events) {
+ modem_status = 0;
+ GetCommModemStatus((HANDLE)_get_osfhandle(rio->fd),
+ &modem_status);
+
+ if (dev != NULL) {
+ /* PPS-context available -- use it! */
+ if (MS_RLSD_ON & modem_status) {
+ dev->pps_data.cc_assert++;
+ dev->pps_data.ts_assert = lpo->RecvTime;
+ DPRINTF(2, ("upps-real: fd %d DCD PPS Rise at %s\n", rio->fd,
+ ulfptoa(&lpo->RecvTime, 6)));
+ } else {
+ dev->pps_data.cc_clear++;
+ dev->pps_data.ts_clear = lpo->RecvTime;
+ DPRINTF(2, ("upps-real: fd %d DCD PPS Fall at %s\n", rio->fd,
+ ulfptoa(&lpo->RecvTime, 6)));
+ }
+ /*
+ ** Update PPS buffer, writing from low to high, with index
+ ** update as last action. We use interlocked ops and a
+ ** volatile data destination to avoid reordering on compiler
+ ** and CPU level. The interlocked instruction act as full
+ ** barriers -- we need only release semantics, but we don't
+ ** have them before VS2010.
+ */
+ covc = dev->cov_count + 1u;
+ ppsbuf = dev->pps_buff + (covc & PPS_QUEUE_MSK);
+ InterlockedExchange((PLONG)&ppsbuf->cov_count, covc);
+ ppsbuf->data = dev->pps_data;
+ InterlockedExchange((PLONG)&dev->cov_count, covc);
+ }
+ /* perlinger@ntp.org, 2012-11-19
+ It can be argued that once you have the PPS API active, you can
+ disable the old pps hack. This would give a behaviour that's much
+ more like the behaviour under a UN*Xish OS. On the other hand, it
+ will give a nasty surprise for people which have until now happily
+ taken the pps hack for granted, and after the first complaint, I have
+ decided to keep the old implementation unconditionally. So here it is:
+
+ /* backward compat: 'usermode-pps-hack' */
+ if (MS_RLSD_ON & modem_status) {
+ lpo->DCDSTime = lpo->RecvTime;
+ lpo->flTsDCDS = 1;
+ DPRINTF(2, ("upps-hack: fd %d DCD PPS Rise at %s\n", rio->fd,
+ ulfptoa(&lpo->RecvTime, 6)));
+ }
+ }
+
+ /* If IO ready, read data. Go back waiting else. */
+ if (EV_RXFLAG & lpo->com_events) { /* line discipline */
+ lpo->FlagTime = lpo->RecvTime;
+ lpo->flTsFlag = 1;
+ QueueSerialRead(rio, buff, lpo);
+ } else if (EV_RXCHAR & lpo->com_events) { /* raw discipline */
+ lpo->FlagTime = lpo->RecvTime;
+ lpo->flTsFlag = 1;
+ QueueRawSerialRead(rio, buff, lpo);
+ } else { /* idle... */
+ QueueSerialWait(rio, buff, lpo);
+ }
+}
+
+/*
+ * -------------------------------------------------------------------
+ * Serial IO stuff
+ *
+ * Part 2 -- line discipline emulation
+ *
+ * Ideally this should *not* be done in the IO completion thread.
+ * We use a worker pool thread to offload the low-level processing.
+ * -------------------------------------------------------------------
+ */
+
+/*
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Start & Queue a serial read for line discipline emulation.
+ */
+static BOOL
+QueueSerialRead(
+ RIO_t * rio,
+ recvbuf_t * buff,
+ IoCtx_t * lpo
+ )
+{
+ BOOL rc;
+
+ lpo->onIoDone = &OnSerialReadComplete;
+ lpo->recv_buf = buff;
+ lpo->flRawMem = 0;
+ lpo->rio = rio;
+ buff->fd = rio->fd;
+
+ rc = ReadFile((HANDLE)_get_osfhandle(rio->fd),
+ (char*)buff->recv_buffer + buff->recv_length,
+ sizeof(buff->recv_buffer) - buff->recv_length,
+ NULL, &lpo->ol);
+ if (!rc)
+ return IoResultCheck(GetLastError(), lpo,
+ "Can't read from Refclock");
+ return TRUE;
+}
+
+/*
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * IO completion thread callback. Takes a time stamp and offloads the
+ * real work to the worker pool ASAP.
+ */
+static void
+OnSerialReadComplete(
+ ULONG_PTR key,
+ IoCtx_t * lpo
+ )
+{
+ RIO_t * rio;
+ recvbuf_t * buff;
+
+ /* check and bail out if operation failed */
+ if (!IoResultCheck(lpo->errCode, lpo,
+ "Read from Refclock failed"))
+ return;
+
+ /* get & validate context and buffer. */
+ rio = lpo->rio;
+ buff = lpo->recv_buf;
+ NTP_INSIST((ULONG_PTR)rio == key);
+
+ /* Offload to worker pool */
+ if (!QueueUserWorkItem(&OnSerialReadWorker, lpo, WT_EXECUTEDEFAULT)) {
+ msyslog(LOG_ERR,
+ "Can't offload to worker thread, will skip data: %m");
+ IoCtxReset(lpo);
+ buff->recv_length = 0;
+ QueueSerialWait(rio, buff, lpo);
+ }
+}
+
+
+/*
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Worker pool offload function -- avoid lengthy operations in the IO
+ * completion thread (affects timing...)
+ *
+ * This function does the real work of emulating the UN*X line
+ * discipline. Since this involves allocation of additional buffers and
+ * string parsing/copying, it is offloaded to the worker thread pool so
+ * the IO completion thread can resume faster.
+ */
+static DWORD WINAPI
+OnSerialReadWorker(void * ctx)
+{
+ IoCtx_t * lpo;
+ recvbuf_t * buff, *obuf;
+ RIO_t * rio;
+ char *sptr, *send, *dptr;
+ BOOL eol;
+ char ch;
+
+ /* Get context back */
+ lpo = (IoCtx_t*)ctx;
+ buff = lpo->recv_buf;
+ rio = lpo->rio;
+ /*
+ * ignore 0 bytes read due to closure on fd.
+ * Eat the first line of input as it's possibly partial.
+ */
+ if (lpo->byteCount && rio->recvcount++) {
+ /* account for additional input */
+ buff->recv_length += (int)lpo->byteCount;
+
+ /*
+ * Now mimic the Unix line discipline.
+ */
+ sptr = (char *)buff->recv_buffer;
+ send = sptr + buff->recv_length;
+ obuf = NULL;
+ dptr = NULL;
+
+ /* hack #1: eat away leading CR/LF if here is any */
+ while (sptr != send) {
+ ch = *sptr;
+ if (ch != '\n' && ch != '\r')
+ break;
+ sptr++;
+ }
+
+ while (sptr != send)
+ {
+ /* get new buffer to store line */
+ obuf = get_free_recv_buffer_alloc();
+ obuf->fd = rio->fd;
+ obuf->receiver = &process_refclock_packet;
+ obuf->dstadr = NULL;
+ obuf->recv_peer = rio->srcclock;
+ set_serial_recv_time(obuf, lpo);
+
+ /*
+ * Copy data to new buffer, convert CR to LF on
+ * the fly. Stop after either.
+ */
+ dptr = (char *)obuf->recv_buffer;
+ eol = FALSE;
+ while (sptr != send && !eol) {
+ ch = *sptr++;
+ if ('\r' == ch) {
+ ch = '\n';
+ }
+ *dptr++ = ch;
+ eol = ('\n' == ch);
+ }
+ obuf->recv_length =
+ (int)(dptr - (char *)obuf->recv_buffer);
+
+ /*
+ * If NL found, push this buffer and prepare to
+ * get a new one.
+ */
+ if (eol) {
+ add_full_recv_buffer(obuf);
+ SetEvent(WaitableIoEventHandle);
+ obuf = NULL;
+ }
+ }
+
+ /*
+ * If we still have an output buffer, continue to fill
+ * it again.
+ */
+ if (obuf) {
+ obuf->recv_length =
+ (int)(dptr - (char *)obuf->recv_buffer);
+ freerecvbuf(buff);
+ buff = obuf;
+ } else {
+ /* clear the current buffer, continue */
+ buff->recv_length = 0;
+ }
+ } else {
+ buff->recv_length = 0;
+ }
+
+ IoCtxReset(lpo);
+ QueueSerialWait(rio, buff, lpo);
+ return 0;
+}
+
+
+/*
+ * -------------------------------------------------------------------
+ * Serial IO stuff
+ *
+ * Part 3 -- raw data input
+ *
+ * Raw data processing is fast enough to do without offloading to the
+ * worker pool, so this is rather short'n sweet...
+ * -------------------------------------------------------------------
+ */
+
+static BOOL
+QueueRawSerialRead(
+ RIO_t * rio,
+ recvbuf_t * buff,
+ IoCtx_t * lpo
+ )
+{
+ BOOL rc;
+
+ lpo->onIoDone = OnRawSerialReadComplete;
+ lpo->recv_buf = buff;
+ lpo->flRawMem = 0;
+ lpo->rio = rio;
+ buff->fd = rio->fd;
+
+ rc = ReadFile((HANDLE)_get_osfhandle(rio->fd),
+ buff->recv_buffer,
+ sizeof(buff->recv_buffer),
+ NULL, &lpo->ol);
+ if (!rc)
+ return IoResultCheck(GetLastError(), lpo,
+ "Can't read raw from Refclock");
+ return TRUE;
+}
+
+
+static void
+OnRawSerialReadComplete(
+ ULONG_PTR key,
+ IoCtx_t * lpo
+ )
+{
+ RIO_t * rio;
+ recvbuf_t * buff;
+
+ /* check and bail out if operation failed */
+ if (!IoResultCheck(lpo->errCode, lpo,
+ "Raw read from Refclock failed"))
+ return;
+
+ /* get & validate context and buffer. */
+ rio = lpo->rio;
+ buff = lpo->recv_buf;
+ NTP_INSIST((ULONG_PTR)rio == key);
+
+ /* ignore 0 bytes read. */
+ if (lpo->byteCount > 0) {
+ buff->recv_length = (int)lpo->byteCount;
+ buff->dstadr = NULL;
+ buff->receiver = process_refclock_packet;
+ buff->recv_peer = rio->srcclock;
+ set_serial_recv_time(buff, lpo);
+ add_full_recv_buffer(buff);
+ SetEvent(WaitableIoEventHandle);
+ buff = get_free_recv_buffer_alloc();
+ }
+
+ buff->recv_length = 0;
+ QueueSerialWait(rio, buff, lpo);
+}
+
+
+static inline void
+set_serial_recv_time(
+ recvbuf_t * obuf,
+ IoCtx_t * lpo
+ )
+{
+ /*
+ * Time stamp assignment is interesting. If we
+ * have a DCD stamp, we use it, otherwise we use
+ * the FLAG char event time, and if that is also
+ * not / no longer available we use the arrival
+ * time.
+ */
+ if (lpo->flTsDCDS)
+ obuf->recv_time = lpo->DCDSTime;
+ else if (lpo->flTsFlag)
+ obuf->recv_time = lpo->FlagTime;
+ else
+ obuf->recv_time = lpo->RecvTime;
+
+ lpo->flTsDCDS = lpo->flTsFlag = 0; /* use only once... */
+}
+
+
+/*
+ * -------------------------------------------------------------------
+ * Serial IO stuff
+ *
+ * Part 4 -- Overlapped serial output
+ *
+ * Again, no need to offload any work.
+ * -------------------------------------------------------------------
+ */
+
+/*
+ * async_write, clone of write(), used by some reflock drivers
+ */
+int
+async_write(
+ int fd,
+ const void * data,
+ unsigned int count
+ )
+{
+ IoCtx_t * lpo;
+ BOOL rc;
+
+ lpo = IoCtxAlloc(NULL);
+ if (lpo == NULL) {
+ DPRINTF(1, ("async_write: out of memory\n"));
+ errno = ENOMEM;
+ return -1;
+ }
+
+ lpo->onIoDone = OnSerialWriteComplete;
+ lpo->trans_buf = emalloc(count);
+ lpo->flRawMem = 1;
+ memcpy(lpo->trans_buf, data, count);
+
+ rc = WriteFile((HANDLE)_get_osfhandle(fd),
+ lpo->trans_buf, count,
+ NULL, &lpo->ol);
+ if (!rc && !IoResultCheck(GetLastError(), lpo,
+ "Can't write to Refclock")) {
+ errno = EBADF;
+ return -1;
+ }
+ return count;
+}
+
+static void
+OnSerialWriteComplete(
+ ULONG_PTR key,
+ IoCtx_t * lpo
+ )
+{
+ /* set RIO and force silent cleanup if no error */
+ lpo->rio = (RIO_t *)key;
+ if (ERROR_SUCCESS == lpo->errCode)
+ lpo->errCode = ERROR_OPERATION_ABORTED;
+ IoResultCheck(lpo->errCode, lpo,
+ "Write to Refclock failed");
+}
+
+
+/*
+ * -------------------------------------------------------------------
+ * Serial IO stuff
+ *
+ * Part 5 -- read PPS time stamps
+ *
+ * -------------------------------------------------------------------
+ */
+
+/* The dummy read procedure is used for getting the device context
+ * into the IO completion thread, using the IO completion queue for
+ * transport. There are other ways to accomplish what we need here,
+ * but using the IO machine is handy and avoids a lot of trouble.
+ */
+static void
+OnPpsDummyRead(
+ ULONG_PTR key,
+ IoCtx_t * lpo
+ )
+{
+ RIO_t * rio;
+
+ rio = (RIO_t *)key;
+ lpo->devCtx = DevCtxAttach(rio->device_context);
+ SetEvent(lpo->ppswake);
+}
+
+__declspec(dllexport) void* __stdcall
+ntp_pps_attach_device(
+ HANDLE hndIo
+ )
+{
+ IoCtx_t myIoCtx;
+ HANDLE myEvt;
+ DevCtx_t * dev;
+ DWORD rc;
+
+ if (!isserialhandle(hndIo)) {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return NULL;
+ }
+
+ ZERO(myIoCtx);
+ dev = NULL;
+ myEvt = CreateEvent(NULL, FALSE, FALSE, NULL);
+ if (NULL == myEvt)
+ goto done;
+
+ myIoCtx.ppswake = myEvt;
+ myIoCtx.onIoDone = OnPpsDummyRead;
+ rc = ReadFile(hndIo, &myIoCtx.byteCount, 0,
+ &myIoCtx.byteCount, &myIoCtx.ol);
+ if (!rc && (GetLastError() != ERROR_IO_PENDING))
+ goto done;
+ if (WaitForSingleObject(myEvt, INFINITE) == WAIT_OBJECT_0)
+ if (NULL == (dev = myIoCtx.devCtx))
+ SetLastError(ERROR_INVALID_HANDLE);
+done:
+ rc = GetLastError();
+ CloseHandle(myEvt);
+ SetLastError(rc);
+ return dev;
+}
+
+__declspec(dllexport) void __stdcall
+ntp_pps_detach_device(
+ DevCtx_t * dev
+ )
+{
+ DevCtxDetach(dev);
+}
+
+__declspec(dllexport) BOOL __stdcall
+ntp_pps_read(
+ DevCtx_t * dev,
+ PPSData_t * data,
+ size_t dlen
+ )
+{
+ u_long guard, covc;
+ int repc;
+ PPSDataEx_t * ppsbuf;
+
+
+ if (dev == NULL) {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+ if (data == NULL || dlen != sizeof(PPSData_t)) {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+ /*
+ ** Reading from shared memory in a lock-free fashion can be
+ ** a bit tricky, since we have to read the components in the
+ ** opposite direction from the write, and the compiler must
+ ** not reorder the read sequence.
+ ** We use interlocked ops and a volatile data source to avoid
+ ** reordering on compiler and CPU level. The interlocked
+ ** instruction act as full barriers -- we need only aquire
+ ** semantics, but we don't have them before VS2010.
+ */
+ repc = 3;
+ do {
+ InterlockedExchange((PLONG)&covc, dev->cov_count);
+ ppsbuf = dev->pps_buff + (covc & PPS_QUEUE_MSK);
+ *data = ppsbuf->data;
+ InterlockedExchange((PLONG)&guard, ppsbuf->cov_count);
+ guard ^= covc;
+ } while (guard && ~guard && --repc);
+
+ if (guard) {
+ SetLastError(ERROR_INVALID_DATA);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * Add a reference clock data structures I/O handles to
+ * the I/O completion port. Return 1 if any error.
+ */
+int
+io_completion_port_add_clock_io(
+ RIO_t *rio
+ )
+{
+ IoCtx_t * lpo;
+ DevCtx_t * dev;
+ recvbuf_t * buff;
+ HANDLE h;
+
+ h = (HANDLE)_get_osfhandle(rio->fd);
+ if (NULL == CreateIoCompletionPort(
+ h,
+ hIoCompletionPort,
+ (ULONG_PTR)rio,
+ 0)) {
+ msyslog(LOG_ERR, "Can't add COM port to i/o completion port: %m");
+ return 1;
+ }
+
+ dev = DevCtxAlloc();
+ if (NULL == dev) {
+ msyslog(LOG_ERR, "Can't allocate device context for i/o completion port: %m");
+ return 1;
+ }
+ rio->device_context = DevCtxAttach(dev);
+ lpo = IoCtxAlloc(dev);
+ if (NULL == lpo) {
+ msyslog(LOG_ERR, "Can't allocate heap for completion port: %m");
+ return 1;
+ }
+ buff = get_free_recv_buffer_alloc();
+ buff->recv_length = 0;
+ QueueSerialWait(rio, buff, lpo);
+
+ return 0;
+}
+
+void
+io_completion_port_remove_clock_io(
+ RIO_t *rio
+ )
+{
+ if (rio)
+ DevCtxDetach((DevCtx_t *)rio->device_context);
+}
+
+/*
+ * Queue a receiver on a socket. Returns 0 if no buffer can be queued
+ *
+ * Note: As per the winsock documentation, we use WSARecvFrom. Using
+ * ReadFile() is less efficient.
+ */
+static BOOL
+QueueSocketRecv(
+ SOCKET s,
+ recvbuf_t * buff,
+ IoCtx_t * lpo
+ )
+{
+ WSABUF wsabuf;
+ DWORD Flags;
+ int rc;
+
+ lpo->onIoDone = OnSocketRecv;
+ lpo->recv_buf = buff;
+ lpo->flRawMem = 0;
+ lpo->rio = NULL;
+
+ Flags = 0;
+ buff->fd = s;
+ buff->recv_srcadr_len = sizeof(buff->recv_srcadr);
+ wsabuf.buf = (char *)buff->recv_buffer;
+ wsabuf.len = sizeof(buff->recv_buffer);
+
+ rc = WSARecvFrom(buff->fd, &wsabuf, 1, NULL, &Flags,
+ &buff->recv_srcadr.sa, &buff->recv_srcadr_len,
+ &lpo->ol, NULL);
+ if (SOCKET_ERROR == rc)
+ return IoResultCheck(GetLastError(), lpo,
+ "Can't read from Socket");
+ return TRUE;
+}
+
+
+static void
+OnSocketRecv(
+ ULONG_PTR key,
+ IoCtx_t * lpo
+ )
+{
+ recvbuf_t * buff;
+ recvbuf_t * newbuff;
+ struct interface * inter = (struct interface *)key;
+
+ NTP_REQUIRE(NULL != lpo);
+ NTP_REQUIRE(NULL != lpo->recv_buf);
+
+ /* check and bail out if operation failed */
+ if (!IoResultCheck(lpo->errCode, lpo,
+ "Read from Socket failed"))
+ return;
+
+ /*
+ * Convert the overlapped pointer back to a recvbuf pointer.
+ * Fetch items that are lost when the context is queued again.
+ */
+ buff = lpo->recv_buf;
+ buff->recv_time = lpo->RecvTime;
+ buff->recv_length = (int)lpo->byteCount;
+
+ /*
+ * Get a new recv buffer for the replacement socket receive
+ */
+ newbuff = get_free_recv_buffer_alloc();
+ if (NULL != newbuff) {
+ QueueSocketRecv(inter->fd, newbuff, lpo);
+ } else {
+ IoCtxFree(lpo);
+ msyslog(LOG_ERR, "Can't add I/O request to socket");
+ }
+ DPRINTF(4, ("%sfd %d %s recv packet mode is %d\n",
+ (MODE_BROADCAST == get_packet_mode(buff))
+ ? " **** Broadcast "
+ : "",
+ (int)buff->fd, stoa(&buff->recv_srcadr),
+ get_packet_mode(buff)));
+
+ /*
+ * If we keep it add some info to the structure
+ */
+ if (buff->recv_length && !inter->ignore_packets) {
+ NTP_INSIST(buff->recv_srcadr_len <=
+ sizeof(buff->recv_srcadr));
+ buff->receiver = &receive;
+ buff->dstadr = inter;
+ packets_received++;
+ handler_pkts++;
+ inter->received++;
+ add_full_recv_buffer(buff);
+
+ DPRINTF(2, ("Received %d bytes fd %d in buffer %p from %s\n",
+ buff->recv_length, (int)buff->fd, buff,
+ stoa(&buff->recv_srcadr)));
+
+ /*
+ * Now signal we have something to process
+ */
+ SetEvent(WaitableIoEventHandle);
+ } else
+ freerecvbuf(buff);
+}
+
+
+/*
+ * Add a socket handle to the I/O completion port, and send
+ * NTP_RECVS_PER_SOCKET recv requests to the kernel.
+ */
+int
+io_completion_port_add_socket(
+ SOCKET fd,
+ struct interface * inter
+ )
+{
+ IoCtx_t * lpo;
+ recvbuf_t * buff;
+ int n;
+
+ if (fd != INVALID_SOCKET) {
+ if (NULL == CreateIoCompletionPort((HANDLE)fd,
+ hIoCompletionPort, (ULONG_PTR)inter, 0)) {
+ msyslog(LOG_ERR,
+ "Can't add socket to i/o completion port: %m");
+ return 1;
+ }
+ }
+
+ /*
+ * Windows 2000 bluescreens with bugcheck 0x76
+ * PROCESS_HAS_LOCKED_PAGES at ntpd process
+ * termination when using more than one pending
+ * receive per socket. A runtime version test
+ * would allow using more on newer versions
+ * of Windows.
+ */
+
+#define WINDOWS_RECVS_PER_SOCKET 1
+
+ for (n = 0; n < WINDOWS_RECVS_PER_SOCKET; n++) {
+
+ buff = get_free_recv_buffer_alloc();
+ lpo = IoCtxAlloc(NULL);
+ if (lpo == NULL)
+ {
+ msyslog(LOG_ERR
+ , "Can't allocate IO completion context: %m");
+ return 1;
+ }
+
+ QueueSocketRecv(fd, buff, lpo);
+
+ }
+ return 0;
+}
+
+
+/*
+ * io_completion_port_sendto() -- sendto() replacement for Windows
+ *
+ * Returns len after successful send.
+ * Returns -1 for any error, with the error code available via
+ * msyslog() %m, or GetLastError().
+ */
+int
+io_completion_port_sendto(
+ int fd,
+ void * pkt,
+ size_t len,
+ sockaddr_u * dest
+ )
+{
+ static u_long time_next_ifscan_after_error;
+ WSABUF wsabuf;
+ DWORD octets_sent;
+ DWORD Result;
+ int errval;
+ int AddrLen;
+
+ wsabuf.buf = (void *)pkt;
+ wsabuf.len = len;
+ AddrLen = SOCKLEN(dest);
+ octets_sent = 0;
+
+ Result = WSASendTo(fd, &wsabuf, 1, &octets_sent, 0,
+ &dest->sa, AddrLen, NULL, NULL);
+ errval = GetLastError();
+ if (SOCKET_ERROR == Result) {
+ if (ERROR_UNEXP_NET_ERR == errval) {
+ /*
+ * We get this error when trying to send if the
+ * network interface is gone or has lost link.
+ * Rescan interfaces to catch on sooner, but no
+ * more often than once per minute. Once ntpd
+ * is able to detect changes without polling
+ * this should be unneccessary
+ */
+ if (time_next_ifscan_after_error < current_time) {
+ time_next_ifscan_after_error = current_time + 60;
+ timer_interfacetimeout(current_time);
+ }
+ DPRINTF(4, ("sendto unexpected network error, interface may be down\n"));
+ } else {
+ msyslog(LOG_ERR, "WSASendTo(%s) error %m",
+ stoa(dest));
+ }
+ SetLastError(errval);
+ return -1;
+ }
+
+ if (len != (int)octets_sent) {
+ msyslog(LOG_ERR, "WSASendTo(%s) sent %u of %d octets",
+ stoa(dest), octets_sent, len);
+ SetLastError(ERROR_BAD_LENGTH);
+ return -1;
+ }
+
+ DPRINTF(4, ("sendto %s %d octets\n", stoa(dest), len));
+
+ return len;
+}
+
+
+
+/*
+ * GetReceivedBuffers
+ * Note that this is in effect the main loop for processing requests
+ * both send and receive. This should be reimplemented
+ */
+int
+GetReceivedBuffers()
+{
+ DWORD index;
+ HANDLE ready;
+ int have_packet;
+
+ have_packet = FALSE;
+ while (!have_packet) {
+ index = WaitForMultipleObjects(ActiveWaitHandles,
+ WaitHandles, FALSE,
+ INFINITE);
+ switch (index) {
+
+ case WAIT_OBJECT_0 + 0: /* Io event */
+ DPRINTF(4, ("IoEvent occurred\n"));
+ have_packet = TRUE;
+ break;
+
+ case WAIT_OBJECT_0 + 1: /* exit request */
+ exit(0);
+ break;
+
+ case WAIT_OBJECT_0 + 2: /* timer */
+ timer();
+ break;
+
+ case WAIT_IO_COMPLETION: /* loop */
+ break;
+
+ case WAIT_TIMEOUT:
+ msyslog(LOG_ERR,
+ "WaitForMultipleObjects INFINITE timed out.");
+ exit(1);
+ break;
+
+ case WAIT_FAILED:
+ msyslog(LOG_ERR,
+ "WaitForMultipleObjects Failed: Error: %m");
+ exit(1);
+ break;
+
+ default:
+ DEBUG_INSIST((index - WAIT_OBJECT_0) <
+ ActiveWaitHandles);
+ ready = WaitHandles[index - WAIT_OBJECT_0];
+ handle_blocking_resp_sem(ready);
+ break;
+
+ } /* switch */
+ }
+
+ return (full_recvbuffs()); /* get received buffers */
+}
+
+#else
+ static int NonEmptyCompilationUnit;
+#endif
+
diff --git a/ports/winnt/ntpd/ntservice.c b/ports/winnt/ntpd/ntservice.c
new file mode 100644
index 000000000000..f0840bdb9d6a
--- /dev/null
+++ b/ports/winnt/ntpd/ntservice.c
@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1999-2002 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include
+#endif
+
+#include
+
+#include
+#include "syslog.h"
+#include "ntpd.h"
+#include "ntservice.h"
+#include "clockstuff.h"
+#include "ntp_iocompletionport.h"
+#include "ntpd-opts.h"
+#include "isc/win32os.h"
+#include
+
+
+/*
+ * Globals
+ */
+static SERVICE_STATUS_HANDLE hServiceStatus = 0;
+static BOOL foreground = FALSE;
+static BOOL computer_shutting_down = FALSE;
+static int glb_argc;
+static char **glb_argv;
+HANDLE hServDoneEvent = NULL;
+extern int accept_wildcard_if_for_winnt;
+
+/*
+ * Forward declarations
+ */
+void uninit_io_completion_port();
+int ntpdmain(int argc, char *argv[]);
+void WINAPI ServiceControl(DWORD dwCtrlCode);
+void ntservice_exit(void);
+
+#ifdef WRAP_DBG_MALLOC
+void *wrap_dbg_malloc(size_t s, const char *f, int l);
+void *wrap_dbg_realloc(void *p, size_t s, const char *f, int l);
+void wrap_dbg_free(void *p);
+#endif
+
+void WINAPI
+service_main(
+ DWORD argc,
+ LPTSTR *argv
+ )
+{
+ if (argc > 1) {
+ /*
+ * Let command line parameters from the Windows SCM GUI
+ * override the standard parameters from the ImagePath registry key.
+ */
+ glb_argc = argc;
+ glb_argv = argv;
+ }
+
+ ntpdmain(glb_argc, glb_argv);
+}
+
+
+/*
+ * This is the entry point for the executable
+ * We can call ntpdmain() explicitly or via StartServiceCtrlDispatcher()
+ * as we need to.
+ */
+int main(
+ int argc,
+ char ** argv
+ )
+{
+ int rc;
+ int argc_after_opts;
+ char ** argv_after_opts;
+
+ ssl_applink();
+
+ /* Save the command line parameters */
+ glb_argc = argc;
+ glb_argv = argv;
+
+ /* Under original Windows NT we must not discard the wildcard */
+ /* socket to workaround a bug in NT's getsockname(). */
+ if (isc_win32os_majorversion() <= 4)
+ accept_wildcard_if_for_winnt = TRUE;
+
+ argc_after_opts = argc;
+ argv_after_opts = argv;
+ parse_cmdline_opts(&argc_after_opts, &argv_after_opts);
+
+ if (HAVE_OPT(QUIT)
+ || HAVE_OPT(SAVECONFIGQUIT)
+ || HAVE_OPT(HELP)
+#ifdef DEBUG
+ || OPT_VALUE_SET_DEBUG_LEVEL != 0
+#endif
+ || HAVE_OPT(NOFORK))
+ foreground = TRUE;
+
+ if (foreground) /* run in console window */
+ rc = ntpdmain(argc, argv);
+ else {
+ /* Start up as service */
+
+ SERVICE_TABLE_ENTRY dispatchTable[] = {
+ { TEXT(NTP_DISPLAY_NAME), service_main },
+ { NULL, NULL }
+ };
+
+ rc = StartServiceCtrlDispatcher(dispatchTable);
+ if (rc)
+ rc = 0;
+ else {
+ rc = GetLastError();
+ fprintf(stderr,
+ "%s: unable to start as service:\n"
+ "%s\n"
+ "Use -d, -q, -n, -?, --help or "
+ "--saveconfigquit to run "
+ "interactive.\n",
+ argv[0], ntp_strerror(rc));
+ }
+ }
+ return rc;
+}
+
+
+/*
+ * Initialize the Service by registering it.
+ */
+void
+ntservice_init() {
+ char ConsoleTitle[256];
+
+ if (!foreground) {
+ /* Register handler with the SCM */
+ hServiceStatus = RegisterServiceCtrlHandler(NTP_DISPLAY_NAME,
+ ServiceControl);
+ if (!hServiceStatus) {
+ NTReportError(NTP_SERVICE_NAME,
+ "could not register service control handler");
+ exit(1);
+ }
+ UpdateSCM(SERVICE_RUNNING);
+ } else {
+ snprintf(ConsoleTitle, sizeof(ConsoleTitle),
+ "NTP Version %s", Version);
+ ConsoleTitle[sizeof(ConsoleTitle) - 1] = '\0';
+ SetConsoleTitle(ConsoleTitle);
+ }
+
+#ifdef _CRTDBG_MAP_ALLOC
+ /* ask the runtime to dump memory leaks at exit */
+ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF
+ | _CRTDBG_LEAK_CHECK_DF /* report on leaks at exit */
+ | _CRTDBG_CHECK_ALWAYS_DF /* Check heap every alloc/dealloc */
+#ifdef MALLOC_LINT
+ | _CRTDBG_DELAY_FREE_MEM_DF /* Don't actually free memory */
+#endif
+ );
+#ifdef DOES_NOT_WORK
+ /*
+ * hart: I haven't seen this work, running ntpd.exe -n from a shell
+ * to both a file and the debugger output window. Docs indicate it
+ * should cause leak report to go to stderr, but it's only seen if
+ * ntpd runs under a debugger (in the debugger's output), even with
+ * this block of code enabled.
+ */
+ _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+#endif
+#endif /* using MS debug C runtime heap, _CRTDBG_MAP_ALLOC */
+
+ atexit( ntservice_exit );
+}
+
+
+/*
+ * Routine to check if the service is stopping
+ * because the computer is shutting down
+ */
+BOOL
+ntservice_systemisshuttingdown() {
+ return computer_shutting_down;
+}
+
+void
+ntservice_exit( void )
+{
+ uninit_io_completion_port();
+ Sleep( 200 ); //##++
+
+ reset_winnt_time();
+
+ msyslog(LOG_INFO, "ntservice: The Network Time Protocol Service is stopping.");
+
+ if (!foreground) {
+ /* service mode, need to have the service_main routine
+ * register with the service control manager that the
+ * service has stopped running, before exiting
+ */
+ UpdateSCM(SERVICE_STOPPED);
+ }
+}
+
+/*
+ * ServiceControl(): Handles requests from the SCM and passes them on
+ * to the service.
+ */
+void WINAPI
+ServiceControl(
+ DWORD dwCtrlCode
+ )
+{
+ switch (dwCtrlCode) {
+
+ case SERVICE_CONTROL_SHUTDOWN:
+ computer_shutting_down = TRUE;
+ /* fall through to stop case */
+
+ case SERVICE_CONTROL_STOP:
+ if (WaitableExitEventHandle != NULL) {
+ SetEvent(WaitableExitEventHandle);
+ UpdateSCM(SERVICE_STOP_PENDING);
+ Sleep(100); //##++
+ }
+ return;
+
+ case SERVICE_CONTROL_PAUSE:
+ case SERVICE_CONTROL_CONTINUE:
+ case SERVICE_CONTROL_INTERROGATE:
+ default:
+ break;
+ }
+ UpdateSCM(SERVICE_RUNNING);
+}
+
+/*
+ * Tell the Service Control Manager the state of the service.
+ */
+void UpdateSCM(DWORD state) {
+ SERVICE_STATUS ss;
+ static DWORD dwState = SERVICE_STOPPED;
+
+ if (hServiceStatus) {
+ if (state)
+ dwState = state;
+
+ ZERO(ss);
+ ss.dwServiceType |= SERVICE_WIN32_OWN_PROCESS;
+ ss.dwCurrentState = dwState;
+ ss.dwControlsAccepted = SERVICE_ACCEPT_STOP |
+ SERVICE_ACCEPT_SHUTDOWN;
+ ss.dwCheckPoint = 0;
+ ss.dwServiceSpecificExitCode = 0;
+ ss.dwWin32ExitCode = NO_ERROR;
+ ss.dwWaitHint = dwState == SERVICE_STOP_PENDING ? 5000 : 1000;
+
+ SetServiceStatus(hServiceStatus, &ss);
+ }
+}
+
+BOOL WINAPI
+OnConsoleEvent(
+ DWORD dwCtrlType
+ )
+{
+ switch (dwCtrlType) {
+#ifdef DEBUG
+ case CTRL_BREAK_EVENT:
+ if (debug > 0) {
+ debug <<= 1;
+ }
+ else {
+ debug = 1;
+ }
+ if (debug > 8) {
+ debug = 0;
+ }
+ msyslog(LOG_DEBUG, "debug level %d", debug);
+ break;
+#else
+ case CTRL_BREAK_EVENT:
+ break;
+#endif
+
+ case CTRL_C_EVENT:
+ case CTRL_CLOSE_EVENT:
+ case CTRL_SHUTDOWN_EVENT:
+ if (WaitableExitEventHandle != NULL) {
+ SetEvent(WaitableExitEventHandle);
+ Sleep(100); //##++
+ }
+ break;
+
+ default :
+ /* pass to next handler */
+ return FALSE;
+ }
+
+ /* we've handled it, no more handlers should be called */
+ return TRUE;
+}
+
diff --git a/ports/winnt/ntptrace/ntptrace.dsp b/ports/winnt/ntptrace/ntptrace.dsp
new file mode 100644
index 000000000000..ed8616a37802
--- /dev/null
+++ b/ports/winnt/ntptrace/ntptrace.dsp
@@ -0,0 +1,153 @@
+# Microsoft Developer Studio Project File - Name="ntptrace" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ntptrace - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ntptrace.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ntptrace.mak" CFG="ntptrace - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ntptrace - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "ntptrace - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""$/ntp/dev/ports/winnt/ntptrace", AXBAAAAA"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ntptrace - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W4 /GX /O2 /I "\\" /I "$(OPENSSL)\inc32" /I "." /I "..\include" /I "..\..\..\include" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /YX"windows.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "ntptrace - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\..\..\include" /I "$(OPENSSL)\inc32" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /FR /YX"windows.h" /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/Debug/ntptrace.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "ntptrace - Win32 Release"
+# Name "ntptrace - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\..\ntptrace\ntptrace.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libntp\util_clockstuff.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\version.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\include\sys\ioctl.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\ntptrace\ntptrace.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\sys\resource.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=..\..\..\configure
+
+!IF "$(CFG)" == "ntptrace - Win32 Release"
+
+# Begin Custom Build
+ProjDir=.
+InputPath=..\..\..\configure
+
+"$(ProjDir)\version.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ echo Using NT Shell Script to generate version.c
+ ..\scripts\mkver.bat -P ntptrace
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "ntptrace - Win32 Debug"
+
+# Begin Custom Build
+ProjDir=.
+InputPath=..\..\..\configure
+
+"$(ProjDir)\version.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ echo Using NT Shell Script to generate version.c
+ ..\scripts\mkver.bat -P ntptrace
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/ports/winnt/ppsapi/loopback/monolithic-serialpps-timepps.h b/ports/winnt/ppsapi/loopback/monolithic-serialpps-timepps.h
new file mode 100644
index 000000000000..1007ccdd90c3
--- /dev/null
+++ b/ports/winnt/ppsapi/loopback/monolithic-serialpps-timepps.h
@@ -0,0 +1,714 @@
+/***********************************************************************
+ * *
+ * Copyright (c) David L. Mills 1999-2000 *
+ * *
+ * Permission to use, copy, modify, and distribute this software and *
+ * its documentation for any purpose and with or without fee is hereby *
+ * granted, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission *
+ * notice appear in supporting documentation, and that the name *
+ * University of Delaware not be used in advertising or publicity *
+ * pertaining to distribution of the software without specific, *
+ * written prior permission. The University of Delaware makes no *
+ * representations about the suitability this software for any *
+ * purpose. It is provided "as is" without express or implied *
+ * warranty. *
+ * *
+ ***********************************************************************
+ * *
+ * This header file complies with "Pulse-Per-Second API for UNIX-like *
+ * Operating Systems, Version 1.0", rfc2783. Credit is due Jeff Mogul *
+ * and Marc Brett, from whom much of this code was shamelessly stolen. *
+ * *
+ * This modified timepps.h can be used to provide a PPSAPI interface *
+ * to a machine running Windows with a suitably modified *
+ * serialpps.sys being used in place of serial.sys. It can *
+ * be extended to support a modified parallel port driver once *
+ * available. *
+ * *
+ * This Windows version was derived by Dave Hart *
+ * from Mills' timepps-Solaris.h *
+ * *
+ ***********************************************************************
+ * *
+ * Some of this include file *
+ * Copyright (c) 1999 by Ulrich Windl, *
+ * based on code by Reg Clemens *
+ * based on code by Poul-Henning Kamp *
+ * *
+ ***********************************************************************
+ * *
+ * "THE BEER-WARE LICENSE" (Revision 42): *
+ * wrote this file. As long as you retain this *
+ * notice you can do whatever you want with this stuff. If we meet some*
+ * day, and you think this stuff is worth it, you can buy me a beer *
+ * in return. Poul-Henning Kamp *
+ * *
+ **********************************************************************/
+
+#ifndef _SYS_TIMEPPS_H_
+#define _SYS_TIMEPPS_H_
+
+/* Implementation note: the logical states ``assert'' and ``clear''
+ * are implemented in terms of the UART register, i.e. ``assert''
+ * means the bit is set.
+ */
+
+/*
+ * The following definitions are architecture independent
+ */
+
+#define PPS_API_VERS_1 1 /* API version number */
+#define PPS_JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
+#define PPS_NANOSECOND 1000000000L /* one nanosecond in decimal */
+#define PPS_FRAC 4294967296. /* 2^32 as a double */
+#define PPS_HECTONANOSECONDS 10000000 /* 100ns units in a second */
+#define PPS_FILETIME_1970 0x019db1ded53e8000 /* unix epoch to Windows */
+
+#define PPS_NORMALIZE(x) /* normalize timespec */ \
+ do { \
+ if ((x).tv_nsec >= PPS_NANOSECOND) { \
+ (x).tv_nsec -= PPS_NANOSECOND; \
+ (x).tv_sec++; \
+ } else if ((x).tv_nsec < 0) { \
+ (x).tv_nsec += PPS_NANOSECOND; \
+ (x).tv_sec--; \
+ } \
+ } while (0)
+
+#define PPS_TSPECTONTP(x) /* convert timespec to ntp_fp */ \
+ do { \
+ double d_temp; \
+ \
+ (x).integral += (unsigned int)PPS_JAN_1970; \
+ d_temp = (x).fractional * PPS_FRAC / PPS_NANOSECOND; \
+ if (d_temp >= PPS_FRAC) \
+ (x).integral++; \
+ (x).fractional = (unsigned int)d_temp; \
+ } while (0)
+
+#define PPS_NTPTOTSPEC(x) /* convert ntp_fp to timespec */ \
+ do { \
+ double d_temp; \
+ \
+ (x).tv_sec -= (time_t)PPS_JAN_1970; \
+ d_temp = (double)((x).tv_nsec); \
+ d_temp *= PPS_NANOSECOND; \
+ d_temp /= PPS_FRAC; \
+ (x).tv_nsec = (long)d_temp; \
+ } while (0)
+
+
+/*
+ * Device/implementation parameters (mode)
+ */
+
+#define PPS_CAPTUREASSERT 0x01 /* capture assert events */
+#define PPS_CAPTURECLEAR 0x02 /* capture clear events */
+#define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */
+
+#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert ev. */
+#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear ev. */
+#define PPS_OFFSETBOTH 0x30 /* apply compensation for both */
+
+#define PPS_CANWAIT 0x100 /* Can we wait for an event? */
+#define PPS_CANPOLL 0x200 /* "This bit is reserved for */
+
+/*
+ * Kernel actions (mode)
+ */
+
+#define PPS_ECHOASSERT 0x40 /* feed back assert event to output */
+#define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */
+
+/*
+ * Timestamp formats (tsformat)
+ */
+
+#define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */
+#define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */
+
+/*
+ * Kernel discipline actions (not used in Windows yet)
+ */
+
+#define PPS_KC_HARDPPS 0 /* enable kernel consumer */
+#define PPS_KC_HARDPPS_PLL 1 /* phase-lock mode */
+#define PPS_KC_HARDPPS_FLL 2 /* frequency-lock mode */
+
+/*
+ * Type definitions
+ */
+
+typedef unsigned long pps_seq_t; /* sequence number */
+
+#pragma warning(push)
+#pragma warning(disable: 201) /* nonstd extension nameless union */
+
+typedef struct ntp_fp {
+ union ntp_fp_sec {
+ unsigned int integral;
+ int s_integral;
+ };
+ unsigned int fractional;
+} ntp_fp_t; /* NTP-compatible time stamp */
+
+#pragma warning(pop)
+
+typedef union pps_timeu { /* timestamp format */
+ struct timespec tspec;
+ ntp_fp_t ntpfp;
+ unsigned long longpad[3];
+} pps_timeu_t; /* generic data type to represent time stamps */
+
+/* addition of NTP fixed-point format */
+
+#define NTPFP_M_ADD(r_i, r_f, a_i, a_f) /* r += a */ \
+ do { \
+ register u_int32 lo_tmp; \
+ register u_int32 hi_tmp; \
+ \
+ lo_tmp = ((r_f) & 0xffff) + ((a_f) & 0xffff); \
+ hi_tmp = (((r_f) >> 16) & 0xffff) + (((a_f) >> 16) & 0xffff); \
+ if (lo_tmp & 0x10000) \
+ hi_tmp++; \
+ (r_f) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); \
+ \
+ (r_i) += (a_i); \
+ if (hi_tmp & 0x10000) \
+ (r_i)++; \
+ } while (0)
+
+#define NTPFP_L_ADDS(r, a) NTPFP_M_ADD((r)->integral, (r)->fractional, \
+ (a)->s_integral, (a)->fractional)
+
+
+/*
+ * Timestamp information structure
+ */
+
+typedef struct pps_info {
+ pps_seq_t assert_sequence; /* seq. num. of assert event */
+ pps_seq_t clear_sequence; /* seq. num. of clear event */
+ pps_timeu_t assert_tu; /* time of assert event */
+ pps_timeu_t clear_tu; /* time of clear event */
+ int current_mode; /* current mode bits */
+} pps_info_t;
+
+#define assert_timestamp assert_tu.tspec
+#define clear_timestamp clear_tu.tspec
+
+#define assert_timestamp_ntpfp assert_tu.ntpfp
+#define clear_timestamp_ntpfp clear_tu.ntpfp
+
+/*
+ * Parameter structure
+ */
+
+typedef struct pps_params {
+ int api_version; /* API version # */
+ int mode; /* mode bits */
+ pps_timeu_t assert_off_tu; /* offset compensation for assert */
+ pps_timeu_t clear_off_tu; /* offset compensation for clear */
+} pps_params_t;
+
+#define assert_offset assert_off_tu.tspec
+#define clear_offset clear_off_tu.tspec
+
+#define assert_offset_ntpfp assert_off_tu.ntpfp
+#define clear_offset_ntpfp clear_off_tu.ntpfp
+
+/*
+ * The following definitions are architecture-dependent
+ */
+
+#define PPS_CAP (PPS_CAPTUREASSERT | PPS_OFFSETASSERT | PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)
+#define PPS_RO (PPS_CANWAIT | PPS_CANPOLL)
+
+typedef struct {
+ int filedes; /* file descriptor */
+ OVERLAPPED ol; /* caches ol.hEvent for DeviceIoControl */
+ pps_params_t params; /* PPS parameters set by user */
+} pps_unit_t;
+
+typedef pps_unit_t* pps_handle_t; /* pps handlebars */
+
+/*
+ *------ Here begins the implementation-specific part! ------
+ */
+
+#include