]> git.ipfire.org Git - thirdparty/chrony.git/log
thirdparty/chrony.git
8 years agotest: fix keys unit test
Miroslav Lichvar [Fri, 1 Sep 2017 09:28:55 +0000 (11:28 +0200)] 
test: fix keys unit test

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

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

8 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.

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

8 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.

8 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.

8 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.

8 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.

8 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

8 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.

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

8 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

8 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.

8 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

8 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.

8 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

8 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.

8 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.

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

8 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

8 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

8 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.

8 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.

8 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.

8 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.

8 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

8 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

8 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.

8 years agontp: define NTP port for configuration code
Miroslav Lichvar [Wed, 12 Jul 2017 16:12:32 +0000 (18:12 +0200)] 
ntp: define NTP port for configuration code

8 years agomain: refactor check of pidfile
Miroslav Lichvar [Wed, 12 Jul 2017 15:30:19 +0000 (17:30 +0200)] 
main: refactor check of pidfile

8 years agosys_timex: fix update of TAI offset on non-Linux systems
Miroslav Lichvar [Mon, 10 Jul 2017 13:51:06 +0000 (15:51 +0200)] 
sys_timex: fix update of TAI offset on non-Linux systems

The tai field in struct timex is a Linux-specific feature. It's possible
to read the current offset with ntp_gettime() (or ntp_gettimex() on
Linux), but apparently not all libc implementations support it.

Rework the code to save and adjust the last value instead of reading
the current value from the kernel.

8 years agosys_timex: rename status variable
Miroslav Lichvar [Mon, 10 Jul 2017 12:48:47 +0000 (14:48 +0200)] 
sys_timex: rename status variable

8 years agontp: fix debug message about unknown HW timestamping ifindex
Miroslav Lichvar [Fri, 30 Jun 2017 13:39:10 +0000 (15:39 +0200)] 
ntp: fix debug message about unknown HW timestamping ifindex

8 years agontp: reverse poll tracking in interleaved symmetric mode
Miroslav Lichvar [Fri, 30 Jun 2017 13:18:40 +0000 (15:18 +0200)] 
ntp: reverse poll tracking in interleaved symmetric mode

Unlike in the basic mode, the peer with a higher stratum needs to wait
for a response before sending the next request in order to minimize the
delay of the measurement and error in the measured delay.

Slightly increase the delay adjustment to make it work with older chrony
versions.

8 years agontp: fix poll interleaving with unsynchronised peers
Miroslav Lichvar [Fri, 30 Jun 2017 09:32:19 +0000 (11:32 +0200)] 
ntp: fix poll interleaving with unsynchronised peers

Update the remote poll and remote stratum even for unsychronised peers,
and handle stratum of 0 as 16, so the peers work with the opposite
differences between their strata and can adjust their polling intervals
in order to interleave the packets.

8 years agohwclock: decrease tolerance of robust regression to 0.1 ppb
Miroslav Lichvar [Fri, 30 Jun 2017 07:40:06 +0000 (09:40 +0200)] 
hwclock: decrease tolerance of robust regression to 0.1 ppb

8 years agoreference: get TAI-UTC offset from leap second timezone
Miroslav Lichvar [Thu, 29 Jun 2017 15:56:16 +0000 (17:56 +0200)] 
reference: get TAI-UTC offset from leap second timezone

Use the timezone specified by the leapsectz directive to get the
current TAI-UTC offset and set the offset of the system clock in order
to provide correct TAI time to applications using ntp_adjtime(),
ntp_gettime(), or clock_gettime(CLOCK_TAI).

8 years agosys_timex: add support for setting TAI-UTC offset
Miroslav Lichvar [Thu, 29 Jun 2017 13:16:20 +0000 (15:16 +0200)] 
sys_timex: add support for setting TAI-UTC offset

8 years agolocal: add support for setting TAI-UTC offset
Miroslav Lichvar [Thu, 29 Jun 2017 13:14:16 +0000 (15:14 +0200)] 
local: add support for setting TAI-UTC offset

8 years agoreference: move static tz variables to function using them
Miroslav Lichvar [Thu, 29 Jun 2017 10:39:42 +0000 (12:39 +0200)] 
reference: move static tz variables to function using them

8 years agoclient: check IP address family before printing as refid
Miroslav Lichvar [Wed, 28 Jun 2017 12:05:41 +0000 (14:05 +0200)] 
client: check IP address family before printing as refid

8 years agoconfigure: add missing object for PHC refclock
Miroslav Lichvar [Tue, 27 Jun 2017 12:41:49 +0000 (14:41 +0200)] 
configure: add missing object for PHC refclock

This fixes commit eceb8d99371a129ad6e11f483a0442d97a895b19.

8 years agotest: add regress unit test
Miroslav Lichvar [Tue, 27 Jun 2017 10:39:00 +0000 (12:39 +0200)] 
test: add regress unit test

8 years agotest: fix crash when printing debug messages
Miroslav Lichvar [Mon, 26 Jun 2017 16:35:57 +0000 (18:35 +0200)] 
test: fix crash when printing debug messages

This fixes commit 6cbeb107db8f687c6c2298b1d8a6240e4da31116.

8 years agosourcestats: use median distance in weight calculation
Miroslav Lichvar [Mon, 26 Jun 2017 11:54:48 +0000 (13:54 +0200)] 
sourcestats: use median distance in weight calculation

Replace mean distance with median distance in the weight calculation.
This should make the weights less sensitive to outliers.

8 years agoregress: provide function to find median
Miroslav Lichvar [Wed, 21 Jun 2017 17:11:10 +0000 (19:11 +0200)] 
regress: provide function to find median

8 years agoregress: reduce maximum number of points to 64
Miroslav Lichvar [Tue, 27 Jun 2017 11:27:32 +0000 (13:27 +0200)] 
regress: reduce maximum number of points to 64

This corresponds to the maximum number of points used by regress users.

8 years agoregress: use chars instead of ints for flags
Miroslav Lichvar [Thu, 22 Jun 2017 16:32:25 +0000 (18:32 +0200)] 
regress: use chars instead of ints for flags

This reduces the size of the flags array on stack.

8 years agoregress: fix assertion in robust regression
Miroslav Lichvar [Tue, 27 Jun 2017 11:26:39 +0000 (13:26 +0200)] 
regress: fix assertion in robust regression

8 years agoregress: speed up range expansion in robust regression
Miroslav Lichvar [Tue, 27 Jun 2017 08:03:05 +0000 (10:03 +0200)] 
regress: speed up range expansion in robust regression

Instead of repeatedly expanding the range of b with the same increment,
double the range on each iteration to speed up the expansion. Also, add
a sanity check for the interval.

8 years agoregress: fix robust regression
Miroslav Lichvar [Thu, 22 Jun 2017 13:35:37 +0000 (15:35 +0200)] 
regress: fix robust regression

The bisection always terminated after one iteration. Change the code to
check if the middle is different from the lower and upper limits as
suggested in the original recipe.

This fixes commit b14689d59b06ec21a9e079c65a0882b7bf457448.

8 years agosourcestats: include precision in weight calculation
Miroslav Lichvar [Wed, 21 Jun 2017 15:48:26 +0000 (17:48 +0200)] 
sourcestats: include precision in weight calculation

In order to stabilize the weights of refclock samples which have only
slightly different distances, don't allow the stddev value used in the
weight calculation to be smaller than the precision and also assign
weight of 1 to all samples which have distance < minimum + precision.

8 years agoconf: abort when include directive fails
Miroslav Lichvar [Tue, 20 Jun 2017 15:43:26 +0000 (17:43 +0200)] 
conf: abort when include directive fails

When parsing the include directive, call glob() with the GLOB_ERR and
GLOB_NOMAGIC flags, and abort with an error message when matching of the
pattern failed with other error than GLOB_NOMATCH.

This restores the original behavior of the directive when it didn't
allow patterns, but it will still not fail with patterns not matching
any files in an existing directory.

8 years agorefclock: set default precision to precision of system clock
Miroslav Lichvar [Fri, 16 Jun 2017 11:39:01 +0000 (13:39 +0200)] 
refclock: set default precision to precision of system clock

8 years agontp: suggest clients to increase their polling interval
Miroslav Lichvar [Fri, 16 Jun 2017 10:16:17 +0000 (12:16 +0200)] 
ntp: suggest clients to increase their polling interval

When the poll value in a client request is smaller than the server's NTP
rate limiting interval, set poll in the response to the rate limiting
interval to suggest the client to increase its polling interval.

This follows ntpd as a server. No current client implementation seems to
be increasing its interval by the poll, but it may change in the future.

8 years agoutil: add support for getrandom()
Miroslav Lichvar [Thu, 15 Jun 2017 15:35:33 +0000 (17:35 +0200)] 
util: add support for getrandom()

Add support for the Linux getrandom() system call, which is available
in glibc since 2.25.

8 years agontp: apply HW TX/RX compensation to system time
Miroslav Lichvar [Thu, 15 Jun 2017 09:16:57 +0000 (11:16 +0200)] 
ntp: apply HW TX/RX compensation to system time

Apply the compensation to the cooked local time instead of HW time. This
might make a difference when the HW clock has a large frequency error.

8 years agodoc: update description of hwtimestamp directive
Miroslav Lichvar [Wed, 14 Jun 2017 11:18:11 +0000 (13:18 +0200)] 
doc: update description of hwtimestamp directive