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.
+