]> git.ipfire.org Git - thirdparty/chrony.git/log
thirdparty/chrony.git
9 years agoconfigure: add options to set default pidfile and rtcdevice
Miroslav Lichvar [Mon, 22 Aug 2016 13:47:42 +0000 (15:47 +0200)] 
configure: add options to set default pidfile and rtcdevice

9 years agoconfigure: add option --without-clock-gettime
Bryan Christianson [Mon, 22 Aug 2016 13:03:24 +0000 (01:03 +1200)] 
configure: add option --without-clock-gettime

clock_gettime() will be ignored even if it is present

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

9 years agontp: add corrected delay to debug message in process_receive()
Miroslav Lichvar [Mon, 22 Aug 2016 11:08:27 +0000 (13:08 +0200)] 
ntp: add corrected delay to debug message in process_receive()

9 years agosourcestats: return success when loading dump file with no samples
Miroslav Lichvar [Fri, 19 Aug 2016 15:58:30 +0000 (17:58 +0200)] 
sourcestats: return success when loading dump file with no samples

9 years agosourcestats: remove warning messages from SST_LoadFromFile()
Miroslav Lichvar [Fri, 19 Aug 2016 15:53:08 +0000 (17:53 +0200)] 
sourcestats: remove warning messages from SST_LoadFromFile()

There is a generic error message in SRC_ReloadSources().

9 years agosourcestats: make reading/writing dump files Y2106 ready
Miroslav Lichvar [Fri, 19 Aug 2016 14:32:56 +0000 (16:32 +0200)] 
sourcestats: make reading/writing dump files Y2106 ready

The sample times were written and read as unsigned long, which would
overflow in year 2016 on platforms that have 32-bit long.

9 years agosources: improve naming of dump files
Miroslav Lichvar [Fri, 19 Aug 2016 14:30:22 +0000 (16:30 +0200)] 
sources: improve naming of dump files

Include IP address instead of reference ID in the name of dump file
for NTP sources and for reference clocks format the reference ID as a
hexadecimal number instead of quad dotted notation.

Also, avoid dynamic memory allocation and improve warning messages.

9 years agosourcestats: update regression after loading dump file
Miroslav Lichvar [Fri, 19 Aug 2016 14:21:27 +0000 (16:21 +0200)] 
sourcestats: update regression after loading dump file

Call SST_DoNewRegression() immediately in SST_LoadFromFile instead of
relying on SRC_ReloadSources().

9 years agolocal: fix typo in strerror() call
Bryan Christianson [Fri, 19 Aug 2016 16:19:52 +0000 (18:19 +0200)] 
local: fix typo in strerror() call

9 years agontp: add support for SO_TIMESTAMPNS socket option
Miroslav Lichvar [Thu, 18 Aug 2016 13:39:14 +0000 (15:39 +0200)] 
ntp: add support for SO_TIMESTAMPNS socket option

Enable the SO_TIMESTAMPNS option to get kernel timestamps in nanosecond
resolution.

9 years agolocal: add support for clock_gettime()
Miroslav Lichvar [Thu, 18 Aug 2016 13:07:01 +0000 (15:07 +0200)] 
local: add support for clock_gettime()

Use clock_gettime() to read the system clock in nanosecond resolution.

9 years agoutil: modify UTI_*ToDouble functions to return double directly
Miroslav Lichvar [Thu, 18 Aug 2016 10:10:09 +0000 (12:10 +0200)] 
util: modify UTI_*ToDouble functions to return double directly

9 years agoutil: rename functions dealing with integers in NTP format
Miroslav Lichvar [Thu, 18 Aug 2016 09:48:17 +0000 (11:48 +0200)] 
util: rename functions dealing with integers in NTP format

This should prevent confusion with int32_t, int64_t and other types.

9 years agoadopt struct timespec
Miroslav Lichvar [Wed, 17 Aug 2016 14:05:53 +0000 (16:05 +0200)] 
adopt struct timespec

Replace struct timeval with struct timespec as the main data type for
timestamps. This will allow the NTP code to work with timestamps in
nanosecond resolution.

9 years agoutil: return normalised timevals
Miroslav Lichvar [Wed, 17 Aug 2016 10:13:35 +0000 (12:13 +0200)] 
util: return normalised timevals

9 years agontp: don't send crypto-NAKs
Miroslav Lichvar [Wed, 17 Aug 2016 09:54:34 +0000 (11:54 +0200)] 
ntp: don't send crypto-NAKs

Crypto-NAK is useful only with Autokey where it allows quick reset
of the association. There is no plan to support Autokey and NTS will
specify its own message for authentication errors.

9 years agosourcestats: report asymmetry in statistics log
Miroslav Lichvar [Wed, 10 Aug 2016 14:17:51 +0000 (16:17 +0200)] 
sourcestats: report asymmetry in statistics log

9 years agosourcestats: correct offsets with asymmetric network jitter
Miroslav Lichvar [Wed, 10 Aug 2016 13:51:51 +0000 (15:51 +0200)] 
sourcestats: correct offsets with asymmetric network jitter

Estimate asymmetry of network jitter on the path to the source as a
slope of offset against network delay in multiple linear regression. If
the asymmetry is significant and its sign doesn't change frequently, the
measured offsets (which are used later to estimate the offset and
frequency of the clock) are corrected to correspond to the minimum
network delay. This can significantly improve the accuracy and stability
of the estimated offset and frequency.

9 years agosourcestats: add debug message for regression results
Miroslav Lichvar [Wed, 10 Aug 2016 13:10:11 +0000 (15:10 +0200)] 
sourcestats: add debug message for regression results

9 years agoregress: add linear regression with two independent variables
Miroslav Lichvar [Tue, 9 Aug 2016 13:28:32 +0000 (15:28 +0200)] 
regress: add linear regression with two independent variables

9 years agosourcestats: extend array holding peer delays
Miroslav Lichvar [Mon, 8 Aug 2016 13:51:51 +0000 (15:51 +0200)] 
sourcestats: extend array holding peer delays

Keep the same number of peer delays as offsets. This will be needed when
peer delay is included in offset correction.

9 years agoregress: save arrays of constants in single-precision
Miroslav Lichvar [Thu, 4 Aug 2016 11:59:42 +0000 (13:59 +0200)] 
regress: save arrays of constants in single-precision

No need to waste space on double precision. Also, declare them as const.

9 years agorename 'Mac OS X' to 'macOS'
Bryan Christianson [Thu, 4 Aug 2016 08:08:07 +0000 (20:08 +1200)] 
rename 'Mac OS X' to 'macOS'

From the the release of macOS Sierra (Version 10.12) the Macintosh
operating system is called 'macOS'

9 years agontp: reset tentative flag only when sample was accumulated
Miroslav Lichvar [Wed, 3 Aug 2016 10:13:22 +0000 (12:13 +0200)] 
ntp: reset tentative flag only when sample was accumulated

When selecting sources from a pool, ignore responses which didn't
produce a new sample. Sources with acceptable delay (as configured by
the maxdelay* options) should be prefered.

9 years agontp: close client sockets sooner with unsynchronised sources
Miroslav Lichvar [Wed, 3 Aug 2016 10:07:43 +0000 (12:07 +0200)] 
ntp: close client sockets sooner with unsynchronised sources

When a valid packet is received from an unsynchronised source (i.e. only
a test of leap, stratum or root distance failed), there is no point in
waiting for another packet or the RX timeout, and the client socket can
be immediately closed.

9 years agotest: add 010-multrecv
Miroslav Lichvar [Tue, 2 Aug 2016 11:44:57 +0000 (13:44 +0200)] 
test: add 010-multrecv

9 years agontp: add support for recvmmsg()
Miroslav Lichvar [Tue, 2 Aug 2016 10:17:15 +0000 (12:17 +0200)] 
ntp: add support for recvmmsg()

This is used to read multiple packets with one system call. It should
work on Linux and NetBSD.

9 years agoconfigure: include config.h in test code
Miroslav Lichvar [Tue, 2 Aug 2016 10:15:56 +0000 (12:15 +0200)] 
configure: include config.h in test code

9 years agontp: rework receiving messages
Miroslav Lichvar [Mon, 1 Aug 2016 15:25:43 +0000 (17:25 +0200)] 
ntp: rework receiving messages

Allocate buffers for received messages on heap instead of stack and
prepare the code for receiving multiple messages at the same time.

9 years agontp: align buffers for control messages
Miroslav Lichvar [Mon, 1 Aug 2016 14:57:09 +0000 (16:57 +0200)] 
ntp: align buffers for control messages

9 years agontp: add support for MS-SNTP authentication in Samba
Miroslav Lichvar [Wed, 27 Jul 2016 12:09:32 +0000 (14:09 +0200)] 
ntp: add support for MS-SNTP authentication in Samba

Add support for authenticating MS-SNTP responses in Samba (ntp_signd).
Supported is currently only the old MS-SNTP authenticator field. It's
disabled by default. It can be enabled with the --enable-ntp-signd
configure option and the ntpsigndsocket directive, which specifies the
location of the Samba ntp_signd socket.

9 years agontp: detect MS-SNTP packets
Miroslav Lichvar [Wed, 27 Jul 2016 11:28:01 +0000 (13:28 +0200)] 
ntp: detect MS-SNTP packets

When a received packet fails to authenticate, check if the digest
contains zeroes and treat it as an MS-SNTP packet with authenticator or
extended authenticator field. For now, discard these packets, i.e. don't
respond with a crypto-NAK.

9 years agontp: refactor selection of authentication mode
Miroslav Lichvar [Fri, 22 Jul 2016 13:41:42 +0000 (15:41 +0200)] 
ntp: refactor selection of authentication mode

Replace the flag that enables authentication using a symmetric key with
an enum. Specify crypto-NAK as a special mode used for responses instead
of relying on zero key ID. Also, rework check_packet_auth() to always
save the mode and key ID.

9 years agontp: check for extension fields only in NTPv4 packets
Miroslav Lichvar [Wed, 20 Jul 2016 10:47:38 +0000 (12:47 +0200)] 
ntp: check for extension fields only in NTPv4 packets

9 years agodoc: improve description of chronyc -n option
Miroslav Lichvar [Tue, 19 Jul 2016 13:43:32 +0000 (15:43 +0200)] 
doc: improve description of chronyc -n option

9 years agoclient: indicate truncated addresses/hostnames
Miroslav Lichvar [Tue, 19 Jul 2016 13:37:23 +0000 (15:37 +0200)] 
client: indicate truncated addresses/hostnames

Add symbol > to the end of the resolved hostname or address when it's
truncated.

9 years agoclient: truncate long hostnames in clients output
Miroslav Lichvar [Tue, 19 Jul 2016 13:15:40 +0000 (15:15 +0200)] 
client: truncate long hostnames in clients output

9 years agoclient: print intervals in seconds up to 1200 seconds
Miroslav Lichvar [Tue, 19 Jul 2016 12:55:29 +0000 (14:55 +0200)] 
client: print intervals in seconds up to 1200 seconds

This covers random variations in the default maximum polling interval.

9 years agosources: optimize SRC_ReportSource() a bit
Miroslav Lichvar [Tue, 19 Jul 2016 13:57:16 +0000 (15:57 +0200)] 
sources: optimize SRC_ReportSource() a bit

Remove unnecessary memset() call and use the default case of the switch
to report the unreachable state.

9 years agoaddressing: pad IPAddr struct explicitly
Miroslav Lichvar [Tue, 19 Jul 2016 13:01:56 +0000 (15:01 +0200)] 
addressing: pad IPAddr struct explicitly

9 years agoutil: round up when converting to 32-bit NTP values
Miroslav Lichvar [Tue, 19 Jul 2016 12:46:17 +0000 (14:46 +0200)] 
util: round up when converting to 32-bit NTP values

NTP clients shouldn't get root delay and dispersion smaller than the
server's values.

9 years agontp: add offset option
Miroslav Lichvar [Tue, 28 Jun 2016 13:27:44 +0000 (15:27 +0200)] 
ntp: add offset option

Add offset option to the server/pool/peer directive. It specifies a
correction which will be applied to offsets measured with the NTP
source. It's particularly useful to compensate for a known asymmetry in
network delay or timestamping errors.

9 years agoclient: rework error printing for unsupported source options
Miroslav Lichvar [Tue, 28 Jun 2016 11:26:09 +0000 (13:26 +0200)] 
client: rework error printing for unsupported source options

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

9 years agocmdparse: remove CPS_Status
Miroslav Lichvar [Mon, 27 Jun 2016 11:38:55 +0000 (13:38 +0200)] 
cmdparse: remove CPS_Status

Remove command and option specific error codes. Return zero on any
failure.

9 years agocmdparse: refactor CPS_ParseNTPSourceAdd()
Miroslav Lichvar [Mon, 27 Jun 2016 11:36:37 +0000 (13:36 +0200)] 
cmdparse: refactor CPS_ParseNTPSourceAdd()

9 years agosched: add support for output file event
Miroslav Lichvar [Wed, 22 Jun 2016 13:14:25 +0000 (15:14 +0200)] 
sched: add support for output file event

This allows waiting for non-blocking write operations.

9 years agosched: don't keep prepared fd_set
Miroslav Lichvar [Wed, 22 Jun 2016 12:21:33 +0000 (14:21 +0200)] 
sched: don't keep prepared fd_set

Instead of copying a prepared fd_set to the fd_set used by select(),
fill it from scratch according to the array of file handlers before each
select() call. This should make the code simpler and save some memory
when other events are supported.

9 years agosched: rework file handling API
Miroslav Lichvar [Thu, 16 Jun 2016 14:47:40 +0000 (16:47 +0200)] 
sched: rework file handling API

Replace SCH_*InputFileHandler() functions with more general
SCH_*FileHandler(), where events are specified as a new parameter and
which will later support other file events, e.g. file ready for ouput
and exception.

The file handlers have two new parameters: file descriptor and event.

9 years agologging: fix LOG_MESSAGE macro to not use semicolon
Miroslav Lichvar [Thu, 16 Jun 2016 15:15:04 +0000 (17:15 +0200)] 
logging: fix LOG_MESSAGE macro to not use semicolon

9 years agodoc: update NEWS 2.4
Miroslav Lichvar [Mon, 6 Jun 2016 14:48:23 +0000 (16:48 +0200)] 
doc: update NEWS

9 years agodoc: update README
Miroslav Lichvar [Mon, 6 Jun 2016 14:47:25 +0000 (16:47 +0200)] 
doc: update README

9 years agodoc: add question about reference ID to FAQ
Miroslav Lichvar [Tue, 7 Jun 2016 09:08:47 +0000 (11:08 +0200)] 
doc: add question about reference ID to FAQ

9 years agodoc: improve chronyc man page
Stephen Wadeley [Sun, 5 Jun 2016 19:01:48 +0000 (21:01 +0200)] 
doc: improve chronyc man page

- fix redundant words, word order, articles, consistency, typos
- avoid slashes, contractions, `may`, dashes in running text
- add Oxford commas
- use colon before examples

9 years agodoc: improve chrony.conf man page
Stephen Wadeley [Fri, 3 Jun 2016 07:33:34 +0000 (09:33 +0200)] 
doc: improve chrony.conf man page

- fix word order, articles, consistency, and some typos
- avoid slashes, contractions, `may`, dashes in running text
- use colons before example and code blocks
- add Oxford commas

9 years agoclient: fix compiler warnings on NetBSD
Miroslav Lichvar [Tue, 7 Jun 2016 07:34:20 +0000 (09:34 +0200)] 
client: fix compiler warnings on NetBSD

9 years agoreference: suppress orphan option in special reference modes
Miroslav Lichvar [Mon, 30 May 2016 11:59:01 +0000 (13:59 +0200)] 
reference: suppress orphan option in special reference modes

This allows a server that will become the orphan source to initialize
its time with the initstepslew directive from the current orphan source
or its clients.

9 years agodoc: improve answer in FAQ for firewall issue
Miroslav Lichvar [Mon, 23 May 2016 07:00:42 +0000 (09:00 +0200)] 
doc: improve answer in FAQ for firewall issue

9 years agoexamples: update chrony.spec
Miroslav Lichvar [Tue, 17 May 2016 15:57:33 +0000 (17:57 +0200)] 
examples: update chrony.spec

9 years agotest: extend 105-ntpauth
Miroslav Lichvar [Tue, 17 May 2016 10:55:54 +0000 (12:55 +0200)] 
test: extend 105-ntpauth

9 years agontp: fix definition of minimum and maximum MAC length
Miroslav Lichvar [Tue, 17 May 2016 10:49:52 +0000 (12:49 +0200)] 
ntp: fix definition of minimum and maximum MAC length

The NTP_*_MAC_LENGTH macros didn't include the key ID, which caused the
NTP authentication check to ignore MACs with 512-bit hashes (SHA512,
WHIRLPOOL).

This was broken since update to NTPv4.

9 years agodoc: update NEWS 2.4-pre1
Miroslav Lichvar [Mon, 16 May 2016 09:08:00 +0000 (11:08 +0200)] 
doc: update NEWS

9 years agomake_release: update for changes in documentation
Miroslav Lichvar [Fri, 13 May 2016 10:28:32 +0000 (12:28 +0200)] 
make_release: update for changes in documentation

9 years agomakefile: remove config.h and config.log in distclean
Miroslav Lichvar [Fri, 13 May 2016 10:27:51 +0000 (12:27 +0200)] 
makefile: remove config.h and config.log in distclean

9 years agoupdate copyright years
Miroslav Lichvar [Fri, 13 May 2016 11:29:10 +0000 (13:29 +0200)] 
update copyright years

9 years agodoc: update examples of configuration in isolated networks
Miroslav Lichvar [Thu, 12 May 2016 15:18:29 +0000 (17:18 +0200)] 
doc: update examples of configuration in isolated networks

9 years agodoc: fix typo in chronyc man page
Miroslav Lichvar [Thu, 12 May 2016 13:24:12 +0000 (15:24 +0200)] 
doc: fix typo in chronyc man page

9 years agodoc: update FAQ
Miroslav Lichvar [Thu, 12 May 2016 13:21:26 +0000 (15:21 +0200)] 
doc: update FAQ

9 years agontp: don't check for synchronization loop in special reference modes
Miroslav Lichvar [Thu, 12 May 2016 13:43:42 +0000 (15:43 +0200)] 
ntp: don't check for synchronization loop in special reference modes

If a special reference mode is enabled, always pass the test for
synchronization loop. This allows chronyd using the initstepslew
directive (or the -q/-Q option) to accept time from its own clients
after restart as is documented in the chrony.conf man page.

This was broken since update to NTPv4.

9 years agorefclock: avoid reallocation of refclock instances
Miroslav Lichvar [Wed, 11 May 2016 14:31:51 +0000 (16:31 +0200)] 
refclock: avoid reallocation of refclock instances

Change the array with refclock instances to store just pointers and
avoid reallocation of the instances. This fixes a bug with the SOCK
refclock, which uses the pointer to the instance in a file handler and
which was invalid when the instance was reallocated (after adding
another refclock).

The bug is from commit d92583ed330f4c1f5f29fc1fc7c01d2a19d12319.

9 years agosched: fix handling of signals after finalization
Miroslav Lichvar [Fri, 15 Apr 2016 12:49:03 +0000 (14:49 +0200)] 
sched: fix handling of signals after finalization

Don't require the scheduler to be initialized in SCH_QuitProgram().
This fixes a crash when a signal is received between scheduler
finalization and chronyd exit.

9 years agosources: consider only reachable orphans for selection
Miroslav Lichvar [Wed, 13 Apr 2016 09:43:36 +0000 (11:43 +0200)] 
sources: consider only reachable orphans for selection

Ignore orphan sources that are unreachable (but still have usable stats)
to have a quick and consistent source selection between orphans.

This also fixes the "Unknown local refid in orphan mode" error appearing
when a selected orphan source is removed, as the source is marked as
unreachable and the selection runs with disabled NTP instance before the
source instance is actually removed.

9 years agodoc: fix typos in man pages
Miroslav Lichvar [Tue, 12 Apr 2016 10:31:04 +0000 (12:31 +0200)] 
doc: fix typos in man pages

9 years agodoc: improve answer in FAQ for error 501 Not authorised
Miroslav Lichvar [Tue, 12 Apr 2016 10:27:31 +0000 (12:27 +0200)] 
doc: improve answer in FAQ for error 501 Not authorised

9 years agodoc: use https in links to chrony website
Miroslav Lichvar [Tue, 12 Apr 2016 10:01:46 +0000 (12:01 +0200)] 
doc: use https in links to chrony website

9 years agoclient: initialize variables in new local command
Miroslav Lichvar [Mon, 11 Apr 2016 06:28:45 +0000 (08:28 +0200)] 
client: initialize variables in new local command

9 years agoreference: rework activation of local reference
Miroslav Lichvar [Fri, 8 Apr 2016 13:50:27 +0000 (15:50 +0200)] 
reference: rework activation of local reference

Instead of using a timer for switching the reference to the
unsynchronised state (which activates the local reference), check
if it should be active when returning the reference parameters.

9 years agoreference: return real sync status in REF_GetReferenceParams()
Miroslav Lichvar [Fri, 8 Apr 2016 14:10:02 +0000 (16:10 +0200)] 
reference: return real sync status in REF_GetReferenceParams()

If local reference is active, return normal leap, but unsynchronised
status. Update the callers of the function to work with the leap
directly and not change their behaviour.

REF_IsLocalActive() is no longer needed.

9 years agoreference: report same values in tracking command as in NTP
Miroslav Lichvar [Thu, 7 Apr 2016 15:09:01 +0000 (17:09 +0200)] 
reference: report same values in tracking command as in NTP

Use REF_GetReferenceParams() in the tracking command to simplify the
code and report the same values as what NTP clients of the server see.

When the local reference mode is active, this changes the leap status to
synchronised and reference time to one second behind current time. When
not synchronised, the root delay and root dispersion are now 1 second.

9 years agostubs: add NSR_GetLocalRefid()
Miroslav Lichvar [Fri, 8 Apr 2016 10:41:13 +0000 (12:41 +0200)] 
stubs: add NSR_GetLocalRefid()

9 years agocmdmon: extend local command to match local directive
Miroslav Lichvar [Thu, 7 Apr 2016 14:33:23 +0000 (16:33 +0200)] 
cmdmon: extend local command to match local directive

9 years agoreference: clamp local stratum set from cmdmon
Miroslav Lichvar [Fri, 8 Apr 2016 10:34:48 +0000 (12:34 +0200)] 
reference: clamp local stratum set from cmdmon

9 years agocmdparse: check if stratum in local directive is valid
Miroslav Lichvar [Wed, 6 Apr 2016 14:38:14 +0000 (16:38 +0200)] 
cmdparse: check if stratum in local directive is valid

9 years agocmdmon: remove obsolete definition
Miroslav Lichvar [Wed, 6 Apr 2016 13:56:12 +0000 (15:56 +0200)] 
cmdmon: remove obsolete definition

9 years agontp: ignore order of resolved addresses when replacing tentative source
Miroslav Lichvar [Tue, 5 Apr 2016 15:15:26 +0000 (17:15 +0200)] 
ntp: ignore order of resolved addresses when replacing tentative source

If the replaced source never had a valid reply (e.g. because it was a
bad replacement), ignore the order of addresses from the resolver to not
get stuck to a pair of addresses if the order doesn't change, or a group
of IPv4/IPv6 addresses if the resolver prefers inaccessible IP family.

9 years agontp: mark all new sources and replacements as tentative
Miroslav Lichvar [Mon, 4 Apr 2016 16:09:34 +0000 (18:09 +0200)] 
ntp: mark all new sources and replacements as tentative

9 years agodoc: update description of local directive
Miroslav Lichvar [Fri, 1 Apr 2016 16:42:43 +0000 (18:42 +0200)] 
doc: update description of local directive

9 years agontp: don't check reference timestamp in received packets
Miroslav Lichvar [Fri, 1 Apr 2016 12:24:04 +0000 (14:24 +0200)] 
ntp: don't check reference timestamp in received packets

When ntpd as an NTP server has active orphan mode, it doesn't update
its reference time and the reference timestamp may fail the NTP test
3 and 7. (https://bugs.ntp.org/show_bug.cgi?id=1098)

Remove both checks of the timestamp to allow chronyd to operate as
a client of ntpd server in the orphan mode. When ntpd is fixed and
old versions are no longer used, this may be reverted.

9 years agosources: log error when local refid is unknown in orphan mode
Miroslav Lichvar [Fri, 1 Apr 2016 07:37:49 +0000 (09:37 +0200)] 
sources: log error when local refid is unknown in orphan mode

9 years agotest: add 121-orphan
Miroslav Lichvar [Thu, 31 Mar 2016 13:57:56 +0000 (15:57 +0200)] 
test: add 121-orphan

9 years agosources: add support for orphan sources
Miroslav Lichvar [Wed, 30 Mar 2016 15:39:49 +0000 (17:39 +0200)] 
sources: add support for orphan sources

When the local reference is configured with the orphan option, NTP
sources that have stratum equal to the configured local stratum are
considered to be orphans (i.e. serving local time while not being
synchronised with real time) and are excluded from the normal source
selection. Sources with stratum larger than the local stratum are
considered to be directly on indirectly synchronised to an orphan and
are always ignored.

If no selectable source is available and all orphan sources have
reference IDs larger than the local ID, no source will be selected and
the local reference mode will be activated at some point, i.e. this host
will become an orphan. Otherwise, the orphan source with the smallest
reference ID will be selected. This ensures a group of servers polling
each other (with the same orphan configuration) which have no external
source can settle down to a state where only one server is serving its
local unsychronised time and others are synchronised to it.

9 years agoreference: add orphan mode to local reference
Miroslav Lichvar [Wed, 30 Mar 2016 15:39:14 +0000 (17:39 +0200)] 
reference: add orphan mode to local reference

Add orphan option to the local directive. It will enable an orphan mode
compatible with ntpd.

9 years agoreference: activate local reference with large root distance
Miroslav Lichvar [Wed, 30 Mar 2016 15:12:12 +0000 (17:12 +0200)] 
reference: activate local reference with large root distance

Since the update to NTPv4, when the clock is in the synchronised state
and the clock updates stop (e.g. sources become unreachable), it doesn't
switch to the unsynchronised state and the local reference is never
activate. This can be a problem for clients that rely on the server to
always have root distance below some value (e.g. chronyd's maxdistance).

Add a timer that will activate the local reference when the root
distance reaches a specified threshold. It can be configured with the
distance option in the local directive (by default 1.0 second).

9 years agoconf: rework local directive to have default stratum
Miroslav Lichvar [Wed, 30 Mar 2016 13:58:45 +0000 (15:58 +0200)] 
conf: rework local directive to have default stratum

Allow the local directive to be specified without the stratum field.
It's an option now, with default value 10. Also, move the parsing code
to cmdparse.c to make it available to the client.

9 years agontp: add function to get local reference ID
Miroslav Lichvar [Wed, 30 Mar 2016 09:02:04 +0000 (11:02 +0200)] 
ntp: add function to get local reference ID

When a valid NTP reply is received, save the local address (e.g. from
IP_PKTINFO), so the reference ID which would the source use for this
host can be calculated when needed.

9 years agosys_linux: include <termios.h> for TCGETS
Miroslav Lichvar [Tue, 29 Mar 2016 08:06:21 +0000 (10:06 +0200)] 
sys_linux: include <termios.h> for TCGETS

9 years agolocal: make maximum frequency offset configurable
Miroslav Lichvar [Tue, 22 Mar 2016 16:07:46 +0000 (17:07 +0100)] 
local: make maximum frequency offset configurable

Add maxdrift directive to set the maximum assumed drift of the clock,
which sets the maximum frequency offset chronyd is allowed to use to
to correct the drift.

9 years agosources: try to replace NTP sources with bad distance
Miroslav Lichvar [Tue, 22 Mar 2016 16:01:38 +0000 (17:01 +0100)] 
sources: try to replace NTP sources with bad distance

Similarly to unreachable sources and falsetickers, try to replace
sources with distance larger than the limit set by the maxdistance
directive with a newly resolved address of the hostname.

9 years agoclient: ignore -v option in csv mode
Miroslav Lichvar [Fri, 18 Mar 2016 13:28:53 +0000 (14:28 +0100)] 
client: ignore -v option in csv mode