]> git.ipfire.org Git - thirdparty/chrony.git/log
thirdparty/chrony.git
6 years agontp: set interface index in IP*_PKTINFO when responding
Miroslav Lichvar [Wed, 29 Aug 2018 08:56:14 +0000 (10:56 +0200)] 
ntp: set interface index in IP*_PKTINFO when responding

When a server with multiple interfaces in the same network is sending a
response, setting the ipi_spec_dst/ipi6_addr field of the IP*_PKTINFO
control message selects the source address, but not necessarily the
interface. The packet has the expected source address, but it may be
sent by an interface that doesn't have the address.

Set the ipi_ifindex/ipi6_ifindex field to respond on the same interface
as the request was received from to avoid asymmetries in delay and
timestamping.

6 years agotest: add 133-hwtimestamp test
Miroslav Lichvar [Wed, 29 Aug 2018 16:08:43 +0000 (18:08 +0200)] 
test: add 133-hwtimestamp test

6 years agotest: add 132-logchange test
Miroslav Lichvar [Tue, 28 Aug 2018 16:13:52 +0000 (18:13 +0200)] 
test: add 132-logchange test

6 years agotest: add 131-maxchange test
Miroslav Lichvar [Tue, 28 Aug 2018 16:00:16 +0000 (18:00 +0200)] 
test: add 131-maxchange test

6 years agotest: extend 108-peer test
Miroslav Lichvar [Mon, 27 Aug 2018 12:17:18 +0000 (14:17 +0200)] 
test: extend 108-peer test

6 years agotest: don't override user settings with default values
Miroslav Lichvar [Mon, 27 Aug 2018 11:34:49 +0000 (13:34 +0200)] 
test: don't override user settings with default values

This fixes commit 671daf06b832940bb331242d07462c0f69be9618.

6 years agotest: extend ntp_core unit test
Miroslav Lichvar [Mon, 27 Aug 2018 15:18:20 +0000 (17:18 +0200)] 
test: extend ntp_core unit test

6 years agotest: update hash unit test
Miroslav Lichvar [Mon, 27 Aug 2018 15:32:38 +0000 (17:32 +0200)] 
test: update hash unit test

6 years agotest: enable unit tests to suspend logging
Miroslav Lichvar [Tue, 28 Aug 2018 12:20:40 +0000 (14:20 +0200)] 
test: enable unit tests to suspend logging

6 years agologging: allow reopening stderr
Miroslav Lichvar [Tue, 28 Aug 2018 12:10:21 +0000 (14:10 +0200)] 
logging: allow reopening stderr

LOG_OpenFileLog(NULL) can be now used to reopen stderr.

6 years agologging: close previous file log after opening new one
Miroslav Lichvar [Tue, 28 Aug 2018 12:04:44 +0000 (14:04 +0200)] 
logging: close previous file log after opening new one

Currently, the log is always opened only once, but that will change with
tests temporarily suspending logging.

6 years agontp: optimize MAC truncation
Miroslav Lichvar [Mon, 27 Aug 2018 15:20:56 +0000 (17:20 +0200)] 
ntp: optimize MAC truncation

When generating a MAC for an NTP packet, request only the bytes that
will be sent.

6 years agohash: allow truncated output
Miroslav Lichvar [Mon, 27 Aug 2018 14:26:01 +0000 (16:26 +0200)] 
hash: allow truncated output

Tomcrypt, some NSS hash functions, and the internal MD5 require the
output buffer to be at least as long as the digest. To provide the same
hashing API with all four options, use an extra buffer for the digest
when necessary and copy only the requested bytes to the caller.

6 years agontp: remove unnecessary constant
Miroslav Lichvar [Mon, 27 Aug 2018 12:12:23 +0000 (14:12 +0200)] 
ntp: remove unnecessary constant

6 years agosources: check maximum reach size before postponing update
Miroslav Lichvar [Mon, 27 Aug 2018 11:11:49 +0000 (13:11 +0200)] 
sources: check maximum reach size before postponing update

Don't wait for other sources to be selectable when the maximum
selectable and non-selectable reachability registers happen to match
and a register is already full (e.g. after heavy packet loss).

6 years agodoc: improve description of LastRx column in chronyc sources
Miroslav Lichvar [Mon, 27 Aug 2018 09:26:21 +0000 (11:26 +0200)] 
doc: improve description of LastRx column in chronyc sources

6 years agotest: add 130-quit test
Miroslav Lichvar [Fri, 24 Aug 2018 14:56:09 +0000 (16:56 +0200)] 
test: add 130-quit test

6 years agotest: add 129-reload test
Miroslav Lichvar [Fri, 24 Aug 2018 14:33:20 +0000 (16:33 +0200)] 
test: add 129-reload test

6 years agotest: add 128-nocontrol test
Miroslav Lichvar [Fri, 24 Aug 2018 13:40:12 +0000 (15:40 +0200)] 
test: add 128-nocontrol test

6 years agotest: separate client/server chronyd options
Miroslav Lichvar [Fri, 24 Aug 2018 13:05:58 +0000 (15:05 +0200)] 
test: separate client/server chronyd options

6 years agotest: avoid using eval in shell scripts
Miroslav Lichvar [Fri, 24 Aug 2018 12:56:04 +0000 (14:56 +0200)] 
test: avoid using eval in shell scripts

6 years agotest: extend util unit test
Miroslav Lichvar [Fri, 24 Aug 2018 12:19:40 +0000 (14:19 +0200)] 
test: extend util unit test

6 years agotest: add samplefilt unit test
Miroslav Lichvar [Thu, 23 Aug 2018 15:06:50 +0000 (17:06 +0200)] 
test: add samplefilt unit test

6 years agotest: add sanitizers test
Miroslav Lichvar [Wed, 22 Aug 2018 15:19:16 +0000 (17:19 +0200)] 
test: add sanitizers test

6 years agotest: detect configure errors in compilation test
Miroslav Lichvar [Wed, 22 Aug 2018 13:05:56 +0000 (15:05 +0200)] 
test: detect configure errors in compilation test

6 years agotest: add -Werror to CFLAGS in compilation test
Miroslav Lichvar [Wed, 22 Aug 2018 13:03:59 +0000 (15:03 +0200)] 
test: add -Werror to CFLAGS in compilation test

6 years agodoc: update description of -r option
Miroslav Lichvar [Fri, 24 Aug 2018 14:09:21 +0000 (16:09 +0200)] 
doc: update description of -r option

6 years agosourcestats: improve debug message in SST_GetTrackingData()
Miroslav Lichvar [Fri, 24 Aug 2018 10:43:27 +0000 (12:43 +0200)] 
sourcestats: improve debug message in SST_GetTrackingData()

6 years agosources: use SQUARE macro in combine_sources()
Miroslav Lichvar [Fri, 24 Aug 2018 07:45:00 +0000 (09:45 +0200)] 
sources: use SQUARE macro in combine_sources()

6 years agosamplefilt: check for non-increasing sample times
Miroslav Lichvar [Thu, 23 Aug 2018 12:19:16 +0000 (14:19 +0200)] 
samplefilt: check for non-increasing sample times

Adopt the check from the refclock code to check also samples from NTP.

6 years agotest: update hwclock unit test
Miroslav Lichvar [Tue, 21 Aug 2018 14:50:58 +0000 (16:50 +0200)] 
test: update hwclock unit test

6 years agosys_linux: extend debug message
Miroslav Lichvar [Tue, 21 Aug 2018 11:23:12 +0000 (13:23 +0200)] 
sys_linux: extend debug message

6 years agosys_linux: improve support for upcoming kernel versions
Miroslav Lichvar [Tue, 21 Aug 2018 11:04:21 +0000 (13:04 +0200)] 
sys_linux: improve support for upcoming kernel versions

Starting with Linux 4.19, the frequency of the system clock should be
updated immediately in the system call itself, which will significantly
reduce the maximum delay of the update.

Increase the assumed tick rate in order to reduce the dispersion
accumulated by the driver when it sets the frequency.

6 years agotest: make 121-orphan more reliable
Miroslav Lichvar [Tue, 21 Aug 2018 12:11:30 +0000 (14:11 +0200)] 
test: make 121-orphan more reliable

6 years agoreference: refactor estimation of clock frequency
Miroslav Lichvar [Tue, 21 Aug 2018 10:10:41 +0000 (12:10 +0200)] 
reference: refactor estimation of clock frequency

Reorder code in REF_SetReference(), clean it up a bit, and split off the
parts specific to the weighting and estimation of the new frequency.

6 years agoreference: include skew in local sync status setting
Miroslav Lichvar [Fri, 17 Aug 2018 14:05:47 +0000 (16:05 +0200)] 
reference: include skew in local sync status setting

6 years agosourcestats: include offset SD in tracking root dispersion
Miroslav Lichvar [Fri, 17 Aug 2018 14:05:33 +0000 (16:05 +0200)] 
sourcestats: include offset SD in tracking root dispersion

6 years agoutil: introduce SQUARE macro
Miroslav Lichvar [Fri, 17 Aug 2018 09:16:44 +0000 (11:16 +0200)] 
util: introduce SQUARE macro

6 years agoreference: fix offset SD to include elapsed time
Miroslav Lichvar [Fri, 17 Aug 2018 06:39:30 +0000 (08:39 +0200)] 
reference: fix offset SD to include elapsed time

This should slow down corrections based on old measurements with large
estimated error in frequency.

6 years agosources: fix combined offset SD to include elapsed time
Miroslav Lichvar [Tue, 21 Aug 2018 10:05:12 +0000 (12:05 +0200)] 
sources: fix combined offset SD to include elapsed time

6 years agosources: combine frequencies by variance instead of skew
Miroslav Lichvar [Fri, 17 Aug 2018 08:46:19 +0000 (10:46 +0200)] 
sources: combine frequencies by variance instead of skew

This seems to slightly improve the stability.

6 years agosources: provide frequency SD to reference update
Miroslav Lichvar [Fri, 17 Aug 2018 06:34:14 +0000 (08:34 +0200)] 
sources: provide frequency SD to reference update

6 years agosourcestats: provide frequency SD in tracking data
Miroslav Lichvar [Fri, 17 Aug 2018 06:01:03 +0000 (08:01 +0200)] 
sourcestats: provide frequency SD in tracking data

6 years agosourcestats: replace constant with macro
Miroslav Lichvar [Fri, 17 Aug 2018 05:57:01 +0000 (07:57 +0200)] 
sourcestats: replace constant with macro

6 years agotest: don't require exit message to be on last line
Miroslav Lichvar [Fri, 17 Aug 2018 15:38:44 +0000 (17:38 +0200)] 
test: don't require exit message to be on last line

This is useful with enabled debug output.

6 years agontp: change maxdelay* info messages to use option names
Miroslav Lichvar [Mon, 13 Aug 2018 10:17:57 +0000 (12:17 +0200)] 
ntp: change maxdelay* info messages to use option names

7 years agotest: improve 101-poll test
Miroslav Lichvar [Fri, 10 Aug 2018 14:46:38 +0000 (16:46 +0200)] 
test: improve 101-poll test

7 years agorefclock: improve error messages
Miroslav Lichvar [Thu, 9 Aug 2018 11:56:56 +0000 (13:56 +0200)] 
refclock: improve error messages

7 years agontp: add options to set minsamples/maxsamples of hwclock
Miroslav Lichvar [Wed, 8 Aug 2018 12:03:35 +0000 (14:03 +0200)] 
ntp: add options to set minsamples/maxsamples of hwclock

7 years agohwclock: add parameters for minimum/maximum number of samples
Miroslav Lichvar [Wed, 8 Aug 2018 11:22:30 +0000 (13:22 +0200)] 
hwclock: add parameters for minimum/maximum number of samples

Allocate the arrays which hold the samples dynamically and limit the
number of dropped samples to not fall below the minimum.

7 years agotest: add 127-filter test
Miroslav Lichvar [Thu, 9 Aug 2018 12:51:18 +0000 (14:51 +0200)] 
test: add 127-filter test

7 years agocmdmon: include filter length in ADD_SERVER/ADD_PEER request
Miroslav Lichvar [Tue, 7 Aug 2018 16:01:16 +0000 (18:01 +0200)] 
cmdmon: include filter length in ADD_SERVER/ADD_PEER request

7 years agontp: add assertion to get_seperation()
Miroslav Lichvar [Wed, 8 Aug 2018 13:56:12 +0000 (15:56 +0200)] 
ntp: add assertion to get_seperation()

7 years agontp: shorten minimum allowed polling interval
Miroslav Lichvar [Wed, 8 Aug 2018 12:52:11 +0000 (14:52 +0200)] 
ntp: shorten minimum allowed polling interval

With the filter option it is useful to collect NTP measurements at
a higher rate.

7 years agontp: add filter option
Miroslav Lichvar [Mon, 6 Aug 2018 16:12:12 +0000 (18:12 +0200)] 
ntp: add filter option

Add an option to use the median filter to reduce noise in measurements
before they are accumulated to sourcestats, similarly to reference
clocks. The option specifies how many samples are reduced to a single
sample.

The filter is intended to be used with very short polling intervals in
local networks where it is acceptable to generate a lot of NTP traffic.

7 years agontp: enable auto burst with very short polling intervals
Miroslav Lichvar [Mon, 6 Aug 2018 11:56:27 +0000 (13:56 +0200)] 
ntp: enable auto burst with very short polling intervals

This fixes commit 5b75d4afefd04bef93d57cc3f087befc1062141e.

7 years agorefclock: split off median filter
Miroslav Lichvar [Fri, 3 Aug 2018 13:15:36 +0000 (15:15 +0200)] 
refclock: split off median filter

Move the implementation of the median filter to a separate file to make
it useful for NTP. Replace some constants with parameters and generalize
the code to work with full NTP samples (including root dispersion/delay,
stratum, and leap).

For refclocks it should give the same results as before.

7 years agouse common structure for NTP samples
Miroslav Lichvar [Wed, 1 Aug 2018 14:28:26 +0000 (16:28 +0200)] 
use common structure for NTP samples

Define a structure for NTP samples and use it to pass samples from
the ntp_core and refclock code to sources and sourcestats.

7 years agosourcestats: don't save stratum for all samples
Miroslav Lichvar [Wed, 1 Aug 2018 14:19:37 +0000 (16:19 +0200)] 
sourcestats: don't save stratum for all samples

Save stratum only from the last accumulated sample as only that is
currently needed.

7 years agosourcestats: track leap status
Miroslav Lichvar [Wed, 1 Aug 2018 14:19:28 +0000 (16:19 +0200)] 
sourcestats: track leap status

This moves the leap status of the last sample from the source instance
to the sourcestats instance in order to make them both accumulate the
same data.

7 years agosys_linux: allow fcntl(F_SETFL) in seccomp filter
Miroslav Lichvar [Fri, 3 Aug 2018 08:39:32 +0000 (10:39 +0200)] 
sys_linux: allow fcntl(F_SETFL) in seccomp filter

This fixes commit 76bed76289575ba1640c02d370ae5304ef8c5fe2.

7 years agoconfigure: fix detection of timepps.h on FreeBSD
Miroslav Lichvar [Fri, 3 Aug 2018 08:08:01 +0000 (10:08 +0200)] 
configure: fix detection of timepps.h on FreeBSD

The header requires inttypes.h to be useful.

7 years agoconfigure: drop detection of stdint.h and inttypes.h
Miroslav Lichvar [Fri, 3 Aug 2018 08:03:07 +0000 (10:03 +0200)] 
configure: drop detection of stdint.h and inttypes.h

The current code uses macros from inttypes.h. There is no point in
detecting and selecting between stdint.h and inttypes.h as the latter is
always needed.

7 years agomemory: add missing include
Miroslav Lichvar [Wed, 1 Aug 2018 16:46:08 +0000 (18:46 +0200)] 
memory: add missing include

7 years agoutil: handle or ignore SIGPIPE signal
Miroslav Lichvar [Wed, 1 Aug 2018 10:20:17 +0000 (12:20 +0200)] 
util: handle or ignore SIGPIPE signal

In chronyc handle SIGPIPE similarly to SIGTERM. In chronyd ignore the
signal to avoid crashing when a TCP socket will be needed (e.g. for
NTS-KE) and will be unexpectedly closed from the other side.

7 years agoutil: handle errors in setting of signal handler as fatal
Miroslav Lichvar [Wed, 1 Aug 2018 09:59:00 +0000 (11:59 +0200)] 
util: handle errors in setting of signal handler as fatal

7 years agosched: allow file handler with multiple events to remove itself
Miroslav Lichvar [Tue, 31 Jul 2018 14:44:43 +0000 (16:44 +0200)] 
sched: allow file handler with multiple events to remove itself

Before dispatching a handler, check if it is still valid. This allows a
handler to remove itself when a descriptor has two different events at
the same time.

7 years agodoc: update chrony.conf man page for recent changes
Miroslav Lichvar [Fri, 22 Jun 2018 10:09:31 +0000 (12:09 +0200)] 
doc: update chrony.conf man page for recent changes

7 years agontp: allow sub-second maxpoll
Miroslav Lichvar [Thu, 21 Jun 2018 15:37:31 +0000 (17:37 +0200)] 
ntp: allow sub-second maxpoll

Remove the maxpoll-specific limit and allow both minpoll and maxpoll to
be set to a negative value.

7 years agontp: restrict use of sub-second polling intervals
Miroslav Lichvar [Thu, 21 Jun 2018 15:29:43 +0000 (17:29 +0200)] 
ntp: restrict use of sub-second polling intervals

When the local polling interval is adjusted between minpoll and maxpoll
to a sub-second value, check if the source is reachable and the minimum
measured delay is 10 milliseconds or less. If it's not, ignore the
maxpoll value and set the interval to 1 second.

This should prevent clients (mis)configured with an extremely short
minpoll/maxpoll from flooding servers on the Internet.

7 years agontp: make burst interval proportional to polling interval
Miroslav Lichvar [Thu, 21 Jun 2018 14:46:30 +0000 (16:46 +0200)] 
ntp: make burst interval proportional to polling interval

If the polling interval is shorter than 8 seconds, set the burst
interval to the 1/4th of the polling interval instead of the 2-second
constant. This should make the burst option and command useful with
very short polling intervals.

7 years agorefclock_sock: downgrade error messages to debug messages
Miroslav Lichvar [Wed, 20 Jun 2018 14:37:57 +0000 (16:37 +0200)] 
refclock_sock: downgrade error messages to debug messages

Turn error messages which are not expected to happen with a correctly
working SOCK client into debug messages.

7 years agofix printf()/scanf() format signedness
Miroslav Lichvar [Wed, 20 Jun 2018 14:28:10 +0000 (16:28 +0200)] 
fix printf()/scanf() format signedness

Fix mismatches between the format and sign of variables passed to
printf() or scanf(), which were found in a Frama-C analysis and gcc
using the -Wformat-signedness option.

7 years agokeys: initialize data used for measuring authentication delay
Miroslav Lichvar [Wed, 20 Jun 2018 12:36:28 +0000 (14:36 +0200)] 
keys: initialize data used for measuring authentication delay

This issue was found in a Frama-C analysis.

7 years agoreference: specify recipient in message when sending email
Miroslav Lichvar [Wed, 20 Jun 2018 11:02:55 +0000 (13:02 +0200)] 
reference: specify recipient in message when sending email

Instead of adding the recipient to the sendmail command line (which is
interpretted by the shell) add a "To" line to the message and run
sendmail with the -t option to read the recipient from the message.

7 years agoreference: terminate string returned by gethostname()
Miroslav Lichvar [Wed, 20 Jun 2018 10:27:59 +0000 (12:27 +0200)] 
reference: terminate string returned by gethostname()

POSIX doesn't require the string to be terminated if it didn't fit in
the buffer.

This issue was found in a Frama-C analysis.

7 years agocheck values returned by gmtime() and localtime()
Miroslav Lichvar [Wed, 20 Jun 2018 10:11:55 +0000 (12:11 +0200)] 
check values returned by gmtime() and localtime()

While it is not expected to happen with any time that can be represented
by the system clock, the functions are allowed to return NULL. Check the
pointer before dereferencing.

This issue was found in a Frama-C analysis.

7 years agoclient: re-work tab-completion to work with libedit 20180525-3.1
Lonnie Abelbeck [Thu, 14 Jun 2018 19:54:42 +0000 (14:54 -0500)] 
client: re-work tab-completion to work with libedit 20180525-3.1

Remove spaces from tab-completion results and now break on a space.
Tested with both readline and editline (libedit)
Incorporated Miroslav's suggestions.

7 years agodoc: fix description of pidfile directive to mention -Q option
Miroslav Lichvar [Thu, 7 Jun 2018 15:53:40 +0000 (17:53 +0200)] 
doc: fix description of pidfile directive to mention -Q option

This fixes commit 778fce4039e1763f9da367a97a53446d28810f1c.

7 years agoexamples: update pidfile in chronyd.service
Miroslav Lichvar [Thu, 7 Jun 2018 15:43:57 +0000 (17:43 +0200)] 
examples: update pidfile in chronyd.service

7 years agoconfigure: move default pidfile to /var/run/chrony
Miroslav Lichvar [Thu, 7 Jun 2018 14:54:59 +0000 (16:54 +0200)] 
configure: move default pidfile to /var/run/chrony

This allows chronyd to remove its pidfile on exit after dropping the
root privileges in order to prevent another chronyd instance from
failing to start, e.g. due to a wrong SELinux label from chronyd -q.

7 years agomain: create directories before writing pidfile
Miroslav Lichvar [Thu, 7 Jun 2018 14:43:59 +0000 (16:43 +0200)] 
main: create directories before writing pidfile

This makes it possible to save pidfile in /var/run/chrony.

7 years agontp: change auto_offline to trigger on failed transmissions
Miroslav Lichvar [Thu, 24 May 2018 15:29:15 +0000 (17:29 +0200)] 
ntp: change auto_offline to trigger on failed transmissions

Instead of counting missing responses, switch to the offline state
immediately when sendmsg() fails.

This makes the option usable with servers and networks that may drop
packets, and the effect will be consistent with the onoffline command.

7 years agoexamples: update NetworkManager dispatcher script
Miroslav Lichvar [Thu, 24 May 2018 15:03:31 +0000 (17:03 +0200)] 
examples: update NetworkManager dispatcher script

Replace most of the code with the new onoffline command.

7 years agocmdmon: add onoffline command
Miroslav Lichvar [Thu, 24 May 2018 14:56:56 +0000 (16:56 +0200)] 
cmdmon: add onoffline command

The onoffline command tells chronyd to switch all sources to the online
or offline status according to the current network configuration. A
source is considered online if it is possible to send requests to it,
i.e. a route to the network is present.

7 years agontp: allow online/offline state to be selected by connectability
Miroslav Lichvar [Thu, 24 May 2018 13:17:53 +0000 (15:17 +0200)] 
ntp: allow online/offline state to be selected by connectability

Allow SRC_MAYBE_ONLINE to be specified for new NTP sources and
connectivity setting to select between SRC_ONLINE and SRC_OFFLINE
according to the result of the connect() system call, i.e. check whether
the client has a route to send its requests.

7 years agontp: refactor switching between online and offline state
Miroslav Lichvar [Thu, 24 May 2018 11:42:52 +0000 (13:42 +0200)] 
ntp: refactor switching between online and offline state

Use an enum to describe connectivity of a source and merge
the NCR and NSR TakeSourceOnline/Offline() functions into
SetConnectivity() functions.

7 years agontp: check PHC index before opening device
Miroslav Lichvar [Mon, 21 May 2018 14:49:26 +0000 (16:49 +0200)] 
ntp: check PHC index before opening device

Apparently, it is possible for an interface to report all necessary
flags for HW timestamping without having a PHC. Check the PHC index to
avoid an error message in the system log saying that /dev/ptp-1 cannot
be opened.

7 years agontp: enable non-blocking mode on server sockets
Miroslav Lichvar [Mon, 21 May 2018 14:27:43 +0000 (16:27 +0200)] 
ntp: enable non-blocking mode on server sockets

Avoid blocking in sendmsg() due to a full send buffer.

7 years agodoc: add new questions to FAQ
Miroslav Lichvar [Mon, 21 May 2018 12:49:53 +0000 (14:49 +0200)] 
doc: add new questions to FAQ

7 years agoutil: fall back to reading /dev/urandom when getrandom() blocks
Miroslav Lichvar [Thu, 17 May 2018 12:16:58 +0000 (14:16 +0200)] 
util: fall back to reading /dev/urandom when getrandom() blocks

With recent changes in the Linux kernel, the getrandom() system call may
block for a long time after boot on machines that don't have enough
entropy. It blocks the chronyd's initialization before it can detach
from the terminal and may cause a chronyd service to fail to start due
to a timeout.

At least for now, enable the GRND_NONBLOCK flag to make the system call
non-blocking and let the code fall back to reading /dev/urandom (which
never blocks) if the system call failed with EAGAIN or any other error.

This makes the start of chronyd non-deterministic with respect to files
that it needs to open and possibly also makes it slightly easier to
guess the transmit/receive timestamp in client requests until the
urandom source is fully initialized.

7 years agoexamples: make nm-dispatcher script usable for networkd-dispatcher
Christian Ehrhardt [Wed, 18 Apr 2018 13:44:21 +0000 (15:44 +0200)] 
examples: make nm-dispatcher script usable for networkd-dispatcher

Historically there were plenty of callback based implementations around
ifupdown via /etc/network/if-up and similar. NetworkManager added the
dispatcher [1] feature for such a kind of functionality.

But so far a systemd-networkd (only) systemd had no means to handle those
cases. This is solved by networkd-dispatcher which is currently available
at least in ArchLinux and Ubuntu.
It takes away the responsibility to listen on netlink events in each
application and provides a more classic script-drop-in interface to respond
to networkd events [3].

This commit makes the NM example compatible to be used by NetworkManager
dispatcher as well as by networkd-dispatcher. That way we avoid too much
code duplication and can from now on handle special cases in the
beginning so that the tail can stay commonly used.

After discussion on IRC the current check differs by checking the
argument count (only in NetworkManager), if ever needed we could extend
that to check for known custom environment vars (NetworkManager =>
CONNECTION_UUID; networkd-dispatcher => OperationalState).

[1]: https://developer.gnome.org/NetworkManager/stable/NetworkManager.html
[2]: https://github.com/craftyguy/networkd-dispatcher
[3]: https://github.com/systemd/systemd/blob/master/src/systemd/sd-network.h#L86

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agosys_linux: fix building with old libcap versions
Miroslav Lichvar [Thu, 5 Apr 2018 14:18:23 +0000 (16:18 +0200)] 
sys_linux: fix building with old libcap versions

The cap_get_bound() function and CAP_IS_SUPPORTED macro were added in
libcap-2.21. Check if the macro is defined before use.

The sys/capability.h header from libcap-2.16 and earlier disables the
linux/types.h header, which breaks the linux/ptp_clock.h header. Change
the order to include sys/capability.h as the last system header.

7 years agodoc: update NEWS 3.3
Miroslav Lichvar [Wed, 4 Apr 2018 07:17:08 +0000 (09:17 +0200)] 
doc: update NEWS

7 years agoclient: update copyright years
Miroslav Lichvar [Wed, 4 Apr 2018 07:14:16 +0000 (09:14 +0200)] 
client: update copyright years

7 years agontp: fix handling of socket errors with error queue
Miroslav Lichvar [Wed, 4 Apr 2018 07:07:10 +0000 (09:07 +0200)] 
ntp: fix handling of socket errors with error queue

In the next Linux version the recvmmsg() system call will be probably
fixed to not return socket errors (e.g. due to ICMP) when reading from
the error queue.

The NTP I/O code assumed this was the correct behavior. When the system
call is fixed, a socket error on a client socket will cause chronyd to
enter a busy loop consuming the CPU until the receive timeout is reached
(8 seconds by default).

Use getsockopt(SO_ERROR) to clear the socket error when reading from the
error queue failed.

7 years agoprivops: allow binding to acquisition port
Miroslav Lichvar [Tue, 3 Apr 2018 09:05:33 +0000 (11:05 +0200)] 
privops: allow binding to acquisition port

Fix the privileged helper process to allow binding of client sockets to
a non-zero acquisition port which is not equal to the server port.

7 years agodoc: improve FAQ
Miroslav Lichvar [Tue, 27 Mar 2018 15:57:17 +0000 (17:57 +0200)] 
doc: improve FAQ

7 years agodoc: improve description of fallbackdrift directive
Miroslav Lichvar [Tue, 27 Mar 2018 11:08:01 +0000 (13:08 +0200)] 
doc: improve description of fallbackdrift directive

7 years agodoc: improve description of key option in chrony.conf man page
Miroslav Lichvar [Mon, 26 Mar 2018 17:00:50 +0000 (19:00 +0200)] 
doc: improve description of key option in chrony.conf man page