]> git.ipfire.org Git - thirdparty/chrony.git/log
thirdparty/chrony.git
5 years agosources: add more assertions
Miroslav Lichvar [Thu, 4 Jun 2020 07:49:17 +0000 (09:49 +0200)] 
sources: add more assertions

5 years agosources: check for negative distance
Miroslav Lichvar [Thu, 4 Jun 2020 07:35:52 +0000 (09:35 +0200)] 
sources: check for negative distance

This is not expected to happen, but make sure the endpoints of each
source are in the right order (i.e. the distance is not negative) to
prevent getting a negative depth in the selection.

5 years agosources: require majority for trusted sources
Miroslav Lichvar [Tue, 2 Jun 2020 16:54:41 +0000 (18:54 +0200)] 
sources: require majority for trusted sources

Handle trusted sources as a separate set of sources which is required to
have a majority for the selection to proceed. This should improve the
selection with multiple trusted sources (e.g. due to the auth selection
mode).

5 years agosources: relax selection of non-trusted sources
Miroslav Lichvar [Tue, 2 Jun 2020 16:06:46 +0000 (18:06 +0200)] 
sources: relax selection of non-trusted sources

When the selection has some trusted sources, don't require non-trusted
sources to be contained in the best interval as that can usually pass
only one source if the best interval is the interval of the source, or
no source at all if the best interval is an intersection of multiple
sources.

Relax the requirement for non-trusted sources to be contained in the
best interval of trusted sources alone instead of all sources in the
trusted interval.

5 years agosources: extend mark debug message
Miroslav Lichvar [Tue, 2 Jun 2020 16:05:43 +0000 (18:05 +0200)] 
sources: extend mark debug message

5 years agosources: include hostname in selection log message
Miroslav Lichvar [Mon, 1 Jun 2020 15:22:58 +0000 (17:22 +0200)] 
sources: include hostname in selection log message

When selecting an NTP source, include the hostname in the log message.

5 years agocmdmon: update protocol changelog
Miroslav Lichvar [Wed, 3 Jun 2020 10:37:45 +0000 (12:37 +0200)] 
cmdmon: update protocol changelog

5 years agocmdmon: add selectdata command
Miroslav Lichvar [Mon, 25 May 2020 12:10:40 +0000 (14:10 +0200)] 
cmdmon: add selectdata command

Add a command to report selection-specific data.

5 years agocmdmon: don't report selection options in source report
Miroslav Lichvar [Mon, 25 May 2020 11:58:00 +0000 (13:58 +0200)] 
cmdmon: don't report selection options in source report

The selection options returned as flags are not reported by the
client and will be better reported in a separate command with other
selection-specific data.

5 years agoclient: fix help message to indicate mask is optional
Miroslav Lichvar [Mon, 25 May 2020 12:06:08 +0000 (14:06 +0200)] 
client: fix help message to indicate mask is optional

5 years agotest: add 140-noclientlog test
Miroslav Lichvar [Thu, 21 May 2020 14:19:59 +0000 (16:19 +0200)] 
test: add 140-noclientlog test

5 years agoclientlog: fix check for ratelimit and noclientlog
Miroslav Lichvar [Thu, 21 May 2020 14:07:52 +0000 (16:07 +0200)] 
clientlog: fix check for ratelimit and noclientlog

Fixes: 3a2d33d5a37c ("clientlog: refactor client record and API")
5 years agodoc: improve answer for chronyc error in FAQ
Miroslav Lichvar [Thu, 21 May 2020 10:42:20 +0000 (12:42 +0200)] 
doc: improve answer for chronyc error in FAQ

5 years agolocal: don't remove handlers in finalization
Miroslav Lichvar [Thu, 21 May 2020 09:47:38 +0000 (11:47 +0200)] 
local: don't remove handlers in finalization

Require all handlers to be deregistered by their users before the local
finalization.

5 years agotest: check logs for assertion failures
Miroslav Lichvar [Thu, 21 May 2020 09:45:38 +0000 (11:45 +0200)] 
test: check logs for assertion failures

5 years agonts: free client cert credentials when not used
Miroslav Lichvar [Thu, 21 May 2020 08:49:26 +0000 (10:49 +0200)] 
nts: free client cert credentials when not used

Destroy the client cert credentials when destroying the last NKC
instance instead of NKC_Finalise(). This allows the client to reload the
trusted cert file between NTS-KE sessions.

5 years agonts: add debug messages for gnutls init/deinit
Miroslav Lichvar [Thu, 21 May 2020 08:48:51 +0000 (10:48 +0200)] 
nts: add debug messages for gnutls init/deinit

5 years agontp: change NSR_RemoveSource() to accept IP address only
Miroslav Lichvar [Wed, 20 May 2020 16:06:43 +0000 (18:06 +0200)] 
ntp: change NSR_RemoveSource() to accept IP address only

Change the function to accept IP address alone to make it clear that the
port is ignored.

5 years agontp: refactor slot finding
Miroslav Lichvar [Wed, 20 May 2020 15:47:16 +0000 (17:47 +0200)] 
ntp: refactor slot finding

Change the find_slot() function to not match port and return the found
status directly. Add a separate function for matching both address and
port.

5 years agoconf: replace empty strings with NULL
Miroslav Lichvar [Wed, 20 May 2020 14:20:43 +0000 (16:20 +0200)] 
conf: replace empty strings with NULL

Avoid mixing empty strings with NULLs in configuration strings to make
the handling of default or disabled values consistent.

5 years agoreference: fix offset sign in log message
Miroslav Lichvar [Wed, 20 May 2020 10:53:16 +0000 (12:53 +0200)] 
reference: fix offset sign in log message

In the maxchange check, log the original offset instead of the absolute
value.

5 years agoclientlog: add debug message for maximum number of records
Miroslav Lichvar [Wed, 20 May 2020 10:14:59 +0000 (12:14 +0200)] 
clientlog: add debug message for maximum number of records

5 years agocmdmon: report new client and server statistics
Miroslav Lichvar [Wed, 20 May 2020 10:02:03 +0000 (12:02 +0200)] 
cmdmon: report new client and server statistics

Report the new clientlog data in the clients and serverstats reports.

Add -k option to the clients command to select between command and
NTS-KE data.

5 years agoclientlog: count authenticated NTP requests
Miroslav Lichvar [Wed, 20 May 2020 08:49:45 +0000 (10:49 +0200)] 
clientlog: count authenticated NTP requests

5 years agoclientlog: add NTS-KE service
Miroslav Lichvar [Tue, 19 May 2020 12:22:00 +0000 (14:22 +0200)] 
clientlog: add NTS-KE service

Instead of sharing the NTP rate limiting with NTS-KE, specify a new
service for NTS-KE and use it in the NTS-KE server.

Add ntsratelimit directive for configuration.

5 years agoclientlog: refactor client record and API
Miroslav Lichvar [Tue, 19 May 2020 11:45:31 +0000 (13:45 +0200)] 
clientlog: refactor client record and API

Refactor the client record and clientlog API to reuse more code between
different services and enumerate the services instead of hardcoding NTP
and cmdmon.

5 years agoclientlog: fix time_t variables
Miroslav Lichvar [Tue, 19 May 2020 10:02:28 +0000 (12:02 +0200)] 
clientlog: fix time_t variables

The last_hit and oldest_hit timestamps are uint32_t, not time_t.

5 years agostubs: add NSR_GetAuthReport()
Miroslav Lichvar [Wed, 20 May 2020 15:35:08 +0000 (17:35 +0200)] 
stubs: add NSR_GetAuthReport()

Fixes: 79c7384e5e47 ("cmdmon: add authdata command")
5 years agosys_linux: allow some *time64 syscalls in seccomp filter
Vincent Blut [Thu, 14 May 2020 17:05:14 +0000 (19:05 +0200)] 
sys_linux: allow some *time64 syscalls in seccomp filter

These are needed for 32-bit architectures with new system calls using
64-bit time_t.

5 years agosys_linux: restructure syscalls in seccomp filter
Vincent Blut [Thu, 14 May 2020 16:10:22 +0000 (18:10 +0200)] 
sys_linux: restructure syscalls in seccomp filter

Having one syscall per line improves the seccomp filter reading. It
should also make updates more straightforward.

5 years agocmdmon: add cookie length to authdata report
Miroslav Lichvar [Mon, 18 May 2020 12:21:53 +0000 (14:21 +0200)] 
cmdmon: add cookie length to authdata report

5 years agocmdmon: limit reported clients by number of packets
Miroslav Lichvar [Mon, 18 May 2020 11:58:55 +0000 (13:58 +0200)] 
cmdmon: limit reported clients by number of packets

Add a new field to the CLIENT_ACCESSES_BY_INDEX request to specify the
minimum number of NTP or cmdmon packets for a client to be reported.

Add -p option to the chronyc clients command to specify the threshold
(by default 0). This option can be used to minimize the number of cmdmon
requests when interested only in clients sending a large number
of requests.

5 years agocmdmon: allow client records to be reset
Miroslav Lichvar [Mon, 18 May 2020 11:28:49 +0000 (13:28 +0200)] 
cmdmon: allow client records to be reset

Add a flag to the CLIENT_ACCESSES_BY_INDEX request to reset the
NTP/cmdmon hits/dropped counters after reporting the current values.

Add -r option to the chronyc clients command to perform the reset. This
should make it easier to find clients that send large number of requests
over short periods of time.

5 years agosources: ignore noselect sources when updating selection options
Miroslav Lichvar [Mon, 18 May 2020 10:06:27 +0000 (12:06 +0200)] 
sources: ignore noselect sources when updating selection options

Ignore any sources specified with the noselect option with respect to
the auth selection mode.

5 years agodoc: fix formatting of example in chrony.conf man page
Miroslav Lichvar [Thu, 14 May 2020 09:55:21 +0000 (11:55 +0200)] 
doc: fix formatting of example in chrony.conf man page

5 years agocmdmon: add authdata command
Miroslav Lichvar [Wed, 13 May 2020 14:54:55 +0000 (16:54 +0200)] 
cmdmon: add authdata command

Add a command to display information about authentication of NTP
sources.

5 years agonts: assign ID to NTS context
Miroslav Lichvar [Wed, 13 May 2020 14:26:56 +0000 (16:26 +0200)] 
nts: assign ID to NTS context

For monitoring purposes, assign an incrementing ID to the client NTS
context.

5 years agokeys: provide key type and length
Miroslav Lichvar [Wed, 13 May 2020 11:45:03 +0000 (13:45 +0200)] 
keys: provide key type and length

Save the type and length of each key and add a function to get this
information.

5 years agokeys: remove forgotten declaration
Miroslav Lichvar [Tue, 12 May 2020 13:38:37 +0000 (15:38 +0200)] 
keys: remove forgotten declaration

5 years agocmac: enumerate cipher algorithms
Miroslav Lichvar [Wed, 13 May 2020 11:35:52 +0000 (13:35 +0200)] 
cmac: enumerate cipher algorithms

Identify the CMAC ciphers with an enum instead of string.

5 years agohash: enumerate hash algorithms
Miroslav Lichvar [Wed, 13 May 2020 10:51:41 +0000 (12:51 +0200)] 
hash: enumerate hash algorithms

Identify the algorithms with an enum instead of string.

5 years agocmdmon: fix ntp_source_name declaration in request
Miroslav Lichvar [Tue, 12 May 2020 09:14:46 +0000 (11:14 +0200)] 
cmdmon: fix ntp_source_name declaration in request

Fixes: 93f6358916ca ("cmdmon: add request to get source name")
5 years agocmdmon: rename reset command to reset sources
Miroslav Lichvar [Tue, 12 May 2020 08:52:46 +0000 (10:52 +0200)] 
cmdmon: rename reset command to reset sources

Add a sources option for the reset command in case there are other
components that would need to be reset.

5 years agoreference: shorten logchange log message
Miroslav Lichvar [Mon, 11 May 2020 10:29:51 +0000 (12:29 +0200)] 
reference: shorten logchange log message

Remove the "adjustment started" part from the "System clock wrong by *
seconds, adjustment started" log message as it might be confusing in
some cases. There may be a step instead of a slow adjustment, or there
may be no adjustment at all when running with the -x option.

5 years agosocket: don't set interface for sent packets
Miroslav Lichvar [Mon, 11 May 2020 10:27:34 +0000 (12:27 +0200)] 
socket: don't set interface for sent packets

With asymmetric routing (e.g. with BGP) it may not be possible to
respond to a request using the same interface. In such case, setting the
interface index in IP*_PKTINFO* causes the packet to be silently dropped
by the kernel.

Until we can predict if sending with the specified interface will
succeed, or provide only a hint, don't set the interface and leave it
to the kernel to select an interface.

This reverts commit 5fc7674e366f ("ntp: set interface index in
IP*_PKTINFO when responding").

Reported-by: Arkadiusz Miƛkiewicz <arekm@maven.pl>
5 years agoconf: detect infinite inclusion
Miroslav Lichvar [Mon, 11 May 2020 10:20:06 +0000 (12:20 +0200)] 
conf: detect infinite inclusion

Don't allow more than 10 nested inclusions using the include or
confdirs directive to cleanly handle a misconfiguration with a circular
inclusion.

5 years agoconf: add better support for fragmented configuration
Miroslav Lichvar [Thu, 7 May 2020 11:04:26 +0000 (13:04 +0200)] 
conf: add better support for fragmented configuration

Add a confdirs directive to include *.conf files from multiple
directories. If a file with the same name exists in multiple
directories, only the first one in the order of the specified
directories will be included.

5 years agosources: improve and add more debug messages
Miroslav Lichvar [Wed, 6 May 2020 11:08:56 +0000 (13:08 +0200)] 
sources: improve and add more debug messages

5 years agosources: enable selection options with authentication
Miroslav Lichvar [Wed, 6 May 2020 11:02:45 +0000 (13:02 +0200)] 
sources: enable selection options with authentication

When authentication is enabled for an NTP source, unauthenticated NTP
sources need to be disabled or limited in selection. That might be
difficult to do when the configuration comes from different sources
(e.g. networking scripts adding servers from DHCP).

Define four modes for the source selection to consider authentication:
require, prefer, mix, ignore. In different modes different selection
options (require, trust, noselect) are added to authenticated and
unauthenticated sources.

The mode can be selected by the authselectmode directive. The mix mode
is the default. The ignore mode enables the old behavior, where all
sources are used exactly as specified in the configuration.

5 years agosources: allow modifications of selection options
Miroslav Lichvar [Mon, 4 May 2020 09:09:39 +0000 (11:09 +0200)] 
sources: allow modifications of selection options

Refactor the code to allow the selection options of the current sources
to be modified when other sources are added and removed. Also, make the
authentication status of each source available to the code which makes
the modifications.

5 years agosources: reformat forward prototypes
Miroslav Lichvar [Mon, 4 May 2020 09:05:36 +0000 (11:05 +0200)] 
sources: reformat forward prototypes

5 years agodoc: improve NEWS 4.0-pre2
Miroslav Lichvar [Mon, 20 Apr 2020 13:49:58 +0000 (15:49 +0200)] 
doc: improve NEWS

Add a notable enhancement from 4.0-pre1 and make the description of
another enhancement less ambiguous.

5 years agodoc: update README
Miroslav Lichvar [Mon, 20 Apr 2020 09:17:35 +0000 (11:17 +0200)] 
doc: update README

5 years agocheck return value of SCK_OpenUnixSocketPair()
Miroslav Lichvar [Mon, 20 Apr 2020 13:42:45 +0000 (15:42 +0200)] 
check return value of SCK_OpenUnixSocketPair()

5 years agosamplefilt: remove useless assignment
Miroslav Lichvar [Mon, 20 Apr 2020 13:41:25 +0000 (15:41 +0200)] 
samplefilt: remove useless assignment

5 years agodoc: update documentation for recent NTS changes
Miroslav Lichvar [Thu, 16 Apr 2020 15:26:25 +0000 (17:26 +0200)] 
doc: update documentation for recent NTS changes

5 years agonts: allow disabling certificate time checks
Miroslav Lichvar [Thu, 16 Apr 2020 14:08:43 +0000 (16:08 +0200)] 
nts: allow disabling certificate time checks

Add "nocerttimecheck" directive to specify the number of clock updates
that need to be made before the time validation of certificates is
enabled. This makes NTS usable on machines that don't have a RTC.

5 years agonts: provide time function to gnutls
Miroslav Lichvar [Thu, 16 Apr 2020 10:06:55 +0000 (12:06 +0200)] 
nts: provide time function to gnutls

Use the internal time instead of system time for validation checks in
gnutls.

5 years agonts: add server support for NTP server negotiation
Miroslav Lichvar [Wed, 15 Apr 2020 13:41:22 +0000 (15:41 +0200)] 
nts: add server support for NTP server negotiation

Add ntsntpserver directive to specify the hostname of the NTP server
provided in NTS-KE response to clients.

5 years agocmdmon: reload NTS server keys on rekey command
Miroslav Lichvar [Wed, 15 Apr 2020 09:52:49 +0000 (11:52 +0200)] 
cmdmon: reload NTS server keys on rekey command

When ntsrotate is set to 0, allow the keys to be reloaded with the rekey
command of chronyc.

5 years agonts: enable external management of server keys
Miroslav Lichvar [Wed, 15 Apr 2020 09:43:59 +0000 (11:43 +0200)] 
nts: enable external management of server keys

If ntsrotate is set to 0, don't generate new server keys and don't save
them to ntsdumpdir. This allows the keys to be managed externally and
shared with other servers.

5 years agonts: generate cookies from second newest key
Miroslav Lichvar [Wed, 15 Apr 2020 08:48:29 +0000 (10:48 +0200)] 
nts: generate cookies from second newest key

Generate one server key in advance to give it time to be distributed to
other servers before it is actually used.

5 years agonts: encode key ID in cookie in network order
Miroslav Lichvar [Wed, 15 Apr 2020 08:44:20 +0000 (10:44 +0200)] 
nts: encode key ID in cookie in network order

This allows the server cookie to be decoded on different platforms.

5 years agocmdmon: save NTS cookies and server keys on dump command
Miroslav Lichvar [Wed, 15 Apr 2020 08:12:55 +0000 (10:12 +0200)] 
cmdmon: save NTS cookies and server keys on dump command

Extend the dump command to save also the server NTS keys and client NTS
cookies. Remove the warning for unset dumpdir.

5 years agontp: update auth-specific address sooner
Miroslav Lichvar [Wed, 15 Apr 2020 14:26:43 +0000 (16:26 +0200)] 
ntp: update auth-specific address sooner

When replacing an NTP source, update the NTS address before the NTP
address to save cookies with the old NTP address instead of the newly
resolved address (which may immediately change to an address provided by
NTS-KE).

5 years agonts: update TLS exporter label
Miroslav Lichvar [Thu, 26 Mar 2020 14:37:08 +0000 (15:37 +0100)] 
nts: update TLS exporter label

Change the string to "EXPORTER-network-time-security" as specified in
the latest NTS draft.

5 years agotest: extend 139-nts test
Miroslav Lichvar [Thu, 9 Apr 2020 14:51:10 +0000 (16:51 +0200)] 
test: extend 139-nts test

5 years agonts: extend server key file format
Miroslav Lichvar [Thu, 9 Apr 2020 13:07:07 +0000 (15:07 +0200)] 
nts: extend server key file format

Include in the key dump file an identifier, the AEAD number, and the
age of the last key to improve robustness and avoid generating a new key
immediately on start.

Also, improve the code that saves and loads the file.

5 years agonts: save and load cookies on client
Miroslav Lichvar [Thu, 9 Apr 2020 08:33:55 +0000 (10:33 +0200)] 
nts: save and load cookies on client

Save the NTS context and cookies to files in the NTS dumpdir when the
client NTS instances are destroyed or the address is changed, and reload
the data to avoid unnecessary NTS-KE requests when chronyd is restarted
or it is switching between different addresses resolved from the NTS-KE
or NTP name.

5 years agonts: rename ntscachedir directive to ntsdumpdir
Miroslav Lichvar [Wed, 8 Apr 2020 13:51:41 +0000 (15:51 +0200)] 
nts: rename ntscachedir directive to ntsdumpdir

This makes the naming consistent with the existing dumpdir directive and
the dump command.

5 years agonts: refactor NTS context
Miroslav Lichvar [Mon, 30 Mar 2020 16:06:57 +0000 (18:06 +0200)] 
nts: refactor NTS context

Add a context structure for the algorithm and keys established by
NTS-KE. Modify the client to save the context and reset the SIV key to
the C2S/S2C key before each request/response instead of keeping two SIV
instances.

This will make it easier for the server to support different algorithms
and allow the client to save the context with cookies to disk.

5 years agonts: drop unused constant
Miroslav Lichvar [Thu, 26 Mar 2020 16:14:06 +0000 (17:14 +0100)] 
nts: drop unused constant

5 years agoutil: add function to split string into words
Miroslav Lichvar [Thu, 9 Apr 2020 07:59:39 +0000 (09:59 +0200)] 
util: add function to split string into words

5 years agoutil: constify input parameters
Miroslav Lichvar [Wed, 8 Apr 2020 13:16:18 +0000 (15:16 +0200)] 
util: constify input parameters

5 years agosources: constify parameters of log_selection_message()
Miroslav Lichvar [Wed, 8 Apr 2020 13:15:50 +0000 (15:15 +0200)] 
sources: constify parameters of log_selection_message()

5 years agodoc: add sourcename to list of remote commands
Miroslav Lichvar [Mon, 30 Mar 2020 08:37:17 +0000 (10:37 +0200)] 
doc: add sourcename to list of remote commands

5 years agonts: zero cookie placeholder
Miroslav Lichvar [Thu, 26 Mar 2020 14:30:28 +0000 (15:30 +0100)] 
nts: zero cookie placeholder

Zero the body of the cookie placeholder in client requests as
recommended by the latest NTS draft.

5 years agonts: disable TLS version 1.2
Miroslav Lichvar [Thu, 26 Mar 2020 14:18:08 +0000 (15:18 +0100)] 
nts: disable TLS version 1.2

Require TLS version 1.3 or later as specified in the latest NTS draft.

5 years agonts: rework NTS-KE retry interval
Miroslav Lichvar [Wed, 25 Mar 2020 16:01:27 +0000 (17:01 +0100)] 
nts: rework NTS-KE retry interval

Make the NTS-KE retry interval exponentially increasing, using a factor
provided by the NKE session. Use shorter intervals when the server is
refusing TCP connections or the connection is closed or timing out
before the TLS handshake.

5 years agonts: include server address in client NTS-KE log messages
Miroslav Lichvar [Mon, 23 Mar 2020 14:39:58 +0000 (15:39 +0100)] 
nts: include server address in client NTS-KE log messages

5 years agonts: fix address in server NTS-KE log messages
Miroslav Lichvar [Mon, 23 Mar 2020 14:34:08 +0000 (15:34 +0100)] 
nts: fix address in server NTS-KE log messages

The server session instances are reused for different clients. Separate
the server name from the label used in log messages and set it on each
start of the session.

5 years agontp: fix log message for replaced source
Miroslav Lichvar [Thu, 26 Mar 2020 10:51:17 +0000 (11:51 +0100)] 
ntp: fix log message for replaced source

When a source was replaced and the new source had the same slot as the
old source, a wrong message was logged. Fix the condition to distinguish
correctly between changed address and port.

Fixes: 9468fd4aa680 ("ntp: allow changing port of source")
5 years agoreference: improve check for close leap second
Miroslav Lichvar [Wed, 25 Mar 2020 08:12:35 +0000 (09:12 +0100)] 
reference: improve check for close leap second

Improve the check to work with the actual timestamp of the leap second
instead of the closest midnight and don't turn it off on the leap
timeout. Also allow sample times to be checked in addition to the system
time and NTP time to avoid accumulation of samples mixing pre-leap and
post-leap timestamps (causing error of +/-0.5 or +/-1.0 seconds).

5 years agosocket: remove obsolete comment
Miroslav Lichvar [Tue, 24 Mar 2020 14:46:34 +0000 (15:46 +0100)] 
socket: remove obsolete comment

5 years agosocket: fix severity check in debug logging
Miroslav Lichvar [Tue, 24 Mar 2020 14:29:21 +0000 (15:29 +0100)] 
socket: fix severity check in debug logging

Don't waste time formatting the debug message in log_message() when
debug output is disabled.

Fixes: 86a3ef9ed192 ("socket: add new socket support")
5 years agosocket: increase maximum number of received messages
Miroslav Lichvar [Tue, 24 Mar 2020 14:26:35 +0000 (15:26 +0100)] 
socket: increase maximum number of received messages

The buffers are no longer on stack. Increase their number for better
performance on heavily loaded servers.

5 years agosocket: simplify receiving messages
Miroslav Lichvar [Tue, 24 Mar 2020 14:22:31 +0000 (15:22 +0100)] 
socket: simplify receiving messages

Don't require the caller to provide a SCK_Message (on stack). Modify the
SCK_ReceiveMessage*() functions to return a pointer to static buffers,
as the message buffer which SCK_Message points to already is.

5 years agosocket: enable port sharing on Linux
Miroslav Lichvar [Mon, 23 Mar 2020 10:34:02 +0000 (11:34 +0100)] 
socket: enable port sharing on Linux

On Linux, enable the SO_REUSEPORT option on sockets bound to a port in
order to support load balancing with multiple chronyd instances
(configured to not adjust the system clock).

The IP_FREEBIND option already allowed different instances to bind to
the same address and port, but only one was actually receiving packets.

As the instances don't share their state, sharing the NTP port doesn't
work well with the interleaved mode, symmetric mode, and rate limiting.

Sharing the NTS-KE port will not work until the server keys can be
derived from a shared key.

5 years agodoc: fix typo in smoothtime description
Miroslav Lichvar [Thu, 19 Mar 2020 16:03:25 +0000 (17:03 +0100)] 
doc: fix typo in smoothtime description

5 years agosys_macosx: fix build issue on Sierra and presumably earlier
David Bohman [Tue, 17 Mar 2020 15:24:33 +0000 (08:24 -0700)] 
sys_macosx: fix build issue on Sierra and presumably earlier

5 years agotest: make 139-nts more reliable
Miroslav Lichvar [Tue, 17 Mar 2020 14:56:31 +0000 (15:56 +0100)] 
test: make 139-nts more reliable

5 years agodoc: fix typo in NEWS
Miroslav Lichvar [Mon, 16 Mar 2020 17:34:03 +0000 (18:34 +0100)] 
doc: fix typo in NEWS

5 years agodoc: update NEWS 4.0-pre1
Miroslav Lichvar [Mon, 16 Mar 2020 12:16:14 +0000 (13:16 +0100)] 
doc: update NEWS

5 years agosys_macosx: don't require clock_gettime()
Bryan Christianson [Thu, 12 Mar 2020 19:33:00 +0000 (08:33 +1300)] 
sys_macosx: don't require clock_gettime()

Earlier versions of macOS do not provide clock_gettime(). This patch
checks for clock_gettime() at run-time and falls back to gettimeofday()
if the symbol is not present.

5 years agomain: accept zero timeout
Miroslav Lichvar [Thu, 12 Mar 2020 13:25:21 +0000 (14:25 +0100)] 
main: accept zero timeout

Allow -t to specify zero timeout to exit immediately. It might be
useful for testing.

5 years agoreference: update synchronization status more frequently
Miroslav Lichvar [Thu, 12 Mar 2020 09:49:38 +0000 (10:49 +0100)] 
reference: update synchronization status more frequently

Update the local clock errors with each update of the leap status to
avoid the kernel marking the clock as unsynchronized when a large
number of NTP samples is dropped.

5 years agosources: update reference leap status early
Miroslav Lichvar [Wed, 11 Mar 2020 16:03:00 +0000 (17:03 +0100)] 
sources: update reference leap status early

When a leap second status is updated by a source, don't wait for the
next source selection and full update of the reference. Count votes from
sources that passed the previous selection and update the reference leap
status directly.

This should allow leap seconds to spread quickly even when the
samples are dropped or delayed by the filters.

5 years agosources: separate update of leap status
Miroslav Lichvar [Wed, 11 Mar 2020 14:48:00 +0000 (15:48 +0100)] 
sources: separate update of leap status

Remove leap status from the NTP sample and set it independently from
the sample accumulation in order to accept a leap second sooner when
samples are filtered.

5 years agosourcestats: move leap status to sources
Miroslav Lichvar [Wed, 11 Mar 2020 14:21:57 +0000 (15:21 +0100)] 
sourcestats: move leap status to sources

5 years agocmdmon: add reset command
Miroslav Lichvar [Wed, 11 Mar 2020 11:20:51 +0000 (12:20 +0100)] 
cmdmon: add reset command

The reset command drops all measurements and switches the reference to
the unsynchronised state. This command can help chronyd with recovery
when the measurements are known to be no longer valid or accurate, e.g.
due to moving the computer to a different network, or resuming the
computer from a low-power state (which resets the system clock).