summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpd
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/ntpd')
-rw-r--r--contrib/ntp/ntpd/invoke-ntp.conf.texi103
-rw-r--r--contrib/ntp/ntpd/invoke-ntp.keys.texi2
-rw-r--r--contrib/ntp/ntpd/invoke-ntpd.texi4
-rw-r--r--contrib/ntp/ntpd/ntp.conf.5man111
-rw-r--r--contrib/ntp/ntpd/ntp.conf.5mdoc103
-rw-r--r--contrib/ntp/ntpd/ntp.conf.def99
-rw-r--r--contrib/ntp/ntpd/ntp.conf.html44
-rw-r--r--contrib/ntp/ntpd/ntp.conf.man.in111
-rw-r--r--contrib/ntp/ntpd/ntp.conf.mdoc.in103
-rw-r--r--contrib/ntp/ntpd/ntp.keys.5man4
-rw-r--r--contrib/ntp/ntpd/ntp.keys.5mdoc4
-rw-r--r--contrib/ntp/ntpd/ntp.keys.html2
-rw-r--r--contrib/ntp/ntpd/ntp.keys.man.in4
-rw-r--r--contrib/ntp/ntpd/ntp.keys.mdoc.in4
-rw-r--r--contrib/ntp/ntpd/ntp_control.c165
-rw-r--r--contrib/ntp/ntpd/ntp_io.c112
-rw-r--r--contrib/ntp/ntpd/ntp_proto.c259
-rw-r--r--contrib/ntp/ntpd/ntp_request.c225
-rw-r--r--contrib/ntp/ntpd/ntp_timer.c6
-rw-r--r--contrib/ntp/ntpd/ntpd-opts.c14
-rw-r--r--contrib/ntp/ntpd/ntpd-opts.h6
-rw-r--r--contrib/ntp/ntpd/ntpd.1ntpdman6
-rw-r--r--contrib/ntp/ntpd/ntpd.1ntpdmdoc4
-rw-r--r--contrib/ntp/ntpd/ntpd.c15
-rw-r--r--contrib/ntp/ntpd/ntpd.html4
-rw-r--r--contrib/ntp/ntpd/ntpd.man.in6
-rw-r--r--contrib/ntp/ntpd/ntpd.mdoc.in4
27 files changed, 1082 insertions, 442 deletions
diff --git a/contrib/ntp/ntpd/invoke-ntp.conf.texi b/contrib/ntp/ntpd/invoke-ntp.conf.texi
index 1d8a621..fa8e87a 100644
--- a/contrib/ntp/ntpd/invoke-ntp.conf.texi
+++ b/contrib/ntp/ntpd/invoke-ntp.conf.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp.conf.texi)
#
-# It has been AutoGen-ed January 20, 2016 at 04:17:59 AM by AutoGen 5.18.5
+# It has been AutoGen-ed April 26, 2016 at 08:28:27 PM by AutoGen 5.18.5
# From the definitions ntp.conf.def
# and the template file agtexi-file.tpl
@end ignore
@@ -108,8 +108,14 @@ in some weird and even destructive behavior.
If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
is detected, support for the IPv6 address family is generated
in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+@code{reslist}
+billboard generated
+by
+@code{ntpq(1ntpqmdoc)}
+or
+@code{ntpdc(1ntpdcmdoc)},
+IPv6 addresses are automatically generated.
IPv6 addresses can be identified by the presence of colons
@quotedblleft{}:@quotedblright{}
in the address field.
@@ -129,9 +135,9 @@ See IPv6 references for the
equivalent classes for that address family.
@table @asis
@item @code{pool} @kbd{address} @code{[@code{burst}]} @code{[@code{iburst}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]}
-@item @code{server} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{burst}]} @code{[@code{iburst}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]}
-@item @code{peer} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]}
-@item @code{broadcast} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{ttl} @kbd{ttl}]}
+@item @code{server} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{burst}]} @code{[@code{iburst}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]} @code{[@code{true}]}
+@item @code{peer} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]} @code{[@code{true}]} @code{[@code{xleave}]}
+@item @code{broadcast} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{ttl} @kbd{ttl}]} @code{[@code{xleave}]}
@item @code{manycastclient} @kbd{address} @code{[@code{key} @kbd{key} @kbd{|} @code{autokey}]} @code{[@code{version} @kbd{version}]} @code{[@code{prefer}]} @code{[@code{minpoll} @kbd{minpoll}]} @code{[@code{maxpoll} @kbd{maxpoll}]} @code{[@code{ttl} @kbd{ttl}]}
@end table
@@ -249,7 +255,9 @@ when the server is reachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+@code{calldelay}
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to improve timekeeping quality
with the
@@ -260,7 +268,9 @@ When the server is unreachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+@code{calldelay}
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to speed the initial synchronization
acquisition with the
@@ -293,6 +303,11 @@ option to a lower limit of 4 (16 s).
@item @code{noselect}
Marks the server as unused, except for display purposes.
The server is discarded by the selection algroithm.
+@item @code{preempt}
+Says the association can be preempted.
+@item @code{true}
+Marks the server as a truechimer.
+Use this option only for testing.
@item @code{prefer}
Marks the server as preferred.
All other things being equal,
@@ -305,6 +320,11 @@ page
provided in
@file{/usr/share/doc/ntp})
for further information.
+@item @code{true}
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+@emph{only}
+be used while testing an association.
@item @code{ttl} @kbd{ttl}
This option is used only with broadcast server and manycast
client modes.
@@ -323,6 +343,12 @@ Specifies the version number to be used for outgoing NTP
packets.
Versions 1-4 are the choices, with version 4 the
default.
+@item @code{xleave}
+Valid in
+@code{peer}
+and
+@code{broadcast}
+modes only, this flag enables interleave mode.
@end table
@subsubsection Auxiliary Commands
@table @asis
@@ -469,7 +495,7 @@ and
commands and also by remote
configuration commands sent by a
@code{ntpdc(1ntpdcmdoc)}
-program running in
+program running on
another machine.
If this flag is enabled, which is the default
case, new broadcast client and symmetric passive associations and
@@ -649,7 +675,7 @@ using the host name, network address and public keys,
all of which are bound together by the protocol specifically
to deflect masquerade attacks.
For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
computations and so the same addresses must be available
at both the server and client.
For this reason operation
@@ -836,8 +862,8 @@ the link
@file{ntpkey_key_}@kbd{hostname}
in the keys directory.
@item @code{iffpar} @kbd{file}
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
@file{ntpkey_iff_}@kbd{hostname}
in the keys directory.
@item @code{leap} @kbd{file}
@@ -847,8 +873,7 @@ This overrides the link
in the keys directory.
@item @code{mvpar} @kbd{file}
Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
@file{ntpkey_mv_}@kbd{hostname}
in the keys directory.
@item @code{pw} @kbd{password}
@@ -990,7 +1015,7 @@ supported.
Statistic files are managed using file generation sets
and scripts in the
@file{./scripts}
-directory of this distribution.
+directory of the source code distribution.
Using
these facilities and
@sc{unix}
@@ -1319,7 +1344,9 @@ When there is already a file with this name and
the number of links of this file is one, it is renamed appending a
dot, the letter
@code{C},
-and the pid of the ntpd server process.
+and the pid of the
+@code{ntpd(1ntpdmdoc)}
+server process.
When the
number of links is greater than one, the file is unlinked.
This
@@ -1363,7 +1390,9 @@ Source address based restrictions are easily circumvented
by a determined cracker.
Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+@code{restrict}
+command
or implicitly as the result of cryptographic or rate limit
violations.
Cryptographic violations include certificate
@@ -1373,9 +1402,9 @@ at abusive rates.
Some violations cause denied service
only for the offending packet, others cause denied service
for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
the restrictions is by restarting the server.
@subsubsection The Kiss-of-Death Packet
Ordinarily, packets denied service are simply dropped with no
@@ -1429,7 +1458,9 @@ Packets that violate these minima are discarded
and a kiss-o'-death packet returned if enabled.
The default
minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+@code{monitor}
+subcommand specifies the probability of discard
for packets that overflow the rate-control window.
@item @code{restrict} @code{address} @code{[@code{mask} @kbd{mask}]} @code{[@kbd{flag} @kbd{...}]}
The
@@ -1485,7 +1516,9 @@ If another KoD packet occurs within one second after the
last one, the packet is dropped.
@item @code{limited}
Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+@code{discard}
+command.
A history of clients is kept using the
monitoring capability of
@code{ntpd(1ntpdmdoc)}.
@@ -1545,7 +1578,9 @@ queries.
@item @code{notrap}
Decline to provide mode 6 control message trap service to matching
hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+@code{ntpq(1ntpqmdoc)}
+control message
protocol which is intended for use by remote event logging programs.
@item @code{notrust}
Deny service unless the packet is cryptographically authenticated.
@@ -1613,8 +1648,11 @@ The library can also be used with other NTPv4 modes
as well and is highly recommended, especially for broadcast modes.
A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+@code{manycastclient}
+command, which is similar to the
+@code{server}
+command but with a multicast (IPv4 class
@code{D}
or IPv6 prefix
@code{FF})
@@ -1684,7 +1722,9 @@ command and, under normal circumstances, increments to the
@code{maxpolll}
value specified in this command.
Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+@code{ttl}
+command.
At each retransmission the TTL is increased until reaching
the maximum hops specified by this command or a sufficient
number client associations have been found.
@@ -2293,7 +2333,8 @@ drift file is located in, and that file system links, symbolic or
otherwise, should be avoided.
@item @code{dscp} @kbd{value}
This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6-bit code. The default value is 46, signifying Expedited Forwarding.
+a 6-bit code.
+The default value is 46, signifying Expedited Forwarding.
@item @code{enable} @code{[@code{auth} | @code{bclient} | @code{calibrate} | @code{kernel} | @code{mode7} | @code{monitor} | @code{ntp} | @code{stats} | @code{unpeer_crypto_early} | @code{unpeer_crypto_nak_early} | @code{unpeer_digest_early}]}
@item @code{disable} @code{[@code{auth} | @code{bclient} | @code{calibrate} | @code{kernel} | @code{mode7} | @code{monitor} | @code{ntp} | @code{stats} | @code{unpeer_crypto_early} | @code{unpeer_crypto_nak_early} | @code{unpeer_digest_early}]}
Provides a way to enable or disable various server options.
@@ -2502,7 +2543,8 @@ A
message class may also be followed by the
@code{all}
keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
could look like this:
@verbatim
logconfig =syncstatus +sysevents
@@ -2526,7 +2568,9 @@ This command specifies the location of an alternate log file to
be used instead of the default system
@code{syslog(3)}
facility.
-This is the same operation as the -l command line option.
+This is the same operation as the
+@code{-l}
+command line option.
@item @code{setvar} @kbd{variable} @code{[@code{default}]}
This command adds an additional system variable.
These
@@ -2654,7 +2698,8 @@ Specifies the maximum size of the process stack on systems with the
function.
Defaults to 50 4k pages (200 4k pages in OpenBSD).
@item @code{filenum} @kbd{Nfiledescriptors}
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
@end table
@item @code{trap} @kbd{host_address} @code{[@code{port} @kbd{port_number}]} @code{[@code{interface} @kbd{interface_address}]}
This command configures a trap receiver at the given host
diff --git a/contrib/ntp/ntpd/invoke-ntp.keys.texi b/contrib/ntp/ntpd/invoke-ntp.keys.texi
index 915044e..c3b8355 100644
--- a/contrib/ntp/ntpd/invoke-ntp.keys.texi
+++ b/contrib/ntp/ntpd/invoke-ntp.keys.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp.keys.texi)
#
-# It has been AutoGen-ed January 20, 2016 at 04:18:02 AM by AutoGen 5.18.5
+# It has been AutoGen-ed April 26, 2016 at 08:28:30 PM by AutoGen 5.18.5
# From the definitions ntp.keys.def
# and the template file agtexi-file.tpl
@end ignore
diff --git a/contrib/ntp/ntpd/invoke-ntpd.texi b/contrib/ntp/ntpd/invoke-ntpd.texi
index 50e8f65..8856d36 100644
--- a/contrib/ntp/ntpd/invoke-ntpd.texi
+++ b/contrib/ntp/ntpd/invoke-ntpd.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpd.texi)
#
-# It has been AutoGen-ed January 20, 2016 at 04:18:04 AM by AutoGen 5.18.5
+# It has been AutoGen-ed April 26, 2016 at 08:28:32 PM by AutoGen 5.18.5
# From the definitions ntpd-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -142,7 +142,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpd - NTP daemon program - Ver. 4.2.8p6
+ntpd - NTP daemon program - Ver. 4.2.8p7
Usage: ntpd [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \
[ <server1> ... <serverN> ]
Flg Arg Option-Name Description
diff --git a/contrib/ntp/ntpd/ntp.conf.5man b/contrib/ntp/ntpd/ntp.conf.5man
index 1e5e464..7804902 100644
--- a/contrib/ntp/ntpd/ntp.conf.5man
+++ b/contrib/ntp/ntpd/ntp.conf.5man
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp.conf 5man "20 Jan 2016" "4.2.8p6" "File Formats"
+.TH ntp.conf 5man "26 Apr 2016" "4.2.8p7" "File Formats"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gsaOxR/ag-XsaGwR)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-ana4jE/ag-QnaWiE)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:17:45 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:14 PM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -133,8 +133,14 @@ in some weird and even destructive behavior.
If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
is detected, support for the IPv6 address family is generated
in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+\f\*[B-Font]reslist\f[]
+billboard generated
+by
+\fCntpq\f[]\fR(1ntpqmdoc)\f[]
+or
+\fCntpdc\f[]\fR(1ntpdcmdoc)\f[],
+IPv6 addresses are automatically generated.
IPv6 addresses can be identified by the presence of colons
\*[Lq]\&:\*[Rq]
in the address field.
@@ -157,11 +163,11 @@ equivalent classes for that address family.
.TP 7
.NOP \f\*[B-Font]pool\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
.TP 7
-.NOP \f\*[B-Font]server\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
+.NOP \f\*[B-Font]server\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]true\f[]]
.TP 7
-.NOP \f\*[B-Font]peer\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
+.NOP \f\*[B-Font]peer\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]true\f[]] [\f\*[B-Font]xleave\f[]]
.TP 7
-.NOP \f\*[B-Font]broadcast\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]]
+.NOP \f\*[B-Font]broadcast\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]] [\f\*[B-Font]xleave\f[]]
.TP 7
.NOP \f\*[B-Font]manycastclient\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]]
.PP
@@ -289,7 +295,9 @@ when the server is reachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+\f\*[B-Font]calldelay\f[]
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to improve timekeeping quality
with the
@@ -301,7 +309,9 @@ When the server is unreachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+\f\*[B-Font]calldelay\f[]
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to speed the initial synchronization
acquisition with the
@@ -339,6 +349,13 @@ option to a lower limit of 4 (16 s).
Marks the server as unused, except for display purposes.
The server is discarded by the selection algroithm.
.TP 7
+.NOP \f\*[B-Font]preempt\f[]
+Says the association can be preempted.
+.TP 7
+.NOP \f\*[B-Font]true\f[]
+Marks the server as a truechimer.
+Use this option only for testing.
+.TP 7
.NOP \f\*[B-Font]prefer\f[]
Marks the server as preferred.
All other things being equal,
@@ -352,6 +369,12 @@ provided in
\fI/usr/share/doc/ntp\f[])
for further information.
.TP 7
+.NOP \f\*[B-Font]true\f[]
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+\fIonly\f[]
+be used while testing an association.
+.TP 7
.NOP \f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]
This option is used only with broadcast server and manycast
client modes.
@@ -371,6 +394,13 @@ Specifies the version number to be used for outgoing NTP
packets.
Versions 1-4 are the choices, with version 4 the
default.
+.TP 7
+.NOP \f\*[B-Font]xleave\f[]
+Valid in
+\f\*[B-Font]peer\f[]
+and
+\f\*[B-Font]broadcast\f[]
+modes only, this flag enables interleave mode.
.PP
.SS Auxiliary Commands
.TP 7
@@ -529,7 +559,7 @@ and
commands and also by remote
configuration commands sent by a
\fCntpdc\f[]\fR(1ntpdcmdoc)\f[]
-program running in
+program running on
another machine.
If this flag is enabled, which is the default
case, new broadcast client and symmetric passive associations and
@@ -735,7 +765,7 @@ using the host name, network address and public keys,
all of which are bound together by the protocol specifically
to deflect masquerade attacks.
For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
computations and so the same addresses must be available
at both the server and client.
For this reason operation
@@ -942,8 +972,8 @@ the link
in the keys directory.
.TP 7
.NOP \f\*[B-Font]iffpar\f[] \f\*[I-Font]file\f[]
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
\fIntpkey_iff_\f[]\f\*[I-Font]hostname\f[]
in the keys directory.
.TP 7
@@ -955,8 +985,7 @@ in the keys directory.
.TP 7
.NOP \f\*[B-Font]mvpar\f[] \f\*[I-Font]file\f[]
Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
\fIntpkey_mv_\f[]\f\*[I-Font]hostname\f[]
in the keys directory.
.TP 7
@@ -1118,7 +1147,7 @@ supported.
Statistic files are managed using file generation sets
and scripts in the
\fI./scripts\f[]
-directory of this distribution.
+directory of the source code distribution.
Using
these facilities and
UNIX
@@ -1511,7 +1540,9 @@ When there is already a file with this name and
the number of links of this file is one, it is renamed appending a
dot, the letter
\f\*[B-Font]C\f[],
-and the pid of the ntpd server process.
+and the pid of the
+\fCntpd\f[]\fR(1ntpdmdoc)\f[]
+server process.
When the
number of links is greater than one, the file is unlinked.
This
@@ -1559,7 +1590,9 @@ by a determined cracker.
.ne 2
Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+\f\*[B-Font]restrict\f[]
+command
or implicitly as the result of cryptographic or rate limit
violations.
Cryptographic violations include certificate
@@ -1569,9 +1602,9 @@ at abusive rates.
Some violations cause denied service
only for the offending packet, others cause denied service
for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
the restrictions is by restarting the server.
.SS The Kiss-of-Death Packet
Ordinarily, packets denied service are simply dropped with no
@@ -1627,7 +1660,9 @@ Packets that violate these minima are discarded
and a kiss-o'-death packet returned if enabled.
The default
minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+\f\*[B-Font]monitor\f[]
+subcommand specifies the probability of discard
for packets that overflow the rate-control window.
.TP 7
.NOP \f\*[B-Font]restrict\f[] \f\*[B-Font]address\f[] [\f\*[B-Font]mask\f[] \f\*[I-Font]mask\f[]] [\f\*[I-Font]flag\f[] \f\*[I-Font]...\f[]]
@@ -1687,7 +1722,9 @@ last one, the packet is dropped.
.TP 7
.NOP \f\*[B-Font]limited\f[]
Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+\f\*[B-Font]discard\f[]
+command.
A history of clients is kept using the
monitoring capability of
\fCntpd\f[]\fR(1ntpdmdoc)\f[].
@@ -1754,7 +1791,9 @@ queries.
.NOP \f\*[B-Font]notrap\f[]
Decline to provide mode 6 control message trap service to matching
hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+\fCntpq\f[]\fR(1ntpqmdoc)\f[]
+control message
protocol which is intended for use by remote event logging programs.
.TP 7
.NOP \f\*[B-Font]notrust\f[]
@@ -1832,8 +1871,11 @@ as well and is highly recommended, especially for broadcast modes.
.ne 2
A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+\f\*[B-Font]manycastclient\f[]
+command, which is similar to the
+\f\*[B-Font]server\f[]
+command but with a multicast (IPv4 class
\f\*[B-Font]D\f[]
or IPv6 prefix
\f\*[B-Font]FF\f[])
@@ -1909,7 +1951,9 @@ command and, under normal circumstances, increments to the
\f\*[B-Font]maxpolll\f[]
value specified in this command.
Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+\f\*[B-Font]ttl\f[]
+command.
At each retransmission the TTL is increased until reaching
the maximum hops specified by this command or a sufficient
number client associations have been found.
@@ -2571,7 +2615,8 @@ otherwise, should be avoided.
.TP 7
.NOP \f\*[B-Font]dscp\f[] \f\*[I-Font]value\f[]
This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6-bit code. The default value is 46, signifying Expedited Forwarding.
+a 6-bit code.
+The default value is 46, signifying Expedited Forwarding.
.TP 7
.NOP \f\*[B-Font]enable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
.TP 7
@@ -2798,7 +2843,8 @@ A
message class may also be followed by the
\f\*[B-Font]all\f[]
keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
could look like this:
.br
.in +4
@@ -2833,7 +2879,9 @@ This command specifies the location of an alternate log file to
be used instead of the default system
\fCsyslog\f[]\fR(3)\f[]
facility.
-This is the same operation as the \-l command line option.
+This is the same operation as the
+\f\*[B-Font]\-l\f[]
+command line option.
.TP 7
.NOP \f\*[B-Font]setvar\f[] \f\*[I-Font]variable\f[] [\f\*[B-Font]default\f[]]
This command adds an additional system variable.
@@ -2978,7 +3026,8 @@ function.
Defaults to 50 4k pages (200 4k pages in OpenBSD).
.TP 7
.NOP \f\*[B-Font]filenum\f[] \f\*[I-Font]Nfiledescriptors\f[]
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
.RE
.TP 7
.NOP \f\*[B-Font]trap\f[] \f\*[I-Font]host_address\f[] [\f\*[B-Font]port\f[] \f\*[I-Font]port_number\f[]] [\f\*[B-Font]interface\f[] \f\*[I-Font]interface_address\f[]]
diff --git a/contrib/ntp/ntpd/ntp.conf.5mdoc b/contrib/ntp/ntpd/ntp.conf.5mdoc
index f2b418b..c6c7e6c 100644
--- a/contrib/ntp/ntpd/ntp.conf.5mdoc
+++ b/contrib/ntp/ntpd/ntp.conf.5mdoc
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
.Dt NTP_CONF 5mdoc File Formats
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:18:07 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:36 PM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -111,8 +111,14 @@ in some weird and even destructive behavior.
If the Basic Socket Interface Extensions for IPv6 (RFC\-2553)
is detected, support for the IPv6 address family is generated
in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+.Cm reslist
+billboard generated
+by
+.Xr ntpq 1ntpqmdoc
+or
+.Xr ntpdc 1ntpdcmdoc ,
+IPv6 addresses are automatically generated.
IPv6 addresses can be identified by the presence of colons
.Dq \&:
in the address field.
@@ -147,6 +153,7 @@ equivalent classes for that address family.
.Op Cm prefer
.Op Cm minpoll Ar minpoll
.Op Cm maxpoll Ar maxpoll
+.Op Cm true
.Xc
.It Xo Ic peer Ar address
.Op Cm key Ar key \&| Cm autokey
@@ -154,6 +161,8 @@ equivalent classes for that address family.
.Op Cm prefer
.Op Cm minpoll Ar minpoll
.Op Cm maxpoll Ar maxpoll
+.Op Cm true
+.Op Cm xleave
.Xc
.It Xo Ic broadcast Ar address
.Op Cm key Ar key \&| Cm autokey
@@ -161,6 +170,7 @@ equivalent classes for that address family.
.Op Cm prefer
.Op Cm minpoll Ar minpoll
.Op Cm ttl Ar ttl
+.Op Cm xleave
.Xc
.It Xo Ic manycastclient Ar address
.Op Cm key Ar key \&| Cm autokey
@@ -286,7 +296,9 @@ when the server is reachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+.Ic calldelay
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to improve timekeeping quality
with the
@@ -297,7 +309,9 @@ When the server is unreachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+.Ic calldelay
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to speed the initial synchronization
acquisition with the
@@ -330,6 +344,11 @@ option to a lower limit of 4 (16 s).
.It Cm noselect
Marks the server as unused, except for display purposes.
The server is discarded by the selection algroithm.
+.It Cm preempt
+Says the association can be preempted.
+.It Cm true
+Marks the server as a truechimer.
+Use this option only for testing.
.It Cm prefer
Marks the server as preferred.
All other things being equal,
@@ -342,6 +361,11 @@ page
provided in
.Pa /usr/share/doc/ntp )
for further information.
+.It Cm true
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+.Em only
+be used while testing an association.
.It Cm ttl Ar ttl
This option is used only with broadcast server and manycast
client modes.
@@ -360,6 +384,12 @@ Specifies the version number to be used for outgoing NTP
packets.
Versions 1\-4 are the choices, with version 4 the
default.
+.It Cm xleave
+Valid in
+.Cm peer
+and
+.Cm broadcast
+modes only, this flag enables interleave mode.
.El
.Ss Auxiliary Commands
.Bl -tag -width indent
@@ -505,7 +535,7 @@ and
commands and also by remote
configuration commands sent by a
.Xr ntpdc 1ntpdcmdoc
-program running in
+program running on
another machine.
If this flag is enabled, which is the default
case, new broadcast client and symmetric passive associations and
@@ -695,7 +725,7 @@ using the host name, network address and public keys,
all of which are bound together by the protocol specifically
to deflect masquerade attacks.
For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
computations and so the same addresses must be available
at both the server and client.
For this reason operation
@@ -893,8 +923,8 @@ the link
.Pa ntpkey_key_ Ns Ar hostname
in the keys directory.
.It Cm iffpar Ar file
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
.Pa ntpkey_iff_ Ns Ar hostname
in the keys directory.
.It Cm leap Ar file
@@ -904,8 +934,7 @@ This overrides the link
in the keys directory.
.It Cm mvpar Ar file
Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
.Pa ntpkey_mv_ Ns Ar hostname
in the keys directory.
.It Cm pw Ar password
@@ -1046,7 +1075,7 @@ supported.
Statistic files are managed using file generation sets
and scripts in the
.Pa ./scripts
-directory of this distribution.
+directory of the source code distribution.
Using
these facilities and
.Ux
@@ -1380,7 +1409,9 @@ When there is already a file with this name and
the number of links of this file is one, it is renamed appending a
dot, the letter
.Cm C ,
-and the pid of the ntpd server process.
+and the pid of the
+.Xr ntpd 1ntpdmdoc
+server process.
When the
number of links is greater than one, the file is unlinked.
This
@@ -1423,7 +1454,9 @@ Source address based restrictions are easily circumvented
by a determined cracker.
.Pp
Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+.Ic restrict
+command
or implicitly as the result of cryptographic or rate limit
violations.
Cryptographic violations include certificate
@@ -1433,9 +1466,9 @@ at abusive rates.
Some violations cause denied service
only for the offending packet, others cause denied service
for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
the restrictions is by restarting the server.
.Ss The Kiss\-of\-Death Packet
Ordinarily, packets denied service are simply dropped with no
@@ -1493,7 +1526,9 @@ Packets that violate these minima are discarded
and a kiss\-o'\-death packet returned if enabled.
The default
minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+.Ic monitor
+subcommand specifies the probability of discard
for packets that overflow the rate\-control window.
.It Xo Ic restrict address
.Op Cm mask Ar mask
@@ -1552,7 +1587,9 @@ If another KoD packet occurs within one second after the
last one, the packet is dropped.
.It Cm limited
Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+.Ic discard
+command.
A history of clients is kept using the
monitoring capability of
.Xr ntpd 1ntpdmdoc .
@@ -1612,7 +1649,9 @@ queries.
.It Cm notrap
Decline to provide mode 6 control message trap service to matching
hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+.Xr ntpq 1ntpqmdoc
+control message
protocol which is intended for use by remote event logging programs.
.It Cm notrust
Deny service unless the packet is cryptographically authenticated.
@@ -1679,8 +1718,11 @@ The library can also be used with other NTPv4 modes
as well and is highly recommended, especially for broadcast modes.
.Pp
A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+.Ic manycastclient
+command, which is similar to the
+.Ic server
+command but with a multicast (IPv4 class
.Cm D
or IPv6 prefix
.Cm FF )
@@ -1750,7 +1792,9 @@ command and, under normal circumstances, increments to the
.Cm maxpolll
value specified in this command.
Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+.Ic ttl
+command.
At each retransmission the TTL is increased until reaching
the maximum hops specified by this command or a sufficient
number client associations have been found.
@@ -2388,7 +2432,8 @@ drift file is located in, and that file system links, symbolic or
otherwise, should be avoided.
.It Ic dscp Ar value
This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6\-bit code. The default value is 46, signifying Expedited Forwarding.
+a 6\-bit code.
+The default value is 46, signifying Expedited Forwarding.
.It Xo Ic enable
.Oo
.Cm auth | Cm bclient |
@@ -2627,7 +2672,8 @@ A
message class may also be followed by the
.Cm all
keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
could look like this:
.Bd -literal
logconfig =syncstatus +sysevents
@@ -2651,7 +2697,9 @@ This command specifies the location of an alternate log file to
be used instead of the default system
.Xr syslog 3
facility.
-This is the same operation as the \-l command line option.
+This is the same operation as the
+.Fl l
+command line option.
.It Ic setvar Ar variable Op Cm default
This command adds an additional system variable.
These
@@ -2803,7 +2851,8 @@ Specifies the maximum size of the process stack on systems with the
function.
Defaults to 50 4k pages (200 4k pages in OpenBSD).
.It Cm filenum Ar Nfiledescriptors
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
.El
.It Xo Ic trap Ar host_address
.Op Cm port Ar port_number
diff --git a/contrib/ntp/ntpd/ntp.conf.def b/contrib/ntp/ntpd/ntp.conf.def
index 25d9fd0..4993e02 100644
--- a/contrib/ntp/ntpd/ntp.conf.def
+++ b/contrib/ntp/ntpd/ntp.conf.def
@@ -113,8 +113,14 @@ in some weird and even destructive behavior.
If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
is detected, support for the IPv6 address family is generated
in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+.Cm reslist
+billboard generated
+by
+.Xr ntpq 1ntpqmdoc
+or
+.Xr ntpdc 1ntpdcmdoc ,
+IPv6 addresses are automatically generated.
IPv6 addresses can be identified by the presence of colons
.Dq \&:
in the address field.
@@ -149,6 +155,7 @@ equivalent classes for that address family.
.Op Cm prefer
.Op Cm minpoll Ar minpoll
.Op Cm maxpoll Ar maxpoll
+.Op Cm true
.Xc
.It Xo Ic peer Ar address
.Op Cm key Ar key \&| Cm autokey
@@ -156,6 +163,8 @@ equivalent classes for that address family.
.Op Cm prefer
.Op Cm minpoll Ar minpoll
.Op Cm maxpoll Ar maxpoll
+.Op Cm true
+.Op Cm xleave
.Xc
.It Xo Ic broadcast Ar address
.Op Cm key Ar key \&| Cm autokey
@@ -163,6 +172,7 @@ equivalent classes for that address family.
.Op Cm prefer
.Op Cm minpoll Ar minpoll
.Op Cm ttl Ar ttl
+.Op Cm xleave
.Xc
.It Xo Ic manycastclient Ar address
.Op Cm key Ar key \&| Cm autokey
@@ -288,7 +298,9 @@ when the server is reachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+.Ic calldelay
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to improve timekeeping quality
with the
@@ -299,7 +311,9 @@ When the server is unreachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+.Ic calldelay
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to speed the initial synchronization
acquisition with the
@@ -332,6 +346,11 @@ option to a lower limit of 4 (16 s).
.It Cm noselect
Marks the server as unused, except for display purposes.
The server is discarded by the selection algroithm.
+.It Cm preempt
+Says the association can be preempted.
+.It Cm true
+Marks the server as a truechimer.
+Use this option only for testing.
.It Cm prefer
Marks the server as preferred.
All other things being equal,
@@ -344,6 +363,11 @@ page
provided in
.Pa /usr/share/doc/ntp )
for further information.
+.It Cm true
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+.Em only
+be used while testing an association.
.It Cm ttl Ar ttl
This option is used only with broadcast server and manycast
client modes.
@@ -362,6 +386,12 @@ Specifies the version number to be used for outgoing NTP
packets.
Versions 1-4 are the choices, with version 4 the
default.
+.It Cm xleave
+Valid in
+.Cm peer
+and
+.Cm broadcast
+modes only, this flag enables interleave mode.
.El
.Ss Auxiliary Commands
.Bl -tag -width indent
@@ -507,7 +537,7 @@ and
commands and also by remote
configuration commands sent by a
.Xr ntpdc 1ntpdcmdoc
-program running in
+program running on
another machine.
If this flag is enabled, which is the default
case, new broadcast client and symmetric passive associations and
@@ -697,7 +727,7 @@ using the host name, network address and public keys,
all of which are bound together by the protocol specifically
to deflect masquerade attacks.
For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
computations and so the same addresses must be available
at both the server and client.
For this reason operation
@@ -895,8 +925,8 @@ the link
.Pa ntpkey_key_ Ns Ar hostname
in the keys directory.
.It Cm iffpar Ar file
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
.Pa ntpkey_iff_ Ns Ar hostname
in the keys directory.
.It Cm leap Ar file
@@ -906,8 +936,7 @@ This overrides the link
in the keys directory.
.It Cm mvpar Ar file
Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
.Pa ntpkey_mv_ Ns Ar hostname
in the keys directory.
.It Cm pw Ar password
@@ -1048,7 +1077,7 @@ supported.
Statistic files are managed using file generation sets
and scripts in the
.Pa ./scripts
-directory of this distribution.
+directory of the source code distribution.
Using
these facilities and
.Ux
@@ -1382,7 +1411,9 @@ When there is already a file with this name and
the number of links of this file is one, it is renamed appending a
dot, the letter
.Cm C ,
-and the pid of the ntpd server process.
+and the pid of the
+.Xr ntpd 1ntpdmdoc
+server process.
When the
number of links is greater than one, the file is unlinked.
This
@@ -1425,7 +1456,9 @@ Source address based restrictions are easily circumvented
by a determined cracker.
.Pp
Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+.Ic restrict
+command
or implicitly as the result of cryptographic or rate limit
violations.
Cryptographic violations include certificate
@@ -1435,9 +1468,9 @@ at abusive rates.
Some violations cause denied service
only for the offending packet, others cause denied service
for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
the restrictions is by restarting the server.
.Ss The Kiss-of-Death Packet
Ordinarily, packets denied service are simply dropped with no
@@ -1495,7 +1528,9 @@ Packets that violate these minima are discarded
and a kiss-o'-death packet returned if enabled.
The default
minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+.Ic monitor
+subcommand specifies the probability of discard
for packets that overflow the rate-control window.
.It Xo Ic restrict address
.Op Cm mask Ar mask
@@ -1554,7 +1589,9 @@ If another KoD packet occurs within one second after the
last one, the packet is dropped.
.It Cm limited
Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+.Ic discard
+command.
A history of clients is kept using the
monitoring capability of
.Xr ntpd 1ntpdmdoc .
@@ -1614,7 +1651,9 @@ queries.
.It Cm notrap
Decline to provide mode 6 control message trap service to matching
hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+.Xr ntpq 1ntpqmdoc
+control message
protocol which is intended for use by remote event logging programs.
.It Cm notrust
Deny service unless the packet is cryptographically authenticated.
@@ -1681,8 +1720,11 @@ The library can also be used with other NTPv4 modes
as well and is highly recommended, especially for broadcast modes.
.Pp
A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+.Ic manycastclient
+command, which is similar to the
+.Ic server
+command but with a multicast (IPv4 class
.Cm D
or IPv6 prefix
.Cm FF )
@@ -1752,7 +1794,9 @@ command and, under normal circumstances, increments to the
.Cm maxpolll
value specified in this command.
Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+.Ic ttl
+command.
At each retransmission the TTL is increased until reaching
the maximum hops specified by this command or a sufficient
number client associations have been found.
@@ -2390,7 +2434,8 @@ drift file is located in, and that file system links, symbolic or
otherwise, should be avoided.
.It Ic dscp Ar value
This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6-bit code. The default value is 46, signifying Expedited Forwarding.
+a 6-bit code.
+The default value is 46, signifying Expedited Forwarding.
.It Xo Ic enable
.Oo
.Cm auth | Cm bclient |
@@ -2629,7 +2674,8 @@ A
message class may also be followed by the
.Cm all
keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
could look like this:
.Bd -literal
logconfig =syncstatus +sysevents
@@ -2653,7 +2699,9 @@ This command specifies the location of an alternate log file to
be used instead of the default system
.Xr syslog 3
facility.
-This is the same operation as the -l command line option.
+This is the same operation as the
+.Fl l
+command line option.
.It Ic setvar Ar variable Op Cm default
This command adds an additional system variable.
These
@@ -2805,7 +2853,8 @@ Specifies the maximum size of the process stack on systems with the
function.
Defaults to 50 4k pages (200 4k pages in OpenBSD).
.It Cm filenum Ar Nfiledescriptors
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
.El
.It Xo Ic trap Ar host_address
.Op Cm port Ar port_number
diff --git a/contrib/ntp/ntpd/ntp.conf.html b/contrib/ntp/ntpd/ntp.conf.html
index c50f0e1..c7f1b74 100644
--- a/contrib/ntp/ntpd/ntp.conf.html
+++ b/contrib/ntp/ntpd/ntp.conf.html
@@ -33,7 +33,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>This document describes the configuration file for the NTP Project's
<code>ntpd</code> program.
- <p>This document applies to version 4.2.8p6 of <code>ntp.conf</code>.
+ <p>This document applies to version 4.2.8p7 of <code>ntp.conf</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -296,7 +296,9 @@ described in
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+<code>calldelay</code>
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to improve timekeeping quality
with the
@@ -306,7 +308,9 @@ command and s addresses.
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+<code>calldelay</code>
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to speed the initial synchronization
acquisition with the
@@ -335,6 +339,8 @@ the
option to a lower limit of 4 (16 s).
<br><dt><code>noselect</code><dd>Marks the server as unused, except for display purposes.
The server is discarded by the selection algroithm.
+<br><dt><code>preempt</code><dd>Says the association can be preempted.
+<br><dt><code>true</code><dd>Marks the server as a truechimer.
<br><dt><code>prefer</code><dd>Marks the server as preferred.
All other things being equal,
this host will be chosen for synchronization among a set of
@@ -362,6 +368,11 @@ network administrator.
packets.
Versions 1-4 are the choices, with version 4 the
default.
+<br><dt><code>xleave</code><dd>Valid in
+<code>peer</code>
+and
+<code>broadcast</code>
+modes only, this flag enables interleave mode.
</dl>
<h5 class="subsubsection">Auxiliary Commands</h5>
@@ -1369,7 +1380,9 @@ Source address based restrictions are easily circumvented
by a determined cracker.
<p>Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+<code>restrict</code>
+command
or implicitly as the result of cryptographic or rate limit
violations.
Cryptographic violations include certificate
@@ -1438,7 +1451,9 @@ Packets that violate these minima are discarded
and a kiss-o'-death packet returned if enabled.
The default
minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+<code>monitor</code>
+subcommand specifies the probability of discard
for packets that overflow the rate-control window.
<br><dt><code>restrict</code> <code>address</code> <code>[mask </code><kbd>mask</kbd><code>]</code> <code>[</code><kbd>flag</kbd> <kbd>...</kbd><code>]</code><dd>The
<kbd>address</kbd>
@@ -1490,7 +1505,9 @@ per second.
If another KoD packet occurs within one second after the
last one, the packet is dropped.
<br><dt><code>limited</code><dd>Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+<code>discard</code>
+command.
A history of clients is kept using the
monitoring capability of
<code>ntpd(1ntpdmdoc)</code>.
@@ -1615,8 +1632,11 @@ The library can also be used with other NTPv4 modes
as well and is highly recommended, especially for broadcast modes.
<p>A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+<code>manycastclient</code>
+command, which is similar to the
+<code>server</code>
+command but with a multicast (IPv4 class
<code>D</code>
or IPv6 prefix
<code>FF</code>)
@@ -1686,7 +1706,9 @@ command and, under normal circumstances, increments to the
<code>maxpolll</code>
value specified in this command.
Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+<code>ttl</code>
+command.
At each retransmission the TTL is increased until reaching
the maximum hops specified by this command or a sufficient
number client associations have been found.
@@ -2503,7 +2525,9 @@ peers, system events and so on is suppressed.
be used instead of the default system
<code>syslog(3)</code>
facility.
-This is the same operation as the -l command line option.
+This is the same operation as the
+<code>-l</code>
+command line option.
<br><dt><code>setvar</code> <kbd>variable</kbd> <code>[default]</code><dd>This command adds an additional system variable.
These
variables can be used to distribute additional information such as
diff --git a/contrib/ntp/ntpd/ntp.conf.man.in b/contrib/ntp/ntpd/ntp.conf.man.in
index 7a5b750..98b37bc 100644
--- a/contrib/ntp/ntpd/ntp.conf.man.in
+++ b/contrib/ntp/ntpd/ntp.conf.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp.conf 5 "20 Jan 2016" "4.2.8p6" "File Formats"
+.TH ntp.conf 5 "26 Apr 2016" "4.2.8p7" "File Formats"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gsaOxR/ag-XsaGwR)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-ana4jE/ag-QnaWiE)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:17:45 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:14 PM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -133,8 +133,14 @@ in some weird and even destructive behavior.
If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
is detected, support for the IPv6 address family is generated
in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+\f\*[B-Font]reslist\f[]
+billboard generated
+by
+\fCntpq\f[]\fR(@NTPQ_MS@)\f[]
+or
+\fCntpdc\f[]\fR(@NTPDC_MS@)\f[],
+IPv6 addresses are automatically generated.
IPv6 addresses can be identified by the presence of colons
\*[Lq]\&:\*[Rq]
in the address field.
@@ -157,11 +163,11 @@ equivalent classes for that address family.
.TP 7
.NOP \f\*[B-Font]pool\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
.TP 7
-.NOP \f\*[B-Font]server\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
+.NOP \f\*[B-Font]server\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]burst\f[]] [\f\*[B-Font]iburst\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]true\f[]]
.TP 7
-.NOP \f\*[B-Font]peer\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]]
+.NOP \f\*[B-Font]peer\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]true\f[]] [\f\*[B-Font]xleave\f[]]
.TP 7
-.NOP \f\*[B-Font]broadcast\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]]
+.NOP \f\*[B-Font]broadcast\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]] [\f\*[B-Font]xleave\f[]]
.TP 7
.NOP \f\*[B-Font]manycastclient\f[] \f\*[I-Font]address\f[] [\f\*[B-Font]key\f[] \f\*[I-Font]key\f[] \f\*[I-Font]\&|\f[] \f\*[B-Font]autokey\f[]] [\f\*[B-Font]version\f[] \f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]] [\f\*[B-Font]minpoll\f[] \f\*[I-Font]minpoll\f[]] [\f\*[B-Font]maxpoll\f[] \f\*[I-Font]maxpoll\f[]] [\f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]]
.PP
@@ -289,7 +295,9 @@ when the server is reachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+\f\*[B-Font]calldelay\f[]
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to improve timekeeping quality
with the
@@ -301,7 +309,9 @@ When the server is unreachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+\f\*[B-Font]calldelay\f[]
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to speed the initial synchronization
acquisition with the
@@ -339,6 +349,13 @@ option to a lower limit of 4 (16 s).
Marks the server as unused, except for display purposes.
The server is discarded by the selection algroithm.
.TP 7
+.NOP \f\*[B-Font]preempt\f[]
+Says the association can be preempted.
+.TP 7
+.NOP \f\*[B-Font]true\f[]
+Marks the server as a truechimer.
+Use this option only for testing.
+.TP 7
.NOP \f\*[B-Font]prefer\f[]
Marks the server as preferred.
All other things being equal,
@@ -352,6 +369,12 @@ provided in
\fI/usr/share/doc/ntp\f[])
for further information.
.TP 7
+.NOP \f\*[B-Font]true\f[]
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+\fIonly\f[]
+be used while testing an association.
+.TP 7
.NOP \f\*[B-Font]ttl\f[] \f\*[I-Font]ttl\f[]
This option is used only with broadcast server and manycast
client modes.
@@ -371,6 +394,13 @@ Specifies the version number to be used for outgoing NTP
packets.
Versions 1-4 are the choices, with version 4 the
default.
+.TP 7
+.NOP \f\*[B-Font]xleave\f[]
+Valid in
+\f\*[B-Font]peer\f[]
+and
+\f\*[B-Font]broadcast\f[]
+modes only, this flag enables interleave mode.
.PP
.SS Auxiliary Commands
.TP 7
@@ -529,7 +559,7 @@ and
commands and also by remote
configuration commands sent by a
\fCntpdc\f[]\fR(@NTPDC_MS@)\f[]
-program running in
+program running on
another machine.
If this flag is enabled, which is the default
case, new broadcast client and symmetric passive associations and
@@ -735,7 +765,7 @@ using the host name, network address and public keys,
all of which are bound together by the protocol specifically
to deflect masquerade attacks.
For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
computations and so the same addresses must be available
at both the server and client.
For this reason operation
@@ -942,8 +972,8 @@ the link
in the keys directory.
.TP 7
.NOP \f\*[B-Font]iffpar\f[] \f\*[I-Font]file\f[]
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
\fIntpkey_iff_\f[]\f\*[I-Font]hostname\f[]
in the keys directory.
.TP 7
@@ -955,8 +985,7 @@ in the keys directory.
.TP 7
.NOP \f\*[B-Font]mvpar\f[] \f\*[I-Font]file\f[]
Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
\fIntpkey_mv_\f[]\f\*[I-Font]hostname\f[]
in the keys directory.
.TP 7
@@ -1118,7 +1147,7 @@ supported.
Statistic files are managed using file generation sets
and scripts in the
\fI./scripts\f[]
-directory of this distribution.
+directory of the source code distribution.
Using
these facilities and
UNIX
@@ -1511,7 +1540,9 @@ When there is already a file with this name and
the number of links of this file is one, it is renamed appending a
dot, the letter
\f\*[B-Font]C\f[],
-and the pid of the ntpd server process.
+and the pid of the
+\fCntpd\f[]\fR(@NTPD_MS@)\f[]
+server process.
When the
number of links is greater than one, the file is unlinked.
This
@@ -1559,7 +1590,9 @@ by a determined cracker.
.ne 2
Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+\f\*[B-Font]restrict\f[]
+command
or implicitly as the result of cryptographic or rate limit
violations.
Cryptographic violations include certificate
@@ -1569,9 +1602,9 @@ at abusive rates.
Some violations cause denied service
only for the offending packet, others cause denied service
for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
the restrictions is by restarting the server.
.SS The Kiss-of-Death Packet
Ordinarily, packets denied service are simply dropped with no
@@ -1627,7 +1660,9 @@ Packets that violate these minima are discarded
and a kiss-o'-death packet returned if enabled.
The default
minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+\f\*[B-Font]monitor\f[]
+subcommand specifies the probability of discard
for packets that overflow the rate-control window.
.TP 7
.NOP \f\*[B-Font]restrict\f[] \f\*[B-Font]address\f[] [\f\*[B-Font]mask\f[] \f\*[I-Font]mask\f[]] [\f\*[I-Font]flag\f[] \f\*[I-Font]...\f[]]
@@ -1687,7 +1722,9 @@ last one, the packet is dropped.
.TP 7
.NOP \f\*[B-Font]limited\f[]
Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+\f\*[B-Font]discard\f[]
+command.
A history of clients is kept using the
monitoring capability of
\fCntpd\f[]\fR(@NTPD_MS@)\f[].
@@ -1754,7 +1791,9 @@ queries.
.NOP \f\*[B-Font]notrap\f[]
Decline to provide mode 6 control message trap service to matching
hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+\fCntpq\f[]\fR(@NTPQ_MS@)\f[]
+control message
protocol which is intended for use by remote event logging programs.
.TP 7
.NOP \f\*[B-Font]notrust\f[]
@@ -1832,8 +1871,11 @@ as well and is highly recommended, especially for broadcast modes.
.ne 2
A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+\f\*[B-Font]manycastclient\f[]
+command, which is similar to the
+\f\*[B-Font]server\f[]
+command but with a multicast (IPv4 class
\f\*[B-Font]D\f[]
or IPv6 prefix
\f\*[B-Font]FF\f[])
@@ -1909,7 +1951,9 @@ command and, under normal circumstances, increments to the
\f\*[B-Font]maxpolll\f[]
value specified in this command.
Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+\f\*[B-Font]ttl\f[]
+command.
At each retransmission the TTL is increased until reaching
the maximum hops specified by this command or a sufficient
number client associations have been found.
@@ -2571,7 +2615,8 @@ otherwise, should be avoided.
.TP 7
.NOP \f\*[B-Font]dscp\f[] \f\*[I-Font]value\f[]
This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6-bit code. The default value is 46, signifying Expedited Forwarding.
+a 6-bit code.
+The default value is 46, signifying Expedited Forwarding.
.TP 7
.NOP \f\*[B-Font]enable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
.TP 7
@@ -2798,7 +2843,8 @@ A
message class may also be followed by the
\f\*[B-Font]all\f[]
keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
could look like this:
.br
.in +4
@@ -2833,7 +2879,9 @@ This command specifies the location of an alternate log file to
be used instead of the default system
\fCsyslog\f[]\fR(3)\f[]
facility.
-This is the same operation as the \-l command line option.
+This is the same operation as the
+\f\*[B-Font]\-l\f[]
+command line option.
.TP 7
.NOP \f\*[B-Font]setvar\f[] \f\*[I-Font]variable\f[] [\f\*[B-Font]default\f[]]
This command adds an additional system variable.
@@ -2978,7 +3026,8 @@ function.
Defaults to 50 4k pages (200 4k pages in OpenBSD).
.TP 7
.NOP \f\*[B-Font]filenum\f[] \f\*[I-Font]Nfiledescriptors\f[]
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
.RE
.TP 7
.NOP \f\*[B-Font]trap\f[] \f\*[I-Font]host_address\f[] [\f\*[B-Font]port\f[] \f\*[I-Font]port_number\f[]] [\f\*[B-Font]interface\f[] \f\*[I-Font]interface_address\f[]]
diff --git a/contrib/ntp/ntpd/ntp.conf.mdoc.in b/contrib/ntp/ntpd/ntp.conf.mdoc.in
index fe85d85..82164a3 100644
--- a/contrib/ntp/ntpd/ntp.conf.mdoc.in
+++ b/contrib/ntp/ntpd/ntp.conf.mdoc.in
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
.Dt NTP_CONF 5 File Formats
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:18:07 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:36 PM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -111,8 +111,14 @@ in some weird and even destructive behavior.
If the Basic Socket Interface Extensions for IPv6 (RFC\-2553)
is detected, support for the IPv6 address family is generated
in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+.Cm reslist
+billboard generated
+by
+.Xr ntpq @NTPQ_MS@
+or
+.Xr ntpdc @NTPDC_MS@ ,
+IPv6 addresses are automatically generated.
IPv6 addresses can be identified by the presence of colons
.Dq \&:
in the address field.
@@ -147,6 +153,7 @@ equivalent classes for that address family.
.Op Cm prefer
.Op Cm minpoll Ar minpoll
.Op Cm maxpoll Ar maxpoll
+.Op Cm true
.Xc
.It Xo Ic peer Ar address
.Op Cm key Ar key \&| Cm autokey
@@ -154,6 +161,8 @@ equivalent classes for that address family.
.Op Cm prefer
.Op Cm minpoll Ar minpoll
.Op Cm maxpoll Ar maxpoll
+.Op Cm true
+.Op Cm xleave
.Xc
.It Xo Ic broadcast Ar address
.Op Cm key Ar key \&| Cm autokey
@@ -161,6 +170,7 @@ equivalent classes for that address family.
.Op Cm prefer
.Op Cm minpoll Ar minpoll
.Op Cm ttl Ar ttl
+.Op Cm xleave
.Xc
.It Xo Ic manycastclient Ar address
.Op Cm key Ar key \&| Cm autokey
@@ -286,7 +296,9 @@ when the server is reachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first and second packets
-can be changed with the calldelay command to allow
+can be changed with the
+.Ic calldelay
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to improve timekeeping quality
with the
@@ -297,7 +309,9 @@ When the server is unreachable, send a burst of eight packets
instead of the usual one.
The packet spacing is normally 2 s;
however, the spacing between the first two packets can be
-changed with the calldelay command to allow
+changed with the
+.Ic calldelay
+command to allow
additional time for a modem or ISDN call to complete.
This is designed to speed the initial synchronization
acquisition with the
@@ -330,6 +344,11 @@ option to a lower limit of 4 (16 s).
.It Cm noselect
Marks the server as unused, except for display purposes.
The server is discarded by the selection algroithm.
+.It Cm preempt
+Says the association can be preempted.
+.It Cm true
+Marks the server as a truechimer.
+Use this option only for testing.
.It Cm prefer
Marks the server as preferred.
All other things being equal,
@@ -342,6 +361,11 @@ page
provided in
.Pa /usr/share/doc/ntp )
for further information.
+.It Cm true
+Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+.Em only
+be used while testing an association.
.It Cm ttl Ar ttl
This option is used only with broadcast server and manycast
client modes.
@@ -360,6 +384,12 @@ Specifies the version number to be used for outgoing NTP
packets.
Versions 1\-4 are the choices, with version 4 the
default.
+.It Cm xleave
+Valid in
+.Cm peer
+and
+.Cm broadcast
+modes only, this flag enables interleave mode.
.El
.Ss Auxiliary Commands
.Bl -tag -width indent
@@ -505,7 +535,7 @@ and
commands and also by remote
configuration commands sent by a
.Xr ntpdc @NTPDC_MS@
-program running in
+program running on
another machine.
If this flag is enabled, which is the default
case, new broadcast client and symmetric passive associations and
@@ -695,7 +725,7 @@ using the host name, network address and public keys,
all of which are bound together by the protocol specifically
to deflect masquerade attacks.
For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
computations and so the same addresses must be available
at both the server and client.
For this reason operation
@@ -893,8 +923,8 @@ the link
.Pa ntpkey_key_ Ns Ar hostname
in the keys directory.
.It Cm iffpar Ar file
-Specifies the location of the optional IFF parameters file.This
-overrides the link
+Specifies the location of the optional IFF parameters file.
+This overrides the link
.Pa ntpkey_iff_ Ns Ar hostname
in the keys directory.
.It Cm leap Ar file
@@ -904,8 +934,7 @@ This overrides the link
in the keys directory.
.It Cm mvpar Ar file
Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
.Pa ntpkey_mv_ Ns Ar hostname
in the keys directory.
.It Cm pw Ar password
@@ -1046,7 +1075,7 @@ supported.
Statistic files are managed using file generation sets
and scripts in the
.Pa ./scripts
-directory of this distribution.
+directory of the source code distribution.
Using
these facilities and
.Ux
@@ -1380,7 +1409,9 @@ When there is already a file with this name and
the number of links of this file is one, it is renamed appending a
dot, the letter
.Cm C ,
-and the pid of the ntpd server process.
+and the pid of the
+.Xr ntpd @NTPD_MS@
+server process.
When the
number of links is greater than one, the file is unlinked.
This
@@ -1423,7 +1454,9 @@ Source address based restrictions are easily circumvented
by a determined cracker.
.Pp
Clients can be denied service because they are explicitly
-included in the restrict list created by the restrict command
+included in the restrict list created by the
+.Ic restrict
+command
or implicitly as the result of cryptographic or rate limit
violations.
Cryptographic violations include certificate
@@ -1433,9 +1466,9 @@ at abusive rates.
Some violations cause denied service
only for the offending packet, others cause denied service
for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
the restrictions is by restarting the server.
.Ss The Kiss\-of\-Death Packet
Ordinarily, packets denied service are simply dropped with no
@@ -1493,7 +1526,9 @@ Packets that violate these minima are discarded
and a kiss\-o'\-death packet returned if enabled.
The default
minimum average and minimum are 5 and 2, respectively.
-The monitor subcommand specifies the probability of discard
+The
+.Ic monitor
+subcommand specifies the probability of discard
for packets that overflow the rate\-control window.
.It Xo Ic restrict address
.Op Cm mask Ar mask
@@ -1552,7 +1587,9 @@ If another KoD packet occurs within one second after the
last one, the packet is dropped.
.It Cm limited
Deny service if the packet spacing violates the lower limits specified
-in the discard command.
+in the
+.Ic discard
+command.
A history of clients is kept using the
monitoring capability of
.Xr ntpd @NTPD_MS@ .
@@ -1612,7 +1649,9 @@ queries.
.It Cm notrap
Decline to provide mode 6 control message trap service to matching
hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+.Xr ntpq @NTPQ_MS@
+control message
protocol which is intended for use by remote event logging programs.
.It Cm notrust
Deny service unless the packet is cryptographically authenticated.
@@ -1679,8 +1718,11 @@ The library can also be used with other NTPv4 modes
as well and is highly recommended, especially for broadcast modes.
.Pp
A persistent manycast client association is configured
-using the manycastclient command, which is similar to the
-server command but with a multicast (IPv4 class
+using the
+.Ic manycastclient
+command, which is similar to the
+.Ic server
+command but with a multicast (IPv4 class
.Cm D
or IPv6 prefix
.Cm FF )
@@ -1750,7 +1792,9 @@ command and, under normal circumstances, increments to the
.Cm maxpolll
value specified in this command.
Initially, the TTL is
-set at the minimum hops specified by the ttl command.
+set at the minimum hops specified by the
+.Ic ttl
+command.
At each retransmission the TTL is increased until reaching
the maximum hops specified by this command or a sufficient
number client associations have been found.
@@ -2388,7 +2432,8 @@ drift file is located in, and that file system links, symbolic or
otherwise, should be avoided.
.It Ic dscp Ar value
This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6\-bit code. The default value is 46, signifying Expedited Forwarding.
+a 6\-bit code.
+The default value is 46, signifying Expedited Forwarding.
.It Xo Ic enable
.Oo
.Cm auth | Cm bclient |
@@ -2627,7 +2672,8 @@ A
message class may also be followed by the
.Cm all
keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
could look like this:
.Bd -literal
logconfig =syncstatus +sysevents
@@ -2651,7 +2697,9 @@ This command specifies the location of an alternate log file to
be used instead of the default system
.Xr syslog 3
facility.
-This is the same operation as the \-l command line option.
+This is the same operation as the
+.Fl l
+command line option.
.It Ic setvar Ar variable Op Cm default
This command adds an additional system variable.
These
@@ -2803,7 +2851,8 @@ Specifies the maximum size of the process stack on systems with the
function.
Defaults to 50 4k pages (200 4k pages in OpenBSD).
.It Cm filenum Ar Nfiledescriptors
-Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
.El
.It Xo Ic trap Ar host_address
.Op Cm port Ar port_number
diff --git a/contrib/ntp/ntpd/ntp.keys.5man b/contrib/ntp/ntpd/ntp.keys.5man
index 6d270b6..9843554 100644
--- a/contrib/ntp/ntpd/ntp.keys.5man
+++ b/contrib/ntp/ntpd/ntp.keys.5man
@@ -1,8 +1,8 @@
-.TH ntp.keys 5man "20 Jan 2016" "4.2.8p6" "File Formats"
+.TH ntp.keys 5man "26 Apr 2016" "4.2.8p7" "File Formats"
.\"
.\" EDIT THIS FILE WITH CAUTION (ntp.man)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:17:51 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:19 PM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agman-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.keys.5mdoc b/contrib/ntp/ntpd/ntp.keys.5mdoc
index 6091e09..ad9cc92 100644
--- a/contrib/ntp/ntpd/ntp.keys.5mdoc
+++ b/contrib/ntp/ntpd/ntp.keys.5mdoc
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
.Dt NTP_KEYS 5mdoc File Formats
.Os SunOS 5.10
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:18:10 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:39 PM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agmdoc-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.keys.html b/contrib/ntp/ntpd/ntp.keys.html
index 409e7fc..083b28b 100644
--- a/contrib/ntp/ntpd/ntp.keys.html
+++ b/contrib/ntp/ntpd/ntp.keys.html
@@ -33,7 +33,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>This document describes the symmetric key file for the NTP Project's
<code>ntpd</code> program.
- <p>This document applies to version 4.2.8p6 of <code>ntp.keys</code>.
+ <p>This document applies to version 4.2.8p7 of <code>ntp.keys</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
diff --git a/contrib/ntp/ntpd/ntp.keys.man.in b/contrib/ntp/ntpd/ntp.keys.man.in
index 2e97e27..d68be1c 100644
--- a/contrib/ntp/ntpd/ntp.keys.man.in
+++ b/contrib/ntp/ntpd/ntp.keys.man.in
@@ -1,8 +1,8 @@
-.TH ntp.keys 5 "20 Jan 2016" "4.2.8p6" "File Formats"
+.TH ntp.keys 5 "26 Apr 2016" "4.2.8p7" "File Formats"
.\"
.\" EDIT THIS FILE WITH CAUTION (ntp.man)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:17:51 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:19 PM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agman-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.keys.mdoc.in b/contrib/ntp/ntpd/ntp.keys.mdoc.in
index 3b4fa2c..c1a9c7d 100644
--- a/contrib/ntp/ntpd/ntp.keys.mdoc.in
+++ b/contrib/ntp/ntpd/ntp.keys.mdoc.in
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
.Dt NTP_KEYS 5 File Formats
.Os SunOS 5.10
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:18:10 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:39 PM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agmdoc-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp_control.c b/contrib/ntp/ntpd/ntp_control.c
index e5a567e..07b5697 100644
--- a/contrib/ntp/ntpd/ntp_control.c
+++ b/contrib/ntp/ntpd/ntp_control.c
@@ -911,18 +911,18 @@ is_safe_filename(const char * name)
};
u_int widx, bidx, mask;
- if (!*name)
+ if ( ! (name && *name))
return FALSE;
mask = 1u;
while (0 != (widx = (u_char)*name++)) {
bidx = (widx & 15) << 1;
widx = widx >> 4;
- if (widx >= sizeof(chclass))
+ if (widx >= sizeof(chclass)/sizeof(chclass[0]))
return FALSE;
if (0 == ((chclass[widx] >> bidx) & mask))
return FALSE;
- mask |= 2u;
+ mask = 2u;
}
return TRUE;
}
@@ -3081,83 +3081,117 @@ ctl_getitem(
char **data
)
{
+ /* [Bug 3008] First check the packet data sanity, then search
+ * the key. This improves the consistency of result values: If
+ * the result is NULL once, it will never be EOV again for this
+ * packet; If it's EOV, it will never be NULL again until the
+ * variable is found and processed in a given 'var_list'. (That
+ * is, a result is returned that is neither NULL nor EOV).
+ */
static const struct ctl_var eol = { 0, EOV, NULL };
static char buf[128];
static u_long quiet_until;
const struct ctl_var *v;
- const char *pch;
char *cp;
char *tp;
/*
- * Delete leading commas and white space
+ * Part One: Validate the packet state
*/
+
+ /* Delete leading commas and white space */
while (reqpt < reqend && (*reqpt == ',' ||
isspace((unsigned char)*reqpt)))
reqpt++;
if (reqpt >= reqend)
return NULL;
+ /* Scan the string in the packet until we hit comma or
+ * EoB. Register position of first '=' on the fly. */
+ for (tp = NULL, cp = reqpt; cp != reqend; ++cp) {
+ if (*cp == '=' && tp == NULL)
+ tp = cp;
+ if (*cp == ',')
+ break;
+ }
+
+ /* Process payload, if any. */
+ *data = NULL;
+ if (NULL != tp) {
+ /* eventually strip white space from argument. */
+ const char *plhead = tp + 1; /* skip the '=' */
+ const char *pltail = cp;
+ size_t plsize;
+
+ while (plhead != pltail && isspace((u_char)plhead[0]))
+ ++plhead;
+ while (plhead != pltail && isspace((u_char)pltail[-1]))
+ --pltail;
+
+ /* check payload size, terminate packet on overflow */
+ plsize = (size_t)(pltail - plhead);
+ if (plsize >= sizeof(buf))
+ goto badpacket;
+
+ /* copy data, NUL terminate, and set result data ptr */
+ memcpy(buf, plhead, plsize);
+ buf[plsize] = '\0';
+ *data = buf;
+ } else {
+ /* no payload, current end --> current name termination */
+ tp = cp;
+ }
+
+ /* Part Two
+ *
+ * Now we're sure that the packet data itself is sane. Scan the
+ * list now. Make sure a NULL list is properly treated by
+ * returning a synthetic End-Of-Values record. We must not
+ * return NULL pointers after this point, or the behaviour would
+ * become inconsistent if called several times with different
+ * variable lists after an EoV was returned. (Such a behavior
+ * actually caused Bug 3008.)
+ */
+
if (NULL == var_list)
return &eol;
- /*
- * Look for a first character match on the tag. If we find
- * one, see if it is a full match.
- */
- cp = reqpt;
- for (v = var_list; !(EOV & v->flags); v++) {
- if (!(PADDING & v->flags) && *cp == *(v->text)) {
- pch = v->text;
- while ('\0' != *pch && '=' != *pch && cp < reqend
- && *cp == *pch) {
- cp++;
- pch++;
- }
- if ('\0' == *pch || '=' == *pch) {
- while (cp < reqend && isspace((u_char)*cp))
- cp++;
- if (cp == reqend || ',' == *cp) {
- buf[0] = '\0';
- *data = buf;
- if (cp < reqend)
- cp++;
- reqpt = cp;
- return v;
- }
- if ('=' == *cp) {
- cp++;
- tp = buf;
- while (cp < reqend && isspace((u_char)*cp))
- cp++;
- while (cp < reqend && *cp != ',') {
- *tp++ = *cp++;
- if ((size_t)(tp - buf) >= sizeof(buf)) {
- ctl_error(CERR_BADFMT);
- numctlbadpkts++;
- NLOG(NLOG_SYSEVENT)
- if (quiet_until <= current_time) {
- quiet_until = current_time + 300;
- msyslog(LOG_WARNING,
-"Possible 'ntpdx' exploit from %s#%u (possibly spoofed)", stoa(rmt_addr), SRCPORT(rmt_addr));
- }
- return NULL;
- }
- }
- if (cp < reqend)
- cp++;
- *tp-- = '\0';
- while (tp >= buf && isspace((u_char)*tp))
- *tp-- = '\0';
- reqpt = cp;
- *data = buf;
- return v;
- }
+ for (v = var_list; !(EOV & v->flags); ++v)
+ if (!(PADDING & v->flags)) {
+ /* check if the var name matches the buffer */
+ const char *sp1 = reqpt;
+ const char *sp2 = v->text;
+
+ while ((sp1 != tp) && *sp2 && (*sp1 == *sp2)) {
+ ++sp1;
+ ++sp2;
}
- cp = reqpt;
+ if (sp1 == tp && !*sp2)
+ break;
}
- }
+
+ /* See if we have found a valid entry or not. If found, advance
+ * the request pointer for the next round; if not, clear the
+ * data pointer so we have no dangling garbage here.
+ */
+ if (EOV & v->flags)
+ *data = NULL;
+ else
+ reqpt = cp + (cp != reqend);
return v;
+
+ badpacket:
+ /*TODO? somehow indicate this packet was bad, apart from syslog? */
+ numctlbadpkts++;
+ NLOG(NLOG_SYSEVENT)
+ if (quiet_until <= current_time) {
+ quiet_until = current_time + 300;
+ msyslog(LOG_WARNING,
+ "Possible 'ntpdx' exploit from %s#%u (possibly spoofed)",
+ stoa(rmt_addr), SRCPORT(rmt_addr));
+ }
+ reqpt = reqend; /* never again for this packet! */
+ return NULL;
}
@@ -3334,7 +3368,11 @@ read_sysvars(void)
gotvar = 1;
} else {
v = ctl_getitem(ext_sys_var, &valuep);
- INSIST(v != NULL);
+ if (NULL == v) {
+ ctl_error(CERR_BADVALUE);
+ free(wants);
+ return;
+ }
if (EOV & v->flags) {
ctl_error(CERR_UNKNOWNVAR);
free(wants);
@@ -4575,7 +4613,12 @@ read_clockstatus(
gotvar = TRUE;
} else {
v = ctl_getitem(kv, &valuep);
- INSIST(NULL != v);
+ if (NULL == v) {
+ ctl_error(CERR_BADVALUE);
+ free(wants);
+ free_varlist(cs.kv_list);
+ return;
+ }
if (EOV & v->flags) {
ctl_error(CERR_UNKNOWNVAR);
free(wants);
diff --git a/contrib/ntp/ntpd/ntp_io.c b/contrib/ntp/ntpd/ntp_io.c
index ee52b1a..55f9ada 100644
--- a/contrib/ntp/ntpd/ntp_io.c
+++ b/contrib/ntp/ntpd/ntp_io.c
@@ -62,10 +62,6 @@
# endif
#endif
-#if defined(HAVE_SIGNALED_IO) && defined(DEBUG_TIMING)
-# undef DEBUG_TIMING
-#endif
-
/*
* setsockopt does not always have the same arg declaration
* across all platforms. If it's not defined we make it empty
@@ -778,6 +774,12 @@ new_interface(
iface->ifnum = sys_ifnum++;
iface->starttime = current_time;
+# ifdef HAVE_IO_COMPLETION_PORT
+ if (!io_completion_port_add_interface(iface)) {
+ msyslog(LOG_EMERG, "cannot register interface with IO engine -- will exit now");
+ exit(1);
+ }
+# endif
return iface;
}
@@ -785,11 +787,14 @@ new_interface(
/*
* return interface storage into free memory pool
*/
-static inline void
+static void
delete_interface(
endpt *ep
)
{
+# ifdef HAVE_IO_COMPLETION_PORT
+ io_completion_port_remove_interface(ep);
+# endif
free(ep);
}
@@ -1007,6 +1012,9 @@ remove_interface(
ep->sent,
ep->notsent,
current_time - ep->starttime);
+# ifdef HAVE_IO_COMPLETION_PORT
+ io_completion_port_remove_socket(ep->fd, ep);
+# endif
close_and_delete_fd_from_list(ep->fd);
ep->fd = INVALID_SOCKET;
}
@@ -1015,10 +1023,15 @@ remove_interface(
msyslog(LOG_INFO,
"stop listening for broadcasts to %s on interface #%d %s",
stoa(&ep->bcast), ep->ifnum, ep->name);
+# ifdef HAVE_IO_COMPLETION_PORT
+ io_completion_port_remove_socket(ep->bfd, ep);
+# endif
close_and_delete_fd_from_list(ep->bfd);
ep->bfd = INVALID_SOCKET;
- ep->flags &= ~INT_BCASTOPEN;
}
+# ifdef HAVE_IO_COMPLETION_PORT
+ io_completion_port_remove_interface(ep);
+# endif
ninterfaces--;
mon_clearinterface(ep);
@@ -2569,7 +2582,7 @@ io_setbclient(void)
continue;
/* Only IPv4 addresses are valid for broadcast */
- REQUIRE(IS_IPV4(&interf->sin));
+ REQUIRE(IS_IPV4(&interf->bcast));
/* Do we already have the broadcast address open? */
if (interf->flags & INT_BCASTOPEN) {
@@ -2597,13 +2610,31 @@ io_setbclient(void)
msyslog(LOG_INFO,
"Listen for broadcasts to %s on interface #%d %s",
stoa(&interf->bcast), interf->ifnum, interf->name);
- } else {
- /* silently ignore EADDRINUSE as we probably opened
- the socket already for an address in the same network */
- if (errno != EADDRINUSE)
- msyslog(LOG_INFO,
- "failed to listen for broadcasts to %s on interface #%d %s",
- stoa(&interf->bcast), interf->ifnum, interf->name);
+ } else switch (errno) {
+ /* Silently ignore EADDRINUSE as we probably
+ * opened the socket already for an address in
+ * the same network */
+ case EADDRINUSE:
+ /* Some systems cannot bind a socket to a broadcast
+ * address, as that is not a valid host address. */
+ case EADDRNOTAVAIL:
+# ifdef SYS_WINNT /*TODO: use for other systems, too? */
+ /* avoid recurrence here -- if we already have a
+ * regular socket, it's quite useless to try this
+ * again.
+ */
+ if (interf->fd != INVALID_SOCKET) {
+ interf->flags |= INT_BCASTOPEN;
+ nif++;
+ }
+# endif
+ break;
+
+ default:
+ msyslog(LOG_INFO,
+ "failed to listen for broadcasts to %s on interface #%d %s",
+ stoa(&interf->bcast), interf->ifnum, interf->name);
+ break;
}
}
set_reuseaddr(0);
@@ -2641,10 +2672,13 @@ io_unsetbclient(void)
msyslog(LOG_INFO,
"stop listening for broadcasts to %s on interface #%d %s",
stoa(&ep->bcast), ep->ifnum, ep->name);
+# ifdef HAVE_IO_COMPLETION_PORT
+ io_completion_port_remove_socket(ep->bfd, ep);
+# endif
close_and_delete_fd_from_list(ep->bfd);
ep->bfd = INVALID_SOCKET;
- ep->flags &= ~INT_BCASTOPEN;
}
+ ep->flags &= ~INT_BCASTOPEN;
}
broadcast_client_enabled = ISC_FALSE;
}
@@ -3020,11 +3054,11 @@ open_socket(
fcntl(fd, F_GETFL, 0)));
#endif /* SYS_WINNT || VMS */
-#if defined (HAVE_IO_COMPLETION_PORT)
+#if defined(HAVE_IO_COMPLETION_PORT)
/*
* Add the socket to the completion port
*/
- if (io_completion_port_add_socket(fd, interf)) {
+ if (!io_completion_port_add_socket(fd, interf, bcast)) {
msyslog(LOG_ERR, "unable to set up io completion port - EXITING");
exit(1);
}
@@ -3033,10 +3067,6 @@ open_socket(
}
-#ifdef SYS_WINNT
-#define sendto(fd, buf, len, flags, dest, destsz) \
- io_completion_port_sendto(fd, buf, len, (sockaddr_u *)(dest))
-#endif
/* XXX ELIMINATE sendpkt similar in ntpq.c, ntpdc.c, ntp_io.c, ntptrace.c */
/*
@@ -3124,6 +3154,9 @@ sendpkt(
#ifdef SIM
cc = simulate_server(dest, src, pkt);
+#elif defined(HAVE_IO_COMPLETION_PORT)
+ cc = io_completion_port_sendto(src, src->fd, pkt,
+ (size_t)len, (sockaddr_u *)&dest->sa);
#else
cc = sendto(src->fd, (char *)pkt, (u_int)len, 0,
&dest->sa, SOCKLEN(dest));
@@ -3141,7 +3174,8 @@ sendpkt(
}
-#if !defined(HAVE_IO_COMPLETION_PORT) && !defined(HAVE_SIGNALED_IO)
+#if !defined(HAVE_IO_COMPLETION_PORT)
+#if !defined(HAVE_SIGNALED_IO)
/*
* fdbits - generate ascii representation of fd_set (FAU debug support)
* HFDF format - highest fd first.
@@ -3450,6 +3484,18 @@ read_network_packet(
DPRINTF(3, ("read_network_packet: fd=%d length %d from %s\n",
fd, buflen, stoa(&rb->recv_srcadr)));
+#ifdef ENABLE_BUG3020_FIX
+ if (ISREFCLOCKADR(&rb->recv_srcadr)) {
+ msyslog(LOG_ERR, "recvfrom(%s) fd=%d: refclock srcadr on a network interface!",
+ stoa(&rb->recv_srcadr), fd);
+ DPRINTF(1, ("read_network_packet: fd=%d dropped (refclock srcadr))\n",
+ fd));
+ packets_dropped++;
+ freerecvbuf(rb);
+ return (buflen);
+ }
+#endif
+
/*
** Bug 2672: Some OSes (MacOSX and Linux) don't block spoofed ::1
*/
@@ -3789,7 +3835,7 @@ input_handler_scan(
lfptoms(&ts_e, 6));
#endif /* DEBUG_TIMING */
}
-
+#endif /* !HAVE_IO_COMPLETION_PORT */
/*
* find an interface suitable for the src address
@@ -4279,7 +4325,7 @@ io_addclock(
return 0;
}
# elif defined(HAVE_IO_COMPLETION_PORT)
- if (io_completion_port_add_clock_io(rio)) {
+ if (!io_completion_port_add_clock_io(rio)) {
UNBLOCKIO();
return 0;
}
@@ -4318,13 +4364,23 @@ io_closeclock(
rio->active = FALSE;
UNLINK_SLIST(unlinked, refio, rio, next, struct refclockio);
if (NULL != unlinked) {
- purge_recv_buffers_for_fd(rio->fd);
- /*
- * Close the descriptor.
+ /* Close the descriptor. The order of operations is
+ * important here in case of async / overlapped IO:
+ * only after we have removed the clock from the
+ * IO completion port we can be sure no further
+ * input is queued. So...
+ * - we first disable feeding to the queu by removing
+ * the clock from the IO engine
+ * - close the file (which brings down any IO on it)
+ * - clear the buffer from results for this fd
*/
+# ifdef HAVE_IO_COMPLETION_PORT
+ io_completion_port_remove_clock_io(rio);
+# endif
close_and_delete_fd_from_list(rio->fd);
+ purge_recv_buffers_for_fd(rio->fd);
+ rio->fd = -1;
}
- rio->fd = -1;
UNBLOCKIO();
}
diff --git a/contrib/ntp/ntpd/ntp_proto.c b/contrib/ntp/ntpd/ntp_proto.c
index ad45409..713a0c2 100644
--- a/contrib/ntp/ntpd/ntp_proto.c
+++ b/contrib/ntp/ntpd/ntp_proto.c
@@ -25,6 +25,11 @@
#include <unistd.h>
#endif
+/* [Bug 3031] define automatic broadcastdelay cutoff preset */
+#ifndef BDELAY_DEFAULT
+# define BDELAY_DEFAULT (-0.050)
+#endif
+
/*
* This macro defines the authentication state. If x is 1 authentication
* is required; othewise it is optional.
@@ -50,6 +55,12 @@ enum kiss_codes {
UNKNOWNKISS /* Unknown Kiss Code */
};
+enum nak_error_codes {
+ NONAK, /* No NAK seen */
+ INVALIDNAK, /* NAK cannot be used */
+ VALIDNAK /* NAK is valid */
+};
+
/*
* traffic shaping parameters
*/
@@ -166,7 +177,10 @@ int unpeer_crypto_early = 1; /* bad crypto (TEST9) */
int unpeer_crypto_nak_early = 1; /* crypto_NAK (TEST5) */
int unpeer_digest_early = 1; /* bad digest (TEST5) */
-static int kiss_code_check(u_char hisleap, u_char hisstratum, u_char hismode, u_int32 refid);
+int dynamic_interleave = DYNAMIC_INTERLEAVE; /* Bug 2978 mitigation */
+
+int kiss_code_check(u_char hisleap, u_char hisstratum, u_char hismode, u_int32 refid);
+enum nak_error_codes valid_NAK(struct peer *peer, struct recvbuf *rbufp, u_char hismode);
static double root_distance (struct peer *);
static void clock_combine (peer_select *, int, int);
static void peer_xmit (struct peer *);
@@ -253,6 +267,68 @@ kiss_code_check(
}
+/*
+ * Check that NAK is valid
+ */
+enum nak_error_codes
+valid_NAK(
+ struct peer *peer,
+ struct recvbuf *rbufp,
+ u_char hismode
+ )
+{
+ int base_packet_length = MIN_V4_PKT_LEN;
+ int remainder_size;
+ struct pkt *rpkt;
+ int keyid;
+
+ /*
+ * Check to see if there is something beyond the basic packet
+ */
+ if (rbufp->recv_length == base_packet_length) {
+ return NONAK;
+ }
+
+ remainder_size = rbufp->recv_length - base_packet_length;
+ /*
+ * Is this a potential NAK?
+ */
+ if (remainder_size != 4) {
+ return NONAK;
+ }
+
+ /*
+ * Only server responses can contain NAK's
+ */
+
+ if (hismode != MODE_SERVER &&
+ hismode != MODE_ACTIVE &&
+ hismode != MODE_PASSIVE
+ ) {
+ return (INVALIDNAK);
+ }
+
+ /*
+ * Make sure that the extra field in the packet is all zeros
+ */
+ rpkt = &rbufp->recv_pkt;
+ keyid = ntohl(((u_int32 *)rpkt)[base_packet_length / 4]);
+ if (keyid != 0) {
+ return (INVALIDNAK);
+ }
+
+ /*
+ * Only valid if peer uses a key
+ */
+ if (peer->keyid > 0 || peer->flags & FLAG_SKEY) {
+ return (VALIDNAK);
+ }
+ else {
+ return (INVALIDNAK);
+ }
+}
+
+
/*
* transmit - transmit procedure called by poll timeout
*/
@@ -493,6 +569,7 @@ receive(
int has_mac; /* length of MAC field */
int authlen; /* offset of MAC field */
int is_authentic = 0; /* cryptosum ok */
+ int crypto_nak_test; /* result of crypto-NAK check */
int retcode = AM_NOMATCH; /* match code */
keyid_t skeyid = 0; /* key IDs */
u_int32 opcode = 0; /* extension field opcode */
@@ -617,6 +694,7 @@ receive(
* extension field is present, so we subtract the length of the
* field and go around again.
*/
+
authlen = LEN_PKT_NOMAC;
has_mac = rbufp->recv_length - authlen;
while (has_mac > 0) {
@@ -767,6 +845,20 @@ receive(
* is zero, acceptable outcomes of y are NONE and OK. If x is
* one, the only acceptable outcome of y is OK.
*/
+ crypto_nak_test = valid_NAK(peer, rbufp, hismode);
+
+ /*
+ * Drop any invalid crypto-NAKs
+ */
+ if (crypto_nak_test == INVALIDNAK) {
+ report_event(PEVNT_AUTH, peer, "Invalid_NAK");
+ if (0 != peer) {
+ peer->badNAK++;
+ }
+ msyslog(LOG_ERR, "Invalid-NAK error at %ld %s<-%s",
+ current_time, stoa(dstadr_sin), stoa(&rbufp->recv_srcadr));
+ return;
+ }
if (has_mac == 0) {
restrict_mask &= ~RES_MSSNTP;
@@ -777,7 +869,7 @@ receive(
authlen,
ntohl(pkt->org.l_ui), ntohl(pkt->org.l_uf),
ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf)));
- } else if (has_mac == 4) {
+ } else if (crypto_nak_test == VALIDNAK) {
restrict_mask &= ~RES_MSSNTP;
is_authentic = AUTH_CRYPTO; /* crypto-NAK */
DPRINTF(2, ("receive: at %ld %s<-%s mode %d/%s:%s keyid %08x len %d auth %d org %#010x.%08x xmt %#010x.%08x MAC4\n",
@@ -1144,7 +1236,7 @@ receive(
/*
* Determine whether to execute the initial volley.
*/
- if (sys_bdelay != 0) {
+ if (sys_bdelay > 0.0) {
#ifdef AUTOKEY
/*
* If a two-way exchange is not possible,
@@ -1303,9 +1395,9 @@ receive(
#endif /* AUTOKEY */
if (MODE_BROADCAST == hismode) {
- u_char poll;
- int bail = 0;
- l_fp tdiff;
+ int bail = 0;
+ l_fp tdiff;
+ u_long deadband;
DPRINTF(2, ("receive: PROCPKT/BROADCAST: prev pkt %ld seconds ago, ppoll: %d, %d secs\n",
(current_time - peer->timelastrec),
@@ -1327,27 +1419,28 @@ receive(
peer->ppoll, pkt->ppoll);
}
- poll = min(peer->maxpoll,
- max(peer->minpoll, pkt->ppoll));
-
/* This is error-worthy */
- if (pkt->ppoll != poll) {
+ if (pkt->ppoll < peer->minpoll ||
+ pkt->ppoll > peer->maxpoll ) {
msyslog(LOG_INFO, "receive: broadcast poll of %ud from %s is out-of-range (%d to %d)!",
pkt->ppoll, stoa(&rbufp->recv_srcadr),
peer->minpoll, peer->maxpoll);
++bail;
}
- if ( (current_time - peer->timelastrec)
- < (1 << pkt->ppoll)) {
- msyslog(LOG_INFO, "receive: broadcast packet from %s arrived after %ld, not %d seconds!",
+ /* too early? worth an error, too! */
+ deadband = (1u << pkt->ppoll);
+ if (FLAG_BC_VOL & peer->flags)
+ deadband -= 3; /* allow greater fuzz after volley */
+ if ((current_time - peer->timelastrec) < deadband) {
+ msyslog(LOG_INFO, "receive: broadcast packet from %s arrived after %lu, not %lu seconds!",
stoa(&rbufp->recv_srcadr),
(current_time - peer->timelastrec),
- (1 << pkt->ppoll)
- );
+ deadband);
++bail;
}
+ /* Alert if time from the server is non-monotonic */
tdiff = p_xmt;
L_SUB(&tdiff, &peer->bxmt);
if (tdiff.l_i < 0) {
@@ -1401,6 +1494,7 @@ receive(
return;
}
#endif /* AUTOKEY */
+
peer->received++;
peer->flash &= ~PKT_TEST_MASK;
if (peer->flags & FLAG_XBOGUS) {
@@ -1412,12 +1506,22 @@ receive(
* Next comes a rigorous schedule of timestamp checking. If the
* transmit timestamp is zero, the server has not initialized in
* interleaved modes or is horribly broken.
+ *
+ * A KoD packet we pay attention to cannot have a 0 transmit
+ * timestamp.
*/
if (L_ISZERO(&p_xmt)) {
peer->flash |= TEST3; /* unsynch */
+ if (0 == hisstratum) { /* KoD packet */
+ peer->bogusorg++; /* for TEST2 or TEST3 */
+ msyslog(LOG_INFO,
+ "receive: Unexpected zero transmit timestamp in KoD from %s",
+ ntoa(&peer->srcadr));
+ return;
+ }
/*
- * If the transmit timestamp duplicates a previous one, the
+ * If the transmit timestamp duplicates our previous one, the
* packet is a replay. This prevents the bad guys from replaying
* the most recent packet, authenticated or not.
*/
@@ -1442,14 +1546,66 @@ receive(
}
/*
+ * Basic KoD validation checking:
+ *
+ * KoD packets are a mixed-blessing. Forged KoD packets
+ * are DoS attacks. There are rare situations where we might
+ * get a valid KoD response, though. Since KoD packets are
+ * a special case that complicate the checks we do next, we
+ * handle the basic KoD checks here.
+ *
+ * Note that we expect the incoming KoD packet to have its
+ * (nonzero) org, rec, and xmt timestamps set to the xmt timestamp
+ * that we have previously sent out. Watch interleave mode.
+ */
+ } else if (0 == hisstratum) {
+ DEBUG_INSIST(!L_ISZERO(&p_xmt));
+ if ( L_ISZERO(&p_org) /* We checked p_xmt above */
+ || L_ISZERO(&p_rec)) {
+ peer->bogusorg++;
+ msyslog(LOG_INFO,
+ "receive: KoD packet from %s has a zero org or rec timestamp. Ignoring.",
+ ntoa(&peer->srcadr));
+ return;
+ }
+
+ if ( !L_ISEQU(&p_xmt, &p_org)
+ || !L_ISEQU(&p_xmt, &p_rec)) {
+ peer->bogusorg++;
+ msyslog(LOG_INFO,
+ "receive: KoD packet from %s has inconsistent xmt/org/rec timestamps. Ignoring.",
+ ntoa(&peer->srcadr));
+ return;
+ }
+
+ /* Be conservative */
+ if (peer->flip == 0 && !L_ISEQU(&p_org, &peer->aorg)) {
+ peer->bogusorg++;
+ msyslog(LOG_INFO,
+ "receive: flip 0 KoD origin timestamp %#010x.%08x from %s does not match %#010x.%08x - ignoring.",
+ p_org.l_ui, p_org.l_uf,
+ ntoa(&peer->srcadr),
+ peer->aorg.l_ui, peer->aorg.l_uf);
+ return;
+ } else if (peer->flip == 1 && !L_ISEQU(&p_org, &peer->borg)) {
+ peer->bogusorg++;
+ msyslog(LOG_INFO,
+ "receive: flip 1 KoD origin timestamp %#010x.%08x from %s does not match interleave %#010x.%08x - ignoring.",
+ p_org.l_ui, p_org.l_uf,
+ ntoa(&peer->srcadr),
+ peer->borg.l_ui, peer->borg.l_uf);
+ return;
+ }
+
+ /*
* Basic mode checks:
*
* If there is no origin timestamp, it's either an initial packet
* or we've already received a response to our query. Of course,
* should 'aorg' be all-zero because this really was the original
- * transmit timestamp, we'll drop the reply. There is a window of
- * one nanosecond once every 136 years' time where this is possible.
- * We currently ignore this situation.
+ * transmit timestamp, we'll ignore this reply. There is a window
+ * of one nanosecond once every 136 years' time where this is
+ * possible. We currently ignore this situation.
*
* Otherwise, check for bogus packet in basic mode.
* If it is bogus, switch to interleaved mode and resynchronize,
@@ -1460,24 +1616,37 @@ receive(
* be from us, attempting to cause our server to KoD us.
*/
} else if (peer->flip == 0) {
- if (0 < hisstratum && L_ISZERO(&p_org)) {
+ INSIST(0 != hisstratum);
+ if (0) {
+ } else if (L_ISZERO(&p_org)) {
+ msyslog(LOG_INFO,
+ "receive: Got 0 origin timestamp from %s@%s xmt %#010x.%08x",
+ hm_str, ntoa(&peer->srcadr),
+ ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf));
L_CLR(&peer->aorg);
- } else if ( L_ISZERO(&peer->aorg)
- || !L_ISEQU(&p_org, &peer->aorg)) {
+ } else if (!L_ISEQU(&p_org, &peer->aorg)) {
+ /* are there cases here where we should bail? */
+ /* Should we set TEST2 if we decide to try xleave? */
peer->bogusorg++;
peer->flash |= TEST2; /* bogus */
msyslog(LOG_INFO,
- "receive: Unexpected origin timestamp %#010x.%08x from %s xmt %#010x.%08x",
+ "receive: Unexpected origin timestamp %#010x.%08x does not match aorg %#010x.%08x from %s@%s xmt %#010x.%08x",
ntohl(pkt->org.l_ui), ntohl(pkt->org.l_uf),
- ntoa(&peer->srcadr),
+ peer->aorg.l_ui, peer->aorg.l_uf,
+ hm_str, ntoa(&peer->srcadr),
ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf));
if ( !L_ISZERO(&peer->dst)
&& L_ISEQU(&p_org, &peer->dst)) {
/* Might be the start of an interleave */
- peer->flip = 1;
- report_event(PEVNT_XLEAVE, peer, NULL);
+ if (dynamic_interleave) {
+ peer->flip = 1;
+ report_event(PEVNT_XLEAVE, peer, NULL);
+ } else {
+ msyslog(LOG_INFO,
+ "receive: Dynamic interleave from %s@%s denied",
+ hm_str, ntoa(&peer->srcadr));
+ }
}
- return; /* Bogus or possible interleave packet */
} else {
L_CLR(&peer->aorg);
}
@@ -1507,7 +1676,7 @@ receive(
* client packet. The server might have just changed keys. Clear
* the association and restart the protocol.
*/
- if (is_authentic == AUTH_CRYPTO) {
+ if (crypto_nak_test == VALIDNAK) {
report_event(PEVNT_AUTH, peer, "crypto_NAK");
peer->flash |= TEST5; /* bad auth */
peer->badauth++;
@@ -1600,17 +1769,22 @@ receive(
/*
* If:
* - this is a *cast (uni-, broad-, or m-) server packet
- * - and it's authenticated
+ * - and it's symmetric-key authenticated
* then see if the sender's IP is trusted for this keyid.
* If it is, great - nothing special to do here.
* Otherwise, we should report and bail.
+ *
+ * Autokey-authenticated packets are accepted.
*/
switch (hismode) {
case MODE_SERVER: /* server mode */
case MODE_BROADCAST: /* broadcast mode */
case MODE_ACTIVE: /* symmetric active mode */
+ case MODE_PASSIVE: /* symmetric passive mode */
if ( is_authentic == AUTH_OK
+ && skeyid
+ && skeyid <= NTP_MAXKEY
&& !authistrustedip(skeyid, &peer->srcadr)) {
report_event(PEVNT_AUTH, peer, "authIP");
peer->badauth++;
@@ -1618,8 +1792,6 @@ receive(
}
break;
- case MODE_UNSPEC: /* unspecified (old version) */
- case MODE_PASSIVE: /* symmetric passive mode */
case MODE_CLIENT: /* client mode */
#if 0 /* At this point, MODE_CONTROL is overloaded by MODE_BCLIENT */
case MODE_CONTROL: /* control mode */
@@ -1627,7 +1799,12 @@ receive(
case MODE_PRIVATE: /* private mode */
case MODE_BCLIENT: /* broadcast client mode */
break;
+
+ case MODE_UNSPEC: /* unspecified (old version) */
default:
+ msyslog(LOG_INFO,
+ "receive: Unexpected mode (%d) in packet from %s",
+ hismode, ntoa(&peer->srcadr));
break;
}
@@ -1958,6 +2135,9 @@ process_packet(
peer->aorg = p_xmt;
peer->borg = peer->dst;
if (t34 < 0 || t34 > 1.) {
+ /* drop all if in the initial volley */
+ if (FLAG_BC_VOL & peer->flags)
+ goto bcc_init_volley_fail;
snprintf(statstr, sizeof(statstr),
"offset %.6f delay %.6f", t21, t34);
report_event(PEVNT_XERR, peer, statstr);
@@ -1983,11 +2163,23 @@ process_packet(
* between the unicast timestamp and the broadcast
* timestamp. This works for both basic and interleaved
* modes.
+ * [Bug 3031] Don't keep this peer when the delay
+ * calculation gives reason to suspect clock steps.
+ * This is assumed for delays > 50ms.
*/
if (FLAG_BC_VOL & peer->flags) {
peer->flags &= ~FLAG_BC_VOL;
peer->delay = fabs(peer->offset - p_offset) * 2;
+ DPRINTF(2, ("broadcast volley: initial delay=%.6f\n",
+ peer->delay));
+ if (peer->delay > fabs(sys_bdelay)) {
+ bcc_init_volley_fail:
+ DPRINTF(2, ("%s", "broadcast volley: initial delay exceeds limit\n"));
+ unpeer(peer);
+ return;
+ }
}
+ peer->nextdate = current_time + (1u << peer->ppoll) - 2u;
p_del = peer->delay;
p_offset += p_del / 2;
@@ -4018,6 +4210,7 @@ group_test(
}
#endif /* AUTOKEY */
+
#ifdef WORKER
void
pool_name_resolved(
@@ -4333,7 +4526,7 @@ init_proto(void)
sys_survivors = 0;
sys_manycastserver = 0;
sys_bclient = 0;
- sys_bdelay = 0;
+ sys_bdelay = BDELAY_DEFAULT; /*[Bug 3031] delay cutoff */
sys_authenticate = 1;
sys_stattime = current_time;
orphwait = current_time + sys_orphwait;
@@ -4426,7 +4619,7 @@ proto_config(
break;
case PROTO_BROADDELAY: /* default broadcast delay (bdelay) */
- sys_bdelay = dvalue;
+ sys_bdelay = (dvalue ? dvalue : BDELAY_DEFAULT);
break;
case PROTO_CEILING: /* stratum ceiling (ceiling) */
diff --git a/contrib/ntp/ntpd/ntp_request.c b/contrib/ntp/ntpd/ntp_request.c
index ba968e2..5e0e6f8 100644
--- a/contrib/ntp/ntpd/ntp_request.c
+++ b/contrib/ntp/ntpd/ntp_request.c
@@ -1342,11 +1342,38 @@ do_conf(
peeraddr.sa.sa_len = SOCKLEN(&peeraddr);
#endif
- /* XXX W2DO? minpoll/maxpoll arguments ??? */
+ /* check mode value: 0 <= hmode <= 6
+ *
+ * There's no good global define for that limit, and
+ * using a magic define is as good (or bad, actually) as
+ * a magic number. So we use the highest possible peer
+ * mode, and that is MODE_BCLIENT.
+ *
+ * [Bug 3009] claims that a problem occurs for hmode > 7,
+ * but the code in ntp_peer.c indicates trouble for any
+ * hmode > 6 ( --> MODE_BCLIENT).
+ */
+ if (temp_cp.hmode > MODE_BCLIENT) {
+ req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
+ return;
+ }
+
+ /* Any more checks on the values? Unchecked at this
+ * point:
+ * - version
+ * - ttl
+ * - keyid
+ *
+ * - minpoll/maxpoll, but they are treated properly
+ * for all cases internally. Checking not necessary.
+ */
+
+ /* finally create the peer */
if (peer_config(&peeraddr, NULL, NULL,
temp_cp.hmode, temp_cp.version, temp_cp.minpoll,
temp_cp.maxpoll, fl, temp_cp.ttl, temp_cp.keyid,
- NULL) == 0) {
+ NULL) == 0)
+ {
req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA);
return;
}
@@ -1373,103 +1400,73 @@ do_unconf(
struct conf_unpeer temp_cp;
struct peer * p;
sockaddr_u peeraddr;
- int bad;
- int found;
+ int loops;
/*
* This is a bit unstructured, but I like to be careful.
* We check to see that every peer exists and is actually
* configured. If so, we remove them. If not, we return
* an error.
+ *
+ * [Bug 3011] Even if we checked all peers given in the request
+ * in a dry run, there's still a chance that the caller played
+ * unfair and gave the same peer multiple times. So we still
+ * have to be prepared for nasty surprises in the second run ;)
*/
- items = INFO_NITEMS(inpkt->err_nitems);
+
+ /* basic consistency checks */
item_sz = INFO_ITEMSIZE(inpkt->mbz_itemsize);
- datap = inpkt->u.data;
if (item_sz > sizeof(temp_cp)) {
req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
return;
}
- bad = FALSE;
- while (items-- > 0 && !bad) {
- ZERO(temp_cp);
- memcpy(&temp_cp, datap, item_sz);
- ZERO_SOCK(&peeraddr);
- if (client_v6_capable && temp_cp.v6_flag) {
- AF(&peeraddr) = AF_INET6;
- SOCK_ADDR6(&peeraddr) = temp_cp.peeraddr6;
- } else {
- AF(&peeraddr) = AF_INET;
- NSRCADR(&peeraddr) = temp_cp.peeraddr;
- }
- SET_PORT(&peeraddr, NTP_PORT);
-#ifdef ISC_PLATFORM_HAVESALEN
- peeraddr.sa.sa_len = SOCKLEN(&peeraddr);
-#endif
- found = FALSE;
- p = NULL;
-
- DPRINTF(1, ("searching for %s\n", stoa(&peeraddr)));
-
- while (!found) {
- p = findexistingpeer(&peeraddr, NULL, p, -1, 0);
- if (NULL == p)
- break;
- if (FLAG_CONFIG & p->flags)
- found = TRUE;
- }
- if (!found)
- bad = TRUE;
-
- datap += item_sz;
- }
-
- if (bad) {
- req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA);
- return;
- }
-
- /*
- * Now do it in earnest.
- */
-
- items = INFO_NITEMS(inpkt->err_nitems);
- datap = inpkt->u.data;
-
- while (items-- > 0) {
- ZERO(temp_cp);
- memcpy(&temp_cp, datap, item_sz);
- ZERO(peeraddr);
- if (client_v6_capable && temp_cp.v6_flag) {
- AF(&peeraddr) = AF_INET6;
- SOCK_ADDR6(&peeraddr) = temp_cp.peeraddr6;
- } else {
- AF(&peeraddr) = AF_INET;
- NSRCADR(&peeraddr) = temp_cp.peeraddr;
- }
- SET_PORT(&peeraddr, NTP_PORT);
+ /* now do two runs: first a dry run, then a busy one */
+ for (loops = 0; loops != 2; ++loops) {
+ items = INFO_NITEMS(inpkt->err_nitems);
+ datap = inpkt->u.data;
+ while (items-- > 0) {
+ /* copy from request to local */
+ ZERO(temp_cp);
+ memcpy(&temp_cp, datap, item_sz);
+ /* get address structure */
+ ZERO_SOCK(&peeraddr);
+ if (client_v6_capable && temp_cp.v6_flag) {
+ AF(&peeraddr) = AF_INET6;
+ SOCK_ADDR6(&peeraddr) = temp_cp.peeraddr6;
+ } else {
+ AF(&peeraddr) = AF_INET;
+ NSRCADR(&peeraddr) = temp_cp.peeraddr;
+ }
+ SET_PORT(&peeraddr, NTP_PORT);
#ifdef ISC_PLATFORM_HAVESALEN
- peeraddr.sa.sa_len = SOCKLEN(&peeraddr);
+ peeraddr.sa.sa_len = SOCKLEN(&peeraddr);
#endif
- found = FALSE;
- p = NULL;
-
- while (!found) {
- p = findexistingpeer(&peeraddr, NULL, p, -1, 0);
- if (NULL == p)
- break;
- if (FLAG_CONFIG & p->flags)
- found = TRUE;
+ DPRINTF(1, ("searching for %s\n",
+ stoa(&peeraddr)));
+
+ /* search for matching configred(!) peer */
+ p = NULL;
+ do {
+ p = findexistingpeer(
+ &peeraddr, NULL, p, -1, 0);
+ } while (p && !(FLAG_CONFIG & p->flags));
+
+ if (!loops && !p) {
+ /* Item not found in dry run -- bail! */
+ req_ack(srcadr, inter, inpkt,
+ INFO_ERR_NODATA);
+ return;
+ } else if (loops && p) {
+ /* Item found in busy run -- remove! */
+ peer_clear(p, "GONE");
+ unpeer(p);
+ }
+ datap += item_sz;
}
- INSIST(found);
- INSIST(NULL != p);
-
- peer_clear(p, "GONE");
- unpeer(p);
-
- datap += item_sz;
}
+ /* report success */
req_ack(srcadr, inter, inpkt, INFO_OKAY);
}
@@ -2297,34 +2294,62 @@ do_setclr_trap(
return;
}
-
-
/*
- * set_request_keyid - set the keyid used to authenticate requests
+ * Validate a request packet for a new request or control key:
+ * - only one item allowed
+ * - key must be valid (that is, known, and not in the autokey range)
*/
static void
-set_request_keyid(
- sockaddr_u *srcadr,
- endpt *inter,
+set_keyid_checked(
+ keyid_t *into,
+ const char *what,
+ sockaddr_u *srcadr,
+ endpt *inter,
struct req_pkt *inpkt
)
{
keyid_t *pkeyid;
+ keyid_t tmpkey;
- /*
- * Restrict ourselves to one item only.
- */
+ /* restrict ourselves to one item only */
if (INFO_NITEMS(inpkt->err_nitems) > 1) {
- msyslog(LOG_ERR, "set_request_keyid: err_nitems > 1");
+ msyslog(LOG_ERR, "set_keyid_checked[%s]: err_nitems > 1",
+ what);
req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
return;
}
+ /* plug the new key from the packet */
pkeyid = (keyid_t *)&inpkt->u;
- info_auth_keyid = ntohl(*pkeyid);
+ tmpkey = ntohl(*pkeyid);
+
+ /* validate the new key id, claim data error on failure */
+ if (tmpkey < 1 || tmpkey > NTP_MAXKEY || !auth_havekey(tmpkey)) {
+ msyslog(LOG_ERR, "set_keyid_checked[%s]: invalid key id: %ld",
+ what, (long)tmpkey);
+ req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA);
+ return;
+ }
+
+ /* if we arrive here, the key is good -- use it */
+ *into = tmpkey;
req_ack(srcadr, inter, inpkt, INFO_OKAY);
}
+/*
+ * set_request_keyid - set the keyid used to authenticate requests
+ */
+static void
+set_request_keyid(
+ sockaddr_u *srcadr,
+ endpt *inter,
+ struct req_pkt *inpkt
+ )
+{
+ set_keyid_checked(&info_auth_keyid, "request",
+ srcadr, inter, inpkt);
+}
+
/*
@@ -2337,20 +2362,8 @@ set_control_keyid(
struct req_pkt *inpkt
)
{
- keyid_t *pkeyid;
-
- /*
- * Restrict ourselves to one item only.
- */
- if (INFO_NITEMS(inpkt->err_nitems) > 1) {
- msyslog(LOG_ERR, "set_control_keyid: err_nitems > 1");
- req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
- return;
- }
-
- pkeyid = (keyid_t *)&inpkt->u;
- ctl_auth_keyid = ntohl(*pkeyid);
- req_ack(srcadr, inter, inpkt, INFO_OKAY);
+ set_keyid_checked(&ctl_auth_keyid, "control",
+ srcadr, inter, inpkt);
}
diff --git a/contrib/ntp/ntpd/ntp_timer.c b/contrib/ntp/ntpd/ntp_timer.c
index 78c81b6..9ee35f8 100644
--- a/contrib/ntp/ntpd/ntp_timer.c
+++ b/contrib/ntp/ntpd/ntp_timer.c
@@ -276,6 +276,12 @@ intres_timeout_req(
u_int seconds /* 0 cancels */
)
{
+#if defined(HAVE_DROPROOT) && defined(NEED_EARLY_FORK)
+ if (droproot) {
+ worker_idle_timer = 0;
+ return;
+ }
+#endif
if (0 == seconds) {
worker_idle_timer = 0;
return;
diff --git a/contrib/ntp/ntpd/ntpd-opts.c b/contrib/ntp/ntpd/ntpd-opts.c
index f435a31..3e9a5c3 100644
--- a/contrib/ntp/ntpd/ntpd-opts.c
+++ b/contrib/ntp/ntpd/ntpd-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpd-opts.c)
*
- * It has been AutoGen-ed January 20, 2016 at 04:15:45 AM by AutoGen 5.18.5
+ * It has been AutoGen-ed April 26, 2016 at 08:26:14 PM by AutoGen 5.18.5
* From the definitions ntpd-opts.def
* and the template file options
*
@@ -75,7 +75,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpd options
*/
static char const ntpd_opt_strs[3129] =
-/* 0 */ "ntpd 4.2.8p6\n"
+/* 0 */ "ntpd 4.2.8p7\n"
"Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -205,12 +205,12 @@ static char const ntpd_opt_strs[3129] =
/* 2900 */ "output version information and exit\0"
/* 2936 */ "version\0"
/* 2944 */ "NTPD\0"
-/* 2949 */ "ntpd - NTP daemon program - Ver. 4.2.8p6\n"
+/* 2949 */ "ntpd - NTP daemon program - Ver. 4.2.8p7\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n"
"\t\t[ <server1> ... <serverN> ]\n\0"
/* 3080 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 3114 */ "\n\0"
-/* 3116 */ "ntpd 4.2.8p6";
+/* 3116 */ "ntpd 4.2.8p7";
/**
* ipv4 option description with
@@ -1529,7 +1529,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpdOptions.pzCopyright */
- puts(_("ntpd 4.2.8p6\n\
+ puts(_("ntpd 4.2.8p7\n\
Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -1670,7 +1670,7 @@ implied warranty.\n"));
puts(_("output version information and exit"));
/* referenced via ntpdOptions.pzUsageTitle */
- puts(_("ntpd - NTP daemon program - Ver. 4.2.8p6\n\
+ puts(_("ntpd - NTP daemon program - Ver. 4.2.8p7\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
\t\t[ <server1> ... <serverN> ]\n"));
@@ -1678,7 +1678,7 @@ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
puts(_("\n"));
/* referenced via ntpdOptions.pzFullVersion */
- puts(_("ntpd 4.2.8p6"));
+ puts(_("ntpd 4.2.8p7"));
/* referenced via ntpdOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/ntpd/ntpd-opts.h b/contrib/ntp/ntpd/ntpd-opts.h
index 9427cac..818a531 100644
--- a/contrib/ntp/ntpd/ntpd-opts.h
+++ b/contrib/ntp/ntpd/ntpd-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpd-opts.h)
*
- * It has been AutoGen-ed January 20, 2016 at 04:15:43 AM by AutoGen 5.18.5
+ * It has been AutoGen-ed April 26, 2016 at 08:26:13 PM by AutoGen 5.18.5
* From the definitions ntpd-opts.def
* and the template file options
*
@@ -106,9 +106,9 @@ typedef enum {
/** count of all options for ntpd */
#define OPTION_CT 38
/** ntpd version */
-#define NTPD_VERSION "4.2.8p6"
+#define NTPD_VERSION "4.2.8p7"
/** Full ntpd version text */
-#define NTPD_FULL_VERSION "ntpd 4.2.8p6"
+#define NTPD_FULL_VERSION "ntpd 4.2.8p7"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/ntpd/ntpd.1ntpdman b/contrib/ntp/ntpd/ntpd.1ntpdman
index 322d0bc4..03a3a1c 100644
--- a/contrib/ntp/ntpd/ntpd.1ntpdman
+++ b/contrib/ntp/ntpd/ntpd.1ntpdman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpd 1ntpdman "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH ntpd 1ntpdman "26 Apr 2016" "4.2.8p7" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-9JaiRS/ag-jKaaQS)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-0uayDF/ag-avaqCF)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:17:54 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:23 PM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpd/ntpd.1ntpdmdoc b/contrib/ntp/ntpd/ntpd.1ntpdmdoc
index 301d983..da8bf97 100644
--- a/contrib/ntp/ntpd/ntpd.1ntpdmdoc
+++ b/contrib/ntp/ntpd/ntpd.1ntpdmdoc
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
.Dt NTPD 1ntpdmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:18:12 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:41 PM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntpd.c b/contrib/ntp/ntpd/ntpd.c
index 2c7f02e..9c6f947 100644
--- a/contrib/ntp/ntpd/ntpd.c
+++ b/contrib/ntp/ntpd/ntpd.c
@@ -332,6 +332,16 @@ my_pthread_warmup(void)
#endif /*defined(NEED_PTHREAD_WARMUP)*/
+#ifdef NEED_EARLY_FORK
+static void
+dummy_callback(void) { return; }
+
+static void
+fork_nonchroot_worker(void) {
+ getaddrinfo_sometime("localhost", "ntp", NULL, INITIAL_DNS_RETRY,
+ (gai_sometime_callback)&dummy_callback, NULL);
+}
+#endif /* NEED_EARLY_FORK */
void
parse_cmdline_opts(
@@ -931,6 +941,11 @@ ntpdmain(
# ifdef HAVE_DROPROOT
if (droproot) {
+
+#ifdef NEED_EARLY_FORK
+ fork_nonchroot_worker();
+#endif
+
/* Drop super-user privileges and chroot now if the OS supports this */
# ifdef HAVE_LINUX_CAPABILITIES
diff --git a/contrib/ntp/ntpd/ntpd.html b/contrib/ntp/ntpd/ntpd.html
index bdf58a1..8c5c2be 100644
--- a/contrib/ntp/ntpd/ntpd.html
+++ b/contrib/ntp/ntpd/ntpd.html
@@ -39,7 +39,7 @@ The program can operate in any of several modes, including client/server,
symmetric and broadcast modes, and with both symmetric-key and public-key
cryptography.
- <p>This document applies to version 4.2.8p6 of <code>ntpd</code>.
+ <p>This document applies to version 4.2.8p7 of <code>ntpd</code>.
<ul class="menu">
<li><a accesskey="1" href="#ntpd-Description">ntpd Description</a>: Description
@@ -220,7 +220,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntpd - NTP daemon program - Ver. 4.2.8p5
+<pre class="example">ntpd - NTP daemon program - Ver. 4.2.8p6
Usage: ntpd [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... \
[ &lt;server1&gt; ... &lt;serverN&gt; ]
Flg Arg Option-Name Description
diff --git a/contrib/ntp/ntpd/ntpd.man.in b/contrib/ntp/ntpd/ntpd.man.in
index 4abcc57..37ccedb 100644
--- a/contrib/ntp/ntpd/ntpd.man.in
+++ b/contrib/ntp/ntpd/ntpd.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpd @NTPD_MS@ "20 Jan 2016" "4.2.8p6" "User Commands"
+.TH ntpd @NTPD_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-9JaiRS/ag-jKaaQS)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-0uayDF/ag-avaqCF)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:17:54 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:23 PM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpd/ntpd.mdoc.in b/contrib/ntp/ntpd/ntpd.mdoc.in
index fcd5fc1..9aa8770 100644
--- a/contrib/ntp/ntpd/ntpd.mdoc.in
+++ b/contrib/ntp/ntpd/ntpd.mdoc.in
@@ -1,9 +1,9 @@
-.Dd January 20 2016
+.Dd April 26 2016
.Dt NTPD @NTPD_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed January 20, 2016 at 04:18:12 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed April 26, 2016 at 08:28:41 PM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
OpenPOWER on IntegriCloud