]> git.ipfire.org Git - thirdparty/chrony.git/log
thirdparty/chrony.git
8 years agontp: improve dispersion calculation
Miroslav Lichvar [Wed, 4 Jan 2017 14:40:52 +0000 (15:40 +0100)] 
ntp: improve dispersion calculation

Instead of adding precision (sum of the local and remote precision) to
the TX and RX timestamp error, include only the maximum.

8 years agoconf: change default rate limiting parameters
Miroslav Lichvar [Tue, 3 Jan 2017 11:05:43 +0000 (12:05 +0100)] 
conf: change default rate limiting parameters

Change the default NTP rate limiting leak to 2 (25%). Change the default
command rate limiting interval to -4 (16 packets per second) and burst
to 8, so the interval is the only difference between NTP and command
rate limiting defaults.

8 years agoclientlog: disable NTP response rate limiting by default
Miroslav Lichvar [Tue, 3 Jan 2017 10:34:34 +0000 (11:34 +0100)] 
clientlog: disable NTP response rate limiting by default

This reverts commit 50022e928644e3d727eaf8a7a8b334f3c998223c.

Testing showed that ntpd as an NTP client performs poorly when it's
getting only 25% of responses. At least for now, disable rate limiting
by default again.

8 years agontp: calculate delay relative to local frequency
Miroslav Lichvar [Tue, 3 Jan 2017 10:22:53 +0000 (11:22 +0100)] 
ntp: calculate delay relative to local frequency

This should be more accurate as local frequency is usually
combined from multiple sources. This is a partial revert of commit
23a4e8b38d873ce1246c4ef43a05d92c442a9f26.

8 years agodoc: update NEWS 3.0-pre2
Miroslav Lichvar [Thu, 15 Dec 2016 11:00:26 +0000 (12:00 +0100)] 
doc: update NEWS

8 years agoclientlog: enable NTP response rate limiting by default
Miroslav Lichvar [Thu, 15 Dec 2016 10:11:05 +0000 (11:11 +0100)] 
clientlog: enable NTP response rate limiting by default

Change the default interval of both NTP and command rate limiting to -10
(1024 packets per second) and the burst to 16. The default NTP leak is 2
(rate limiting is enabled by default) and the default command leak is 0
(rate limiting is disabled by default).

8 years agoclientlog: randomize alignment of log timestamps
Miroslav Lichvar [Thu, 15 Dec 2016 10:06:14 +0000 (11:06 +0100)] 
clientlog: randomize alignment of log timestamps

8 years agoclientlog: allow very short rate limiting intervals
Miroslav Lichvar [Wed, 14 Dec 2016 17:00:49 +0000 (18:00 +0100)] 
clientlog: allow very short rate limiting intervals

Support negative token shift to allow coarse rate limiting with
intervals down to -19.

8 years agoconfigure: don't use recvmmsg() on FreeBSD
Miroslav Lichvar [Wed, 14 Dec 2016 16:22:32 +0000 (17:22 +0100)] 
configure: don't use recvmmsg() on FreeBSD

Don't try recvmmsg() on FreeBSD, at least for now. It is broken on
FreeBSD 11.0 and it's just a wrapper around recvmsg().

8 years agodoc: improve hwtimestamp description
Miroslav Lichvar [Wed, 14 Dec 2016 12:30:17 +0000 (13:30 +0100)] 
doc: improve hwtimestamp description

8 years agontp: allow wildcard in hwtimestamp directive
Miroslav Lichvar [Wed, 14 Dec 2016 11:15:32 +0000 (12:15 +0100)] 
ntp: allow wildcard in hwtimestamp directive

If "*" was specified, use getifaddrs() to get a list of all interfaces,
and try to enable HW timestamping on all of them.

8 years agoclient: improve ntpdata output
Miroslav Lichvar [Wed, 14 Dec 2016 09:56:22 +0000 (10:56 +0100)] 
client: improve ntpdata output

8 years agoclient: don't require address in ntpdata command
Miroslav Lichvar [Wed, 14 Dec 2016 08:56:52 +0000 (09:56 +0100)] 
client: don't require address in ntpdata command

If no address is specified, use the SOURCE_DATA command to get addresses
of NTP sources, and request NTP_DATA for all of them.

8 years agosourcestats: add upper bound for skew
Miroslav Lichvar [Wed, 14 Dec 2016 07:59:52 +0000 (08:59 +0100)] 
sourcestats: add upper bound for skew

8 years agoexamples: avoid Unix domain socket in chrony-wait service
Miroslav Lichvar [Tue, 13 Dec 2016 11:57:06 +0000 (12:57 +0100)] 
examples: avoid Unix domain socket in chrony-wait service

Use the -h option to force chronyc to use internet socket instead of
Unix domain as the access to the socket may be blocked by SELinux and
trying to open it generates SELinux warnings.

8 years agocmdmon: update protocol changelog
Miroslav Lichvar [Tue, 13 Dec 2016 11:55:49 +0000 (12:55 +0100)] 
cmdmon: update protocol changelog

8 years agosourcestats: add lower bound for std dev used for weighting
Miroslav Lichvar [Tue, 13 Dec 2016 11:50:59 +0000 (12:50 +0100)] 
sourcestats: add lower bound for std dev used for weighting

8 years agosourcestats: save asymmetry run in dump files
Miroslav Lichvar [Mon, 12 Dec 2016 13:39:56 +0000 (14:39 +0100)] 
sourcestats: save asymmetry run in dump files

This allows the asymmetry correction to be applied right after restart.

8 years agocmdmon: add reserved fields to ntpdata reply
Miroslav Lichvar [Mon, 12 Dec 2016 11:50:48 +0000 (12:50 +0100)] 
cmdmon: add reserved fields to ntpdata reply

This might be useful if ntpdata is changed to not require authorization
and new fields need to be added without breaking compatibility.

8 years agonameserv: set CLOEXEC flag on pipe file descriptors
Miroslav Lichvar [Mon, 12 Dec 2016 09:29:26 +0000 (10:29 +0100)] 
nameserv: set CLOEXEC flag on pipe file descriptors

8 years agostubs: rework emulation of asynchronous resolver to use pipes
Miroslav Lichvar [Mon, 12 Dec 2016 08:58:56 +0000 (09:58 +0100)] 
stubs: rework emulation of asynchronous resolver to use pipes

With a larger number of configured servers, the handler of the emulated
resolver repeatedly scheduled timeout of zero, which triggered the
infinite loop detection in the scheduler and caused abort. This bug was
introduced in commit 967e358dbc93aa7a99c3c0ee2a634f1fedecba74.

Rework the code to use pipes instead of timeouts to avoid this problem.

8 years agontp: disable maxdelayratio in interleaved/symmetric mode
Miroslav Lichvar [Mon, 12 Dec 2016 08:11:49 +0000 (09:11 +0100)] 
ntp: disable maxdelayratio in interleaved/symmetric mode

It's too unreliable and the maxdelaydevratio test should work better
anyway.

8 years agodoc: update NEWS 3.0-pre1
Miroslav Lichvar [Fri, 9 Dec 2016 08:04:25 +0000 (09:04 +0100)] 
doc: update NEWS

8 years agodoc: update README
Miroslav Lichvar [Thu, 8 Dec 2016 15:26:34 +0000 (16:26 +0100)] 
doc: update README

8 years agotest: update 119-smoothtime
Miroslav Lichvar [Thu, 8 Dec 2016 15:25:46 +0000 (16:25 +0100)] 
test: update 119-smoothtime

8 years agoclient: add tab-completion with libedit/readline
Lonnie Abelbeck [Thu, 8 Dec 2016 13:24:14 +0000 (07:24 -0600)] 
client: add tab-completion with libedit/readline

8 years agorefclock: make maximum lock age configurable
Miroslav Lichvar [Thu, 8 Dec 2016 13:40:11 +0000 (14:40 +0100)] 
refclock: make maximum lock age configurable

The maxlockage option specifies in number of pulses how old can be
samples from the refclock specified by the lock option to be paired with
the pulses. Increasing this value is useful when the samples are
produced at a lower rate than the pulses.

8 years agorefclock: slew last sample even after it was used
Miroslav Lichvar [Thu, 8 Dec 2016 12:07:50 +0000 (13:07 +0100)] 
refclock: slew last sample even after it was used

It may be needed by locked PPS refclocks.

8 years agotest: add scan-build compilation test
Miroslav Lichvar [Thu, 8 Dec 2016 11:13:34 +0000 (12:13 +0100)] 
test: add scan-build compilation test

8 years agoconfigure: use common CPPFLAGS for all objects
Miroslav Lichvar [Thu, 8 Dec 2016 10:48:51 +0000 (11:48 +0100)] 
configure: use common CPPFLAGS for all objects

8 years agoconfigure: fix help text
Miroslav Lichvar [Thu, 8 Dec 2016 10:46:24 +0000 (11:46 +0100)] 
configure: fix help text

8 years agontp: fix clang warning
Miroslav Lichvar [Thu, 8 Dec 2016 10:32:17 +0000 (11:32 +0100)] 
ntp: fix clang warning

8 years agohwclock: fix check of sample separation
Miroslav Lichvar [Thu, 8 Dec 2016 10:21:13 +0000 (11:21 +0100)] 
hwclock: fix check of sample separation

8 years agontp: add TX error to dispersion
Miroslav Lichvar [Wed, 7 Dec 2016 17:32:55 +0000 (18:32 +0100)] 
ntp: add TX error to dispersion

8 years agontp: fix RX error added to dispersion in interleaved mode
Miroslav Lichvar [Wed, 7 Dec 2016 15:31:56 +0000 (16:31 +0100)] 
ntp: fix RX error added to dispersion in interleaved mode

8 years agosources: add configurable limit for jitter
Miroslav Lichvar [Wed, 7 Dec 2016 08:40:43 +0000 (09:40 +0100)] 
sources: add configurable limit for jitter

The maxjitter directive sets the maximum allowed jitter of the sources
to not be rejected by the source selection algorithm. This prevents
synchronisation with sources that have a small root distance, but their
time is too variable. By default, the maximum jitter is 1 second.

8 years agosourcestats: save variance as standard deviation
Miroslav Lichvar [Tue, 6 Dec 2016 14:37:39 +0000 (15:37 +0100)] 
sourcestats: save variance as standard deviation

This reduces the number of sqrt() calls.

8 years agocmdmon: allow all parameters to be set for new sources
Miroslav Lichvar [Mon, 5 Dec 2016 13:47:02 +0000 (14:47 +0100)] 
cmdmon: allow all parameters to be set for new sources

Add missing fields to the REQ_NTP_Source structure and add new versions
of the ADD_SERVER/ADD_PEER commands.

8 years agontp: rework calculation and testing of peer delay
Miroslav Lichvar [Mon, 5 Dec 2016 12:26:58 +0000 (13:26 +0100)] 
ntp: rework calculation and testing of peer delay

Instead of a worst-case delay use a mean value and relate it to the
source's time. This makes it more stable in the interleaved and
symmetric modes, which should improve the weighting and asymmetry
correction. Modify the test A and B to work with a minimum estimated
delay (delay - dispersion).

8 years agoclient: print addresses with refids in ntpdata report
Miroslav Lichvar [Mon, 5 Dec 2016 09:44:04 +0000 (10:44 +0100)] 
client: print addresses with refids in ntpdata report

8 years agoclient: fix truncation of long hostnames
Miroslav Lichvar [Mon, 5 Dec 2016 09:37:44 +0000 (10:37 +0100)] 
client: fix truncation of long hostnames

8 years agoclient: fix format specifier for poll in ntpdata report
Miroslav Lichvar [Mon, 5 Dec 2016 09:24:28 +0000 (10:24 +0100)] 
client: fix format specifier for poll in ntpdata report

8 years agoclient: fix add command
Miroslav Lichvar [Mon, 5 Dec 2016 09:21:34 +0000 (10:21 +0100)] 
client: fix add command

The default version changed to 0 (autoselect).

8 years agosys_linux: allow openat in seccomp filter
Miroslav Lichvar [Mon, 5 Dec 2016 09:14:15 +0000 (10:14 +0100)] 
sys_linux: allow openat in seccomp filter

8 years agomain: add -t option to usage text
Miroslav Lichvar [Fri, 2 Dec 2016 15:43:56 +0000 (16:43 +0100)] 
main: add -t option to usage text

8 years agoconfigure: rename SOCKDIR to RUNDIR
Miroslav Lichvar [Fri, 2 Dec 2016 12:25:34 +0000 (13:25 +0100)] 
configure: rename SOCKDIR to RUNDIR

8 years agoregress: remove unused struct declaration
Miroslav Lichvar [Fri, 2 Dec 2016 13:31:04 +0000 (14:31 +0100)] 
regress: remove unused struct declaration

8 years agoconf: increase default minsamples and polltarget
Miroslav Lichvar [Fri, 2 Dec 2016 08:15:42 +0000 (09:15 +0100)] 
conf: increase default minsamples and polltarget

Change default minsamples to 6 and polltarget to 8. This should improve
stability with extremely small jitters (e.g. HW timestamping) and not
decrease time accuracy at minimum polling interval too much.

8 years agomain: add -t option to chronyd
Miroslav Lichvar [Thu, 1 Dec 2016 14:57:39 +0000 (15:57 +0100)] 
main: add -t option to chronyd

This option sets a timeout (in seconds) after which chronyd will exit.
If the clock is not synchronised, it will exit with a non-zero status.
This is useful with the -q or -Q option to shorten the maximum time
waiting for measurements, or with the -r option to limit the time when
chronyd is running, but still allow it to adjust the frequency of the
system clock.

8 years agontp: don't make client log entries for broadcast TX
Miroslav Lichvar [Thu, 1 Dec 2016 07:32:35 +0000 (08:32 +0100)] 
ntp: don't make client log entries for broadcast TX

8 years agontp: avoid truncation of NTPv4 MACs by default
Miroslav Lichvar [Tue, 29 Nov 2016 12:26:46 +0000 (13:26 +0100)] 
ntp: avoid truncation of NTPv4 MACs by default

If the MAC in NTPv4 requests would be truncated, use version 3 by
default to avoid the truncation. This is necessary for compatibility
with older chronyd servers, which do not respond to messages with
truncated MACs.

8 years agotest: extend 105-ntpauth
Miroslav Lichvar [Fri, 2 Dec 2016 07:53:49 +0000 (08:53 +0100)] 
test: extend 105-ntpauth

8 years agontp: truncate MACs in NTPv4 packets
Miroslav Lichvar [Tue, 29 Nov 2016 11:59:57 +0000 (12:59 +0100)] 
ntp: truncate MACs in NTPv4 packets

When sending an NTPv4 packet, truncate long MAC to 192 bits to follow
RFC 7822.

8 years agontp: accept NTPv4 packets with truncated MACs
Miroslav Lichvar [Tue, 29 Nov 2016 11:52:20 +0000 (12:52 +0100)] 
ntp: accept NTPv4 packets with truncated MACs

In order to allow deterministic parsing of NTPv4 extension fields, the
MAC must not be longer than 192 bits (RFC 7822). One way to get around
this limitation when using symmetric keys which produce longer MACs is
to truncate them to 192 bits (32-bit key ID and 160-bit hash).

Modify the code to accept NTPv4 packets with MACs truncated to 192
bits, but still allow long MACs in NTPv4 packets to not break
compatibility with older chrony clients.

8 years agokeys: add support for checking truncated MACs
Miroslav Lichvar [Tue, 29 Nov 2016 10:32:39 +0000 (11:32 +0100)] 
keys: add support for checking truncated MACs

8 years agoutil: move authentication and password decoding functions to keys
Miroslav Lichvar [Tue, 29 Nov 2016 10:04:17 +0000 (11:04 +0100)] 
util: move authentication and password decoding functions to keys

This doesn't need to be included in chronyc.

8 years agodoc: update FAQ
Miroslav Lichvar [Mon, 28 Nov 2016 15:42:31 +0000 (16:42 +0100)] 
doc: update FAQ

8 years agodoc: update man pages
Miroslav Lichvar [Mon, 28 Nov 2016 15:02:51 +0000 (16:02 +0100)] 
doc: update man pages

8 years agodoc: update README
Miroslav Lichvar [Mon, 28 Nov 2016 10:42:43 +0000 (11:42 +0100)] 
doc: update README

8 years agontp: fix length modifier of refid in measurements log
Miroslav Lichvar [Mon, 28 Nov 2016 09:43:27 +0000 (10:43 +0100)] 
ntp: fix length modifier of refid in measurements log

8 years agoclient: zero pad reference ID
Miroslav Lichvar [Mon, 28 Nov 2016 09:43:12 +0000 (10:43 +0100)] 
client: zero pad reference ID

8 years agoclient: add ntpdata command
Miroslav Lichvar [Fri, 25 Nov 2016 15:28:09 +0000 (16:28 +0100)] 
client: add ntpdata command

8 years agocmdmon: add ntpdata command
Miroslav Lichvar [Fri, 25 Nov 2016 14:02:35 +0000 (15:02 +0100)] 
cmdmon: add ntpdata command

8 years agoclient: fix format specifiers in sourcestats report
Miroslav Lichvar [Fri, 25 Nov 2016 09:16:28 +0000 (10:16 +0100)] 
client: fix format specifiers in sourcestats report

8 years agoclient: add new format specifiers to print_report()
Miroslav Lichvar [Fri, 25 Nov 2016 09:15:58 +0000 (10:15 +0100)] 
client: add new format specifiers to print_report()

8 years agoclient: print reference ID in hexadecimal
Miroslav Lichvar [Fri, 25 Nov 2016 08:57:14 +0000 (09:57 +0100)] 
client: print reference ID in hexadecimal

This is an incompatible change in the output of the tracking command,
which may break some scripts, but it's necessary to avoid confusion with
IPv4 addresses when synchronised to an IPv6 server or reference clock.

8 years agosources: give access to sourcestats instance
Miroslav Lichvar [Fri, 25 Nov 2016 13:22:36 +0000 (14:22 +0100)] 
sources: give access to sourcestats instance

Give access to the sourcestats instance and remove all functions that
just translated to SST calls.

8 years agontp: add new debug message
Miroslav Lichvar [Fri, 25 Nov 2016 08:21:44 +0000 (09:21 +0100)] 
ntp: add new debug message

8 years agontp: fix logging of RX timestamp source in interleaved mode
Miroslav Lichvar [Thu, 24 Nov 2016 15:27:47 +0000 (16:27 +0100)] 
ntp: fix logging of RX timestamp source in interleaved mode

8 years agontp: don't send presend packets in burst mode
Miroslav Lichvar [Thu, 24 Nov 2016 09:09:50 +0000 (10:09 +0100)] 
ntp: don't send presend packets in burst mode

8 years agontp: allow presend of zero
Miroslav Lichvar [Wed, 23 Nov 2016 15:48:27 +0000 (16:48 +0100)] 
ntp: allow presend of zero

Don't use zero as a special value for disabled and change the default
presend to a value larger than any valid poll.

8 years agontp: send two presend packets in interleaved mode
Miroslav Lichvar [Wed, 23 Nov 2016 15:34:53 +0000 (16:34 +0100)] 
ntp: send two presend packets in interleaved mode

In a burst of three requests (two presend + one normal) the server can
detect the client is using the interleaved mode and save the transmit
timestamp of the second response for the third response. This shortens
the interval in which the server has to keep the state.

8 years agontp: shorten presend delay to 2 seconds
Miroslav Lichvar [Wed, 23 Nov 2016 14:55:37 +0000 (15:55 +0100)] 
ntp: shorten presend delay to 2 seconds

8 years agontp: process presend responses
Miroslav Lichvar [Wed, 23 Nov 2016 14:43:07 +0000 (15:43 +0100)] 
ntp: process presend responses

Rework the code to make a real request for presend and process the
response, but don't accumulate the sample. This allows presend to work
in the interleaved client mode.

8 years agoreference: randomize reference time
Miroslav Lichvar [Wed, 23 Nov 2016 13:03:12 +0000 (14:03 +0100)] 
reference: randomize reference time

In unauthenticated interleaved symmetric NTP mode we should be now
careful with the reference timestamp as it may be useful with the peer
delay for estimating the local receive timestamp and increasing the
chance of spoofing a valid response from the peer.

When updating the reference time, add a random error of up to one second
to make it less sensitive when disclosed to NTP and cmdmon clients.

8 years agontp: don't reset polling interval when switching to/from online
Miroslav Lichvar [Wed, 23 Nov 2016 11:45:11 +0000 (12:45 +0100)] 
ntp: don't reset polling interval when switching to/from online

This allows chronyd to ramp up the polling interval even when the source
is frequently switched between the online and offline modes.

8 years agontp: fix calculation of PHC sample time
Miroslav Lichvar [Wed, 23 Nov 2016 09:06:06 +0000 (10:06 +0100)] 
ntp: fix calculation of PHC sample time

8 years agosys_linux: allow ioctls used with HW timestamping in seccomp filter
Miroslav Lichvar [Wed, 23 Nov 2016 07:57:32 +0000 (08:57 +0100)] 
sys_linux: allow ioctls used with HW timestamping in seccomp filter

8 years agontp: transpose HW RX timestamps
Miroslav Lichvar [Mon, 21 Nov 2016 15:23:57 +0000 (16:23 +0100)] 
ntp: transpose HW RX timestamps

We need to transpose HW RX timestamps as HW timestamps are normally
preamble timestamps and RX timestamps in NTP are supposed to be trailer
timestamps. Without raw sockets we don't know the length of the packet
at layer 2, so we make an assumption that UDP data start at the same
position as in the last transmitted packet which had a HW TX timestamp.

8 years agoMerge branch '2.4-stable' into HEAD
Miroslav Lichvar [Tue, 22 Nov 2016 15:06:05 +0000 (16:06 +0100)] 
Merge branch '2.4-stable' into HEAD

8 years agorefclock: don't compare sample time with samples from previous poll
Miroslav Lichvar [Mon, 21 Nov 2016 10:20:57 +0000 (11:20 +0100)] 
refclock: don't compare sample time with samples from previous poll

This is an improvement of commit 8f85291d23560508e03938bfa894294f73ad2d9e.

8 years agodoc: update NEWS 2.4-stable 2.4.1
Miroslav Lichvar [Mon, 21 Nov 2016 10:58:26 +0000 (11:58 +0100)] 
doc: update NEWS

8 years agosources: add new status for sources that overlap trusted sources
Miroslav Lichvar [Fri, 11 Nov 2016 13:04:12 +0000 (14:04 +0100)] 
sources: add new status for sources that overlap trusted sources

Sources that overlap trusted sources should be displayed in the chronyc
sources report with the '-' symbol and they shouldn't trigger a
replacement.

8 years agorefclock: don't compare sample time with samples from previous poll
Miroslav Lichvar [Mon, 21 Nov 2016 10:20:57 +0000 (11:20 +0100)] 
refclock: don't compare sample time with samples from previous poll

This is an improvement of commit 0a848e2528aaef0b3347de0b49ce50da8dc1c9a4.

8 years agorefclock: fix check for old samples
Miroslav Lichvar [Fri, 7 Oct 2016 08:59:45 +0000 (10:59 +0200)] 
refclock: fix check for old samples

The fix in commit 0a848e2528aaef0b3347de0b49ce50da8dc1c9a4 was
incorrect.

8 years agorefclock: require new samples to have newer timestamp
Miroslav Lichvar [Thu, 6 Oct 2016 13:21:43 +0000 (15:21 +0200)] 
refclock: require new samples to have newer timestamp

If all or most SHM/SOCK samples collected in a polling interval had the
same local timestamp, the dispersion could end up as nan, which could
trigger an assert failure later in the code.

Before accumulating a refclock sample, check if the timestamp is newer
than the previous one.

8 years agotest: add smooth unit test
Miroslav Lichvar [Mon, 12 Sep 2016 10:55:57 +0000 (12:55 +0200)] 
test: add smooth unit test

8 years agosmooth: fix selection of 1st stage direction
Miroslav Lichvar [Mon, 12 Sep 2016 10:23:09 +0000 (12:23 +0200)] 
smooth: fix selection of 1st stage direction

When the smoothing process is updated with extremely small (e.g.
sub-nanosecond) values, both directions may give a negative length of
the 1st or 3rd stage due to numerical errors and the selection will fail
an in assertion. Rework the code to select the direction which gives a
smaller error.

8 years agoclient: flush stdout after printing prompt
Miroslav Lichvar [Tue, 6 Sep 2016 13:47:40 +0000 (15:47 +0200)] 
client: flush stdout after printing prompt

Apparently fgets() doesn't flush stdout in some libc implementations.

8 years agoclient: fix printing of negative poll in sources report again
Miroslav Lichvar [Tue, 6 Sep 2016 13:42:00 +0000 (15:42 +0200)] 
client: fix printing of negative poll in sources report again

This was broken in commit 3f51805e6214cad5cb9a863491316937541601ec.

8 years agontp: fix processing of kernel timestamps on non-Linux systems
Miroslav Lichvar [Mon, 22 Aug 2016 11:14:45 +0000 (13:14 +0200)] 
ntp: fix processing of kernel timestamps on non-Linux systems

When the SO_TIMESTAMP socket option was enabled, the expected type of
control messages containing timestamps was SO_TIMESTAMP instead of
SCM_TIMESTAMP. This worked on Linux, where the two values are equal, but
not on the other supported systems. The timestamps were ignored and this
probably worsened the accuracy and stability of the synchronisation.

8 years agoconf: fix parsing of refclock directive
Miroslav Lichvar [Mon, 27 Jun 2016 12:38:51 +0000 (14:38 +0200)] 
conf: fix parsing of refclock directive

Don't accept refclock directive which has as the last argument an option
that requires a value.

8 years agontp: add debug message for truncated control messages
Miroslav Lichvar [Tue, 15 Nov 2016 11:13:49 +0000 (12:13 +0100)] 
ntp: add debug message for truncated control messages

8 years agontp: ignore truncated messages
Miroslav Lichvar [Tue, 15 Nov 2016 11:10:50 +0000 (12:10 +0100)] 
ntp: ignore truncated messages

Don't waste time with processing messages that don't fit in the receive
buffer as they most likely wouldn't pass the format check due to an
invalid length of an extension field.

8 years agohwclock: fix order of samples
Miroslav Lichvar [Tue, 15 Nov 2016 10:26:18 +0000 (11:26 +0100)] 
hwclock: fix order of samples

In order to trim oldest samples in the regression function, they need to
be sorted in the data arrays from the oldest to newest.

8 years agontp: detect unexpected TX updates of unknown sources
Miroslav Lichvar [Mon, 14 Nov 2016 11:18:56 +0000 (12:18 +0100)] 
ntp: detect unexpected TX updates of unknown sources

8 years agontp: improve replay protection in symmetric mode
Miroslav Lichvar [Mon, 14 Nov 2016 08:27:07 +0000 (09:27 +0100)] 
ntp: improve replay protection in symmetric mode

Always allow update from the first valid response, even if its transmit
timestamp is not newer than the currently saved timestamp. This shoud
provide a temporary protection in the case where the attacker does have
an authenticated packet from future, but the peers are using the same
polling interval and the protocol is already synchronised. This could be
also useful in the case where the attacker cannot observe the traffic
and authentication is disabled.

8 years agosched: add more random bits to timeout scheduling
Miroslav Lichvar [Mon, 14 Nov 2016 07:43:54 +0000 (08:43 +0100)] 
sched: add more random bits to timeout scheduling

Extend the random value which is included in the calculation of the
delay from 16 to 32 bits. This makes scheduling of NTP transmissions
random to one microsecond for polling intervals up to 17.

8 years agoclient: randomize sequence number in requests
Miroslav Lichvar [Fri, 11 Nov 2016 16:20:38 +0000 (17:20 +0100)] 
client: randomize sequence number in requests

Don't rely on random source port of a connected socket alone as a
protection against spoofed packets in chronyc. Generate a fully random
32-bit sequence number for each request and modify the code to not send
a new request until the timeout expires or a valid response is received.
For a monitoring protocol this should be more than good enough.

8 years agoclient: fix attempt number in requests to be in network order
Miroslav Lichvar [Fri, 11 Nov 2016 15:53:51 +0000 (16:53 +0100)] 
client: fix attempt number in requests to be in network order