]> git.ipfire.org Git - thirdparty/chrony.git/log
thirdparty/chrony.git
7 years agotest: add 125-packetloss test
Miroslav Lichvar [Thu, 15 Feb 2018 15:47:01 +0000 (16:47 +0100)] 
test: add 125-packetloss test

7 years agotest: extend 106-refclock
Miroslav Lichvar [Thu, 15 Feb 2018 13:05:26 +0000 (14:05 +0100)] 
test: extend 106-refclock

7 years agotest: extend 110-chronyc
Miroslav Lichvar [Thu, 15 Feb 2018 12:35:06 +0000 (13:35 +0100)] 
test: extend 110-chronyc

7 years agontp: keep kernel RX timestamping permanently enabled on Linux
Miroslav Lichvar [Wed, 14 Feb 2018 09:11:19 +0000 (10:11 +0100)] 
ntp: keep kernel RX timestamping permanently enabled on Linux

The Linux kernel has a counter for sockets using kernel RX timestamping
and timestamps (all) received packets only when it is not zero. However,
this counter is updated asynchronously from setsockopt(). If there are
currently no other sockets using the timestamping, it is possible that a
fast server response is received before the kernel timestamping is
actually enabled after setting the socket option and sending a request.

Open a dummy socket on start to make sure there is always at least one
timestamping socket to avoid the race condition.

7 years agoexamples: ignore non-up/down events in nm-dispatcher script
Miroslav Lichvar [Tue, 13 Feb 2018 10:44:24 +0000 (11:44 +0100)] 
examples: ignore non-up/down events in nm-dispatcher script

7 years agosys_linux: don't keep CAP_SYS_TIME with -x option
Miroslav Lichvar [Mon, 5 Feb 2018 13:00:05 +0000 (14:00 +0100)] 
sys_linux: don't keep CAP_SYS_TIME with -x option

When dropping the root privileges, don't try to keep the CAP_SYS_TIME
capability if the -x option was enabled. This allows chronyd to be
started without the capability (e.g. in containers) and also drop the
root privileges.

7 years agontp: wait for late HW TX timestamps
Miroslav Lichvar [Fri, 2 Feb 2018 10:29:23 +0000 (11:29 +0100)] 
ntp: wait for late HW TX timestamps

When sending client requests to a close and fast server, it is possible
that a response will be received before the HW transmit timestamp of
the request itself. To avoid processing of the response without the HW
timestamp, monitor events returned by select() and suspend reading of
packets from the receive queue for up to 200 microseconds. As the
requests are normally separated by at least 200 milliseconds, it is
sufficient to monitor and suspend one socket at a time.

7 years agontp: don't request TX timestamp when SW/HW timestamping is disabled
Miroslav Lichvar [Thu, 1 Feb 2018 16:24:26 +0000 (17:24 +0100)] 
ntp: don't request TX timestamp when SW/HW timestamping is disabled

7 years agontp: add missing header guard
Miroslav Lichvar [Wed, 31 Jan 2018 16:23:40 +0000 (17:23 +0100)] 
ntp: add missing header guard

7 years agosched: allow enabling/disabling individual file handler events
Miroslav Lichvar [Tue, 30 Jan 2018 14:16:44 +0000 (15:16 +0100)] 
sched: allow enabling/disabling individual file handler events

7 years agoclient: avoid reading clock after sending request
Miroslav Lichvar [Tue, 12 Dec 2017 10:03:04 +0000 (11:03 +0100)] 
client: avoid reading clock after sending request

If chronyc sent a request which caused chronyd to step the clock (e.g.
makestep, settime) and the second reading of the clock before calling
select() to wait for a response happened after the clock was stepped, a
new request could be sent immediately and chronyd would process the same
command twice. If the second request failed (e.g. a settime request too
close to the first request), chronyc would report an error.

Change the submit_request() function to read the clock only once per
select() to wait for the first response even when the clock was stepped.

7 years agoclient: remove unused file descriptor sets
Miroslav Lichvar [Tue, 5 Dec 2017 11:09:25 +0000 (12:09 +0100)] 
client: remove unused file descriptor sets

7 years agoclient: don't call select() with invalid timeout
Miroslav Lichvar [Tue, 5 Dec 2017 10:08:24 +0000 (11:08 +0100)] 
client: don't call select() with invalid timeout

If the system clock was stepped forward after chronyc sent a request and
before it read the clock in order to calculate the receive timeout,
select() could be called with a negative timeout, which resulted in an
infinite loop waiting for select() to succeed.

Fix the submit_request() function to not call select() with a negative
timeout. Also, return immediately on any error of select().

7 years agotest: extend util unit test
Miroslav Lichvar [Tue, 5 Dec 2017 09:14:19 +0000 (10:14 +0100)] 
test: extend util unit test

7 years agoutil: avoid casting to long in UTI_DoubleToTimeval()
Miroslav Lichvar [Tue, 5 Dec 2017 08:44:59 +0000 (09:44 +0100)] 
util: avoid casting to long in UTI_DoubleToTimeval()

7 years agodoc: fix typo in chronyd man page
Vincent Blut [Thu, 30 Nov 2017 21:30:10 +0000 (22:30 +0100)] 
doc: fix typo in chronyd man page

7 years agodoc: improve leapsectz description
Miroslav Lichvar [Thu, 12 Oct 2017 11:14:25 +0000 (13:14 +0200)] 
doc: improve leapsectz description

7 years agotest: add 124-tai test
Miroslav Lichvar [Wed, 11 Oct 2017 15:30:02 +0000 (17:30 +0200)] 
test: add 124-tai test

7 years agotest: check for maxchange message in check_chronyd_exit()
Miroslav Lichvar [Wed, 11 Oct 2017 15:10:04 +0000 (17:10 +0200)] 
test: check for maxchange message in check_chronyd_exit()

7 years agorefclock: improve TAI-UTC conversion
Miroslav Lichvar [Wed, 11 Oct 2017 14:57:10 +0000 (16:57 +0200)] 
refclock: improve TAI-UTC conversion

Instead of using the TAI-UTC offset which corresponds to the current
system time, get the offset for the reference time. This allows the
clock to be accurately stepped from a time with different TAI-UTC
offset.

7 years agorefclock: remove unnecessary return statements
Miroslav Lichvar [Wed, 11 Oct 2017 10:14:25 +0000 (12:14 +0200)] 
refclock: remove unnecessary return statements

7 years agorefclock: add tai option
Chris Perl [Tue, 10 Oct 2017 17:23:21 +0000 (13:23 -0400)] 
refclock: add tai option

This option is for indicating to chronyd that the reference clock is
kept in TAI and that chrony should attempt to convert from TAI to UTC by
using the timezone configured by the "leapsectz" directive.

7 years agoreference: add function to get TAI-UTC offset
Chris Perl [Tue, 10 Oct 2017 17:23:20 +0000 (13:23 -0400)] 
reference: add function to get TAI-UTC offset

7 years agorefclock: add stratum option
Andreas Steinmetz [Mon, 9 Oct 2017 08:39:20 +0000 (10:39 +0200)] 
refclock: add stratum option

7 years agoconfigure: allow to override build date
Bernhard M. Wiedemann [Thu, 5 Oct 2017 12:13:53 +0000 (14:13 +0200)] 
configure: allow to override build date

in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

7 years agonameserv: set hints for getaddrinfo() according to -4/-6 option
Miroslav Lichvar [Wed, 4 Oct 2017 09:03:11 +0000 (11:03 +0200)] 
nameserv: set hints for getaddrinfo() according to -4/-6 option

Avoid sending unnecessary DNS requests when the -4/-6 option is
specified.

7 years agoexamples: add leapsectz to configuration examples 3.2
Miroslav Lichvar [Thu, 14 Sep 2017 13:59:59 +0000 (15:59 +0200)] 
examples: add leapsectz to configuration examples

7 years agoreference: check for gmtime() error
Miroslav Lichvar [Thu, 14 Sep 2017 13:28:37 +0000 (15:28 +0200)] 
reference: check for gmtime() error

Although gmtime() is expected to convert any time of the system clock at
least in the next few NTP eras, a correct code should always check the
returned value and this shouldn't be a fatal error in handling of leap
seconds.

7 years agodoc: fix typo in chrony.conf man page
Vincent Blut [Sun, 3 Sep 2017 12:41:14 +0000 (14:41 +0200)] 
doc: fix typo in chrony.conf man page

7 years agoconf: check if GLOB_NOMAGIC is defined
Miroslav Lichvar [Fri, 1 Sep 2017 09:32:16 +0000 (11:32 +0200)] 
conf: check if GLOB_NOMAGIC is defined

This option is not supported by musl and possibly other libc
implementations.

7 years agotest: fix keys unit test
Miroslav Lichvar [Fri, 1 Sep 2017 09:28:55 +0000 (11:28 +0200)] 
test: fix keys unit test

7 years agodoc: update NEWS 3.2-pre2
Miroslav Lichvar [Tue, 29 Aug 2017 10:59:55 +0000 (12:59 +0200)] 
doc: update NEWS

7 years agoupdate copyright years
Miroslav Lichvar [Mon, 28 Aug 2017 11:07:01 +0000 (13:07 +0200)] 
update copyright years

7 years agodoc: fix spelling
Miroslav Lichvar [Mon, 28 Aug 2017 10:44:44 +0000 (12:44 +0200)] 
doc: fix spelling

Don't mix UK and US spelling.

7 years agotest: add 123-mindelay test
Miroslav Lichvar [Fri, 25 Aug 2017 14:47:18 +0000 (16:47 +0200)] 
test: add 123-mindelay test

7 years agontp: improve maxdelayratio test
Miroslav Lichvar [Fri, 25 Aug 2017 12:57:25 +0000 (14:57 +0200)] 
ntp: improve maxdelayratio test

Similarly to the maxdelaydevratio test, include in the maximum delay
dispersion which accumulated in the interval since the last sample.
Also, enable the test for symmetric associations.

7 years agosourcestats: move maxdelaydevratio test to ntp_core
Miroslav Lichvar [Fri, 25 Aug 2017 10:29:13 +0000 (12:29 +0200)] 
sourcestats: move maxdelaydevratio test to ntp_core

Instead of giving NTP-specific data to sourcestats in order to perform
the test, provide a function to get all data needed for the test in
ntp_core. While at it, improve the naming of variables.

7 years agomemory: check for overflow when (re)allocating array
Miroslav Lichvar [Thu, 24 Aug 2017 10:10:46 +0000 (12:10 +0200)] 
memory: check for overflow when (re)allocating array

When (re)allocating an array with very large number of elements using
the MallocArray or ReallocArray macros, the calculated size of the array
could overflow size_t and less memory would be allocated than requested.

Add new functions for (re)allocating arrays that check the size and use
them in the MallocArray and ReallocArray macros.

This couldn't be exploited, because all arrays that can grow with cmdmon
or NTP requests already have their size checked before allocation, or
they are much smaller than memory allocated for structures to which they
are related (i.e. ntp_core and sourcestats instances), so a memory
allocation would fail before their size could overflow.

This issue was found in an audit performed by Cure53 and sponsored by
Mozilla.

7 years agoutil: check for gmtime() error
Miroslav Lichvar [Thu, 24 Aug 2017 09:12:14 +0000 (11:12 +0200)] 
util: check for gmtime() error

Fix the UTI_TimeToLogForm() function to check if gmtime() didn't fail.
This caused chronyc to crash due to dereferencing a NULL pointer when
a response to the "manual list" request contained time which gmtime()
could not convert to broken-down representation.

This issue was found in an audit performed by Cure53 and sponsored by
Mozilla.

7 years agoconf: use enum for RX filter
Miroslav Lichvar [Wed, 23 Aug 2017 11:55:38 +0000 (13:55 +0200)] 
conf: use enum for RX filter

7 years agontp: allow TX-only HW timestamping by default
Miroslav Lichvar [Wed, 23 Aug 2017 09:33:37 +0000 (11:33 +0200)] 
ntp: allow TX-only HW timestamping by default

If no rxfilter is specified in the hwtimestamp directive and the NIC
doesn't support the all or ntp filter, enable TX-only HW timestamping
with the none filter.

7 years agohwclock: improve debug message
Miroslav Lichvar [Tue, 22 Aug 2017 11:45:09 +0000 (13:45 +0200)] 
hwclock: improve debug message

7 years agohwclock: check if estimated frequency is sane
Miroslav Lichvar [Tue, 22 Aug 2017 11:29:48 +0000 (13:29 +0200)] 
hwclock: check if estimated frequency is sane

7 years agohwclock: drop all samples on reset
Miroslav Lichvar [Tue, 22 Aug 2017 11:13:45 +0000 (13:13 +0200)] 
hwclock: drop all samples on reset

On some HW it seems it's possible to get an occasional bad reading of
the PHC (with normal delay), or in a worse case the clock can step due
to a HW/driver bug, which triggers reset of the HW clock instance. To
avoid having a bad estimate of the frequency when the next (good) sample
is accumulated, drop also the last sample which triggered the reset.

7 years agodoc: include uncorrected offset in bound on maximum error
Miroslav Lichvar [Fri, 18 Aug 2017 18:04:31 +0000 (20:04 +0200)] 
doc: include uncorrected offset in bound on maximum error

7 years agoreference: add new fields to tracking log
Miroslav Lichvar [Tue, 22 Aug 2017 13:36:43 +0000 (15:36 +0200)] 
reference: add new fields to tracking log

Add the root delay, root dispersion and maximum estimated error in the
interval since the previous update to the tracking log.

7 years agoreference: separate calculation of root dispersion
Miroslav Lichvar [Fri, 18 Aug 2017 16:44:17 +0000 (18:44 +0200)] 
reference: separate calculation of root dispersion

7 years agoreference: refactor log writing
Miroslav Lichvar [Fri, 18 Aug 2017 16:17:16 +0000 (18:17 +0200)] 
reference: refactor log writing

Remove unnecessary parameters of the write_log() function.

7 years agoreference: don't update fallback drift on manual input
Miroslav Lichvar [Fri, 18 Aug 2017 15:43:02 +0000 (17:43 +0200)] 
reference: don't update fallback drift on manual input

This fixes a crash due to assertion failure in update_fb_drifts() when
fallbackdrift is enabled and manual input is provided.

7 years agoreference: simplify check for NaN
Miroslav Lichvar [Fri, 18 Aug 2017 15:24:41 +0000 (17:24 +0200)] 
reference: simplify check for NaN

7 years agocmdmon: add new fields to ADD_SERVER/ADD_PEER request
Miroslav Lichvar [Tue, 22 Aug 2017 15:13:27 +0000 (17:13 +0200)] 
cmdmon: add new fields to ADD_SERVER/ADD_PEER request

7 years agoconf: add mindelay and asymmetry options to NTP sources
Miroslav Lichvar [Fri, 18 Aug 2017 14:20:12 +0000 (16:20 +0200)] 
conf: add mindelay and asymmetry options to NTP sources

7 years agosourcestats: add fixed asymmetry
Miroslav Lichvar [Tue, 22 Aug 2017 14:26:40 +0000 (16:26 +0200)] 
sourcestats: add fixed asymmetry

Rework the code to allow the jitter asymmetry to be specified.

7 years agosourcestats: add fixed minimum delay
Miroslav Lichvar [Thu, 17 Aug 2017 14:44:18 +0000 (16:44 +0200)] 
sourcestats: add fixed minimum delay

If the minimum delay is known (in a static network configuration), it
can replace the measured minimum from the register. This should improve
the stability of corrections for asymmetric jitter, sample weighting and
maxdelay* tests.

7 years agosys_linux: fix building with older kernel headers
Miroslav Lichvar [Tue, 15 Aug 2017 11:39:39 +0000 (13:39 +0200)] 
sys_linux: fix building with older kernel headers

Programming pins for external PHC timestamping was added in Linux 3.15,
but the PHC subsystem is older than that. Compile the programming code
only when the ioctl is defined.

7 years agoutil: simplify clamping in UTI_TimespecNetworkToHost()
Miroslav Lichvar [Tue, 15 Aug 2017 08:53:02 +0000 (10:53 +0200)] 
util: simplify clamping in UTI_TimespecNetworkToHost()

This should fix a coverity warning.

7 years agoutil: add assertion for NTP timestamp size
Miroslav Lichvar [Tue, 15 Aug 2017 08:51:44 +0000 (10:51 +0200)] 
util: add assertion for NTP timestamp size

7 years agosmooth: don't adjust invalid time of last update
Miroslav Lichvar [Tue, 15 Aug 2017 08:03:29 +0000 (10:03 +0200)] 
smooth: don't adjust invalid time of last update

7 years agoreference: don't adjust invalid reference time
Miroslav Lichvar [Tue, 15 Aug 2017 08:01:27 +0000 (10:01 +0200)] 
reference: don't adjust invalid reference time

8 years agotest: fix ntp_core unit test
Miroslav Lichvar [Wed, 9 Aug 2017 08:41:03 +0000 (10:41 +0200)] 
test: fix ntp_core unit test

This fixes commit b896bb5a783d3fc741b94bf65616b69097b5ecaf.

8 years agosys_netbsd: fix adjtime() fault on macOS
Bryan Christianson [Tue, 8 Aug 2017 17:14:05 +0000 (05:14 +1200)] 
sys_netbsd: fix adjtime() fault on macOS

On some systems, passing NULL as the first argument to adjtime, will
result in returning the amount of adjustment outstanding from a previous
call to adjtime().

On macOS this is not allowed and the adjtime call will fault. We can
simulate the behaviour of the other systems by cancelling the current
adjustment then restarting the adjustment using the outstanding time
that was returned. On macOS 10.13 and later, the netbsd driver is now
used and must use these semantics when making/measuring corrections.

8 years agoclient: fix parsing of -v command option
Miroslav Lichvar [Tue, 8 Aug 2017 12:08:30 +0000 (14:08 +0200)] 
client: fix parsing of -v command option

The sources and sourcestats commands accept -v as an option, but the
glibc implementation of getopt() reorders the arguments and parses the
option as a command-line option of chronyc.

Add '+' to the getopt string to disable this feature. Other getopt()
implementations should consider it a new command-line option, which will
be handled as an error if present.

8 years agosched: add new timeout class for peer transmissions
Miroslav Lichvar [Tue, 8 Aug 2017 11:27:30 +0000 (13:27 +0200)] 
sched: add new timeout class for peer transmissions

This allows transmissions in symmetric mode to be scheduled
independently from client transmissions. This reduces maximum delay
in scheduling when chronyd is configured with a larger number of
servers.

8 years agotest: improve hwclock unit test
Miroslav Lichvar [Fri, 4 Aug 2017 13:24:03 +0000 (15:24 +0200)] 
test: improve hwclock unit test

8 years agohwclock: fix conversion of HW timestamps
Miroslav Lichvar [Fri, 4 Aug 2017 13:08:40 +0000 (15:08 +0200)] 
hwclock: fix conversion of HW timestamps

Fix a sign error in conversion of HW time to local time, which caused
the jitter to be amplified instead of reduced. NTP with HW timestamping
should now be more stable and able to ignore occasionally delayed
readings of PHC.

8 years agontp: minimize data in client mode packets
Miroslav Lichvar [Thu, 3 Aug 2017 15:21:16 +0000 (17:21 +0200)] 
ntp: minimize data in client mode packets

In basic client mode, set the origin and receive timestamp to zero.
This reduces the amount of information useful for fingerprinting and
improves privacy as the origin timestamp allows a passive observer to
track individual NTP clients as they move across networks. (With chrony
clients that assumes the timestamp wasn't reset by the chronyc offline
and online commands.)

This follows recommendations from the current version of IETF draft on
NTP data minimization [1].

The timestamp could be theoretically useful for enhanced rate limiting
which can limit individual clients behind NAT and better deal with DoS
attacks, but no server implementation is known to do that.

[1] https://tools.ietf.org/html/draft-ietf-ntp-data-minimization-01

8 years agoexamples: improve NetworkManager dispatcher script
Miroslav Lichvar [Thu, 3 Aug 2017 14:13:05 +0000 (16:13 +0200)] 
examples: improve NetworkManager dispatcher script

When no default route is configured, check each source if it has a
route. If the system has multiple network interfaces, this prevents
setting local NTP servers to offline when they can still be reached over
one of the interfaces.

8 years agodoc: fix server mode number in chrony.conf man page
Miroslav Lichvar [Wed, 2 Aug 2017 14:51:17 +0000 (16:51 +0200)] 
doc: fix server mode number in chrony.conf man page

8 years agodoc: update chrony.conf man page for recent changes
Miroslav Lichvar [Wed, 2 Aug 2017 14:48:33 +0000 (16:48 +0200)] 
doc: update chrony.conf man page for recent changes

8 years agontp: skip IPv6 extension headers
Miroslav Lichvar [Wed, 2 Aug 2017 13:01:27 +0000 (15:01 +0200)] 
ntp: skip IPv6 extension headers

Handle IPv6 packets with extension headers received from the error queue
on Linux.

8 years agontp: don't send useless requests in interleaved client mode
Miroslav Lichvar [Wed, 2 Aug 2017 08:54:50 +0000 (10:54 +0200)] 
ntp: don't send useless requests in interleaved client mode

In interleaved client mode, when so many consecutive requests were lost
that the first valid (interleaved) response would be dropped for being
too old, switch to basic mode so the response can be accepted if it
doesn't fail in the other tests.

This reworks commit 16afa8eb5022792c1b4bf08e3b01095ca5ebd0f5.

8 years agontp: limit number of interleaved responses in symmetric mode
Miroslav Lichvar [Tue, 1 Aug 2017 15:29:47 +0000 (17:29 +0200)] 
ntp: limit number of interleaved responses in symmetric mode

In symmetric mode, don't send a packet in interleaved mode unless it is
the first response to the last valid request received from the peer and
there was just one response to the previous valid request. This prevents
the peer from matching the transmit timestamp with an older response if
it can't detect missed responses.

8 years agontp: improve detection of missed packets in interleaved mode
Miroslav Lichvar [Tue, 1 Aug 2017 10:42:35 +0000 (12:42 +0200)] 
ntp: improve detection of missed packets in interleaved mode

In interleaved symmetric mode, check if the remote TX timestamp is
before RX timestamp. Only the first response from the peer after
receiving a request should pass this test. Check also the interval
between last two remote transmit timestamps when we know the remote poll
can't be constrained by minpoll. Use the minimum of previous remote and
local poll as a lower bound of the actual interval between peer's
transmissions.

8 years agontp: enable maxdelayratio test in interleaved client mode
Miroslav Lichvar [Tue, 1 Aug 2017 08:01:53 +0000 (10:01 +0200)] 
ntp: enable maxdelayratio test in interleaved client mode

With more accurate delay in interleaved mode the test should now be as
reliable as in basic mode.

8 years agomain: fix -q option
Bryan Christianson [Mon, 31 Jul 2017 10:19:22 +0000 (22:19 +1200)] 
main: fix -q option

Attempting to step the system clock by using the -q option with chronyd
would fail.

8 years agologging: enable line buffering of file log
Miroslav Lichvar [Wed, 26 Jul 2017 15:31:34 +0000 (17:31 +0200)] 
logging: enable line buffering of file log

The file log specified with the -l option should have the messages as
soon as they are produced.

8 years agodoc: update NEWS 3.2-pre1
Miroslav Lichvar [Tue, 25 Jul 2017 15:10:14 +0000 (17:10 +0200)] 
doc: update NEWS

8 years agosys_linux: allow getrandom in seccomp filter
Miroslav Lichvar [Tue, 25 Jul 2017 13:39:23 +0000 (15:39 +0200)] 
sys_linux: allow getrandom in seccomp filter

This fixes commit c5735ebfe9065facc324b58ea4f94a9ea64c41cf.

8 years agoclient: don't allow slash with hostname in allow/deny command
Miroslav Lichvar [Tue, 25 Jul 2017 10:56:59 +0000 (12:56 +0200)] 
client: don't allow slash with hostname in allow/deny command

8 years agoconf: don't allow slash with hostname in allow/deny directive
Miroslav Lichvar [Tue, 25 Jul 2017 10:55:32 +0000 (12:55 +0200)] 
conf: don't allow slash with hostname in allow/deny directive

8 years agoreference: don't report zero stratum when synchronised
Miroslav Lichvar [Tue, 25 Jul 2017 09:27:24 +0000 (11:27 +0200)] 
reference: don't report zero stratum when synchronised

If synchronised to a stratum 15 source, return stratum of 16 instead of
0 in the tracking report. It will not match the value in server mode
packets, but it should be less confusing.

8 years agocmdmon: report offset after manual timestamp as float
Miroslav Lichvar [Tue, 25 Jul 2017 08:53:48 +0000 (10:53 +0200)] 
cmdmon: report offset after manual timestamp as float

Modify the protocol to report the offset as seconds in floating point
instead of integer number of centiseconds.

8 years agomanual: handle failed robust regression
Miroslav Lichvar [Tue, 25 Jul 2017 07:31:04 +0000 (09:31 +0200)] 
manual: handle failed robust regression

8 years agoutil: avoid undefined behavior in timestamp conversion
Miroslav Lichvar [Mon, 24 Jul 2017 13:42:27 +0000 (15:42 +0200)] 
util: avoid undefined behavior in timestamp conversion

8 years agoclient: avoid undefined bit shifts
Miroslav Lichvar [Mon, 24 Jul 2017 11:24:17 +0000 (13:24 +0200)] 
client: avoid undefined bit shifts

8 years agoregress: avoid undefined behavior in pointer arithmetic
Miroslav Lichvar [Fri, 21 Jul 2017 15:13:24 +0000 (17:13 +0200)] 
regress: avoid undefined behavior in pointer arithmetic

8 years agontp: simplify get_poll_adj()
Miroslav Lichvar [Fri, 21 Jul 2017 14:25:47 +0000 (16:25 +0200)] 
ntp: simplify get_poll_adj()

8 years agosourcestats: increase number of samples needed to check delay
Miroslav Lichvar [Fri, 21 Jul 2017 13:02:49 +0000 (15:02 +0200)] 
sourcestats: increase number of samples needed to check delay

Require at least 6 samples to check the increase in the delay of a new
sample to make it more reliable.

8 years agontp: don't accumulate old samples in interleaved client mode
Miroslav Lichvar [Fri, 21 Jul 2017 10:16:21 +0000 (12:16 +0200)] 
ntp: don't accumulate old samples in interleaved client mode

Check how many responses were missing before accumulating a sample using
old timestamps to avoid correcting the clock with an offset extrapolated
over a long interval.

This should be eventually done in sourcestats for all sources.

8 years agontp: revert reversed poll tracking in interleaved mode
Miroslav Lichvar [Fri, 21 Jul 2017 08:55:06 +0000 (10:55 +0200)] 
ntp: revert reversed poll tracking in interleaved mode

With the new selection of timestamps in the interleaved mode it's no
longer necessary to reverse the poll tracking in order to reduce the
local and remote intervals of measurements that makes the peer with
higher stratum.

This reverts commit 4a24368763cdeacc056a29dc27e0e506bd915133.

8 years agontp: select timestamps in interleaved mode
Miroslav Lichvar [Fri, 21 Jul 2017 08:45:46 +0000 (10:45 +0200)] 
ntp: select timestamps in interleaved mode

Use previous local TX and remote RX timestamps for the new sample in the
interleaved mode if it will make the local and remote intervals
significantly shorter in order to improve the accuracy of the measured
delay.

8 years agontp: refactor timestamp selection and interval calculation
Miroslav Lichvar [Fri, 21 Jul 2017 08:17:42 +0000 (10:17 +0200)] 
ntp: refactor timestamp selection and interval calculation

Prepare the code for a third option in the timestamp selection and clean
it up a bit.

8 years agontp: add function for zeroing local timestamps
Miroslav Lichvar [Fri, 21 Jul 2017 07:12:31 +0000 (09:12 +0200)] 
ntp: add function for zeroing local timestamps

8 years agontp: fix poll in source report
Miroslav Lichvar [Fri, 14 Jul 2017 16:11:49 +0000 (18:11 +0200)] 
ntp: fix poll in source report

The source report used the local interval, which in symmetric mode may
be longer than the actual interval used for transmission.

8 years agontp: ignore saved remote poll when peer is not responding
Miroslav Lichvar [Fri, 14 Jul 2017 10:43:26 +0000 (12:43 +0200)] 
ntp: ignore saved remote poll when peer is not responding

When a peer stops responding, allow our actual polling interval to be
longer than poll saved from the last valid response.

8 years agontp: reset TX counter on all valid responses
Miroslav Lichvar [Fri, 14 Jul 2017 10:04:38 +0000 (12:04 +0200)] 
ntp: reset TX counter on all valid responses

Also change it to an unsigned type.

8 years agoconfigure: fix compiler warning in getrandom() test
Miroslav Lichvar [Fri, 14 Jul 2017 08:21:31 +0000 (10:21 +0200)] 
configure: fix compiler warning in getrandom() test

8 years agoconfigure: check for hardening compiler options
Miroslav Lichvar [Thu, 13 Jul 2017 12:13:01 +0000 (14:13 +0200)] 
configure: check for hardening compiler options

If no CFLAGS are specified, check if common security hardening options
are supported and add them to the CFLAGS/LDFLAGS. These are typically
enabled in downstream packages, but users compiling chrony from sources
with default CFLAGS should get hardened binaries too.

8 years agosys_macosx: add support for ntp_adjtime() on macOS 10.13+
Bryan Christianson [Thu, 13 Jul 2017 00:18:02 +0000 (12:18 +1200)] 
sys_macosx: add support for ntp_adjtime() on macOS 10.13+

macOS 10.13 will implement the ntp_adjtime() system call, allowing
better control over the system clock than is possible with the existing
adjtime() system call. chronyd will support both the older and newer
calls, enabling binary code to run without recompilation on macOS 10.9
through macOS 10.13.

Early releases of macOS 10.13 have a very buggy adjtime() call. The
macOS driver tests adjtime() to see if the bug has been fixed. If the
bug persists then the timex driver is invoked otherwise the netbsd
driver.

8 years agomain: don't require root privileges with -Q option
Miroslav Lichvar [Wed, 12 Jul 2017 16:38:44 +0000 (18:38 +0200)] 
main: don't require root privileges with -Q option

If the -Q option is specified, disable by default pidfile, ntpport,
cmdport, Unix domain command socket, and clock control, in order to
allow starting chronyd without root privileges and/or when another
chronyd instance is already running.