diff options
author | Vincent Blut <vincent.debian@free.fr> | 2023-12-05 16:22:00 +0100 |
---|---|---|
committer | Vincent Blut <vincent.debian@free.fr> | 2023-12-05 16:22:00 +0100 |
commit | f177b7011cffb9b00d1479fdb8918455ef3a4127 (patch) | |
tree | 18549ff498338f40ecf7aa327620abf4c1c3ee43 | |
parent | 5be3ceeca4663468bb24573d6649071cb6612f40 (diff) |
New upstream version 4.5
-rw-r--r-- | FAQ | 20 | ||||
-rw-r--r-- | INSTALL | 2 | ||||
-rw-r--r-- | doc/chrony.conf.adoc | 6 | ||||
-rw-r--r-- | doc/chrony.conf.man.in | 10 | ||||
-rw-r--r-- | doc/chronyc.adoc | 4 | ||||
-rw-r--r-- | doc/chronyc.man.in | 8 | ||||
-rw-r--r-- | doc/chronyd.man.in | 4 | ||||
-rw-r--r-- | doc/faq.adoc | 15 | ||||
-rw-r--r-- | siv_gnutls.c | 2 | ||||
-rw-r--r-- | socket.c | 1 | ||||
-rw-r--r-- | sources.c | 56 | ||||
-rw-r--r-- | test/unit/util.c | 2 | ||||
-rw-r--r-- | version.txt | 2 |
13 files changed, 94 insertions, 38 deletions
@@ -409,13 +409,23 @@ outliers corrupting the minimum delay. For example: server ntp.local minpoll -7 maxpoll -7 filter 31 maxdelayquant 0.3 xleave -As an experimental feature added in version 4.2, chronyd supports an NTPv4 -extension field containing an additional timestamp to enable frequency transfer -and significantly improve stability of synchronisation. It can be enabled by -the extfield F323 option. For example: +Since version 4.2, chronyd supports an NTPv4 extension field containing an +additional timestamp to enable frequency transfer and significantly improve +stability of synchronisation. It can be enabled by the extfield F323 option. +For example: server ntp.local minpoll 0 maxpoll 0 xleave extfield F323 +Since version 4.5, chronyd can apply corrections from PTP one-step end-to-end +transparent clocks (e.g. network switches) to significantly improve accuracy of +synchronisation in local networks. It requires the PTP transport to be enabled +by the ptpport directive, HW timestamping, and the extfield F324 option. For +example: + +server ntp.local minpoll -4 maxpoll -4 xleave extfield F323 extfield F324 port 319 +ptpport 319 +hwtimestamp eth0 minpoll -4 + 2.8. Does chronyd have an ntpdate mode? Yes. With the -q option chronyd will set the system clock once and exit. With @@ -1146,4 +1156,4 @@ needs to be made to work as a service. We have no plans to do this. Anyone is welcome to pick this work up and contribute it back to the project. -Last updated 2023-11-22 13:53:23 +0100 +Last updated 2023-12-05 14:22:10 +0100 @@ -162,4 +162,4 @@ tar cvf - . | gzip -9 > chrony.tar.gz to build a package. When untarred within the root directory, this will install the files to the intended final locations. -Last updated 2023-11-22 13:53:23 +0100 +Last updated 2023-12-05 14:22:10 +0100 diff --git a/doc/chrony.conf.adoc b/doc/chrony.conf.adoc index abb8403..cb3f95c 100644 --- a/doc/chrony.conf.adoc +++ b/doc/chrony.conf.adoc @@ -339,8 +339,10 @@ Protocol (PTP) correction field in NTP-over-PTP messages updated by one-step end-to-end transparent clocks in network switches and routers to significantly improve accuracy and stability of the synchronisation. NTP-over-PTP can be enabled by the <<ptpport,*ptpport*>> directive and setting the *port* option to -the PTP port. This field should be enabled only for servers known to be running -*chronyd* version 4.5 or later. +the PTP port. The corrections are applied only to NTP measurements with HW +timestamps (enabled by the <<hwtimestamp,*hwtimestamp*>> directive). This +field should be enabled only for servers known to be running *chronyd* version +4.5 or later. {blank}::: [[pool]]*pool* _name_ [_option_]...:: diff --git a/doc/chrony.conf.man.in b/doc/chrony.conf.man.in index 6b4f8fb..66d2358 100644 --- a/doc/chrony.conf.man.in +++ b/doc/chrony.conf.man.in @@ -2,12 +2,12 @@ .\" Title: chrony.conf .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.20 -.\" Date: 2023-11-22 +.\" Date: 2023-12-05 .\" Manual: Configuration Files .\" Source: chrony @CHRONY_VERSION@ .\" Language: English .\" -.TH "CHRONY.CONF" "5" "2023-11-22" "chrony @CHRONY_VERSION@" "Configuration Files" +.TH "CHRONY.CONF" "5" "2023-12-05" "chrony @CHRONY_VERSION@" "Configuration Files" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -443,8 +443,10 @@ Protocol (PTP) correction field in NTP\-over\-PTP messages updated by one\-step end\-to\-end transparent clocks in network switches and routers to significantly improve accuracy and stability of the synchronisation. NTP\-over\-PTP can be enabled by the \fBptpport\fP directive and setting the \fBport\fP option to -the PTP port. This field should be enabled only for servers known to be running -\fBchronyd\fP version 4.5 or later. +the PTP port. The corrections are applied only to NTP measurements with HW +timestamps (enabled by the \fBhwtimestamp\fP directive). This +field should be enabled only for servers known to be running \fBchronyd\fP version +4.5 or later. .RE .RE .sp diff --git a/doc/chronyc.adoc b/doc/chronyc.adoc index 9d35e6f..96a0551 100644 --- a/doc/chronyc.adoc +++ b/doc/chronyc.adoc @@ -986,6 +986,10 @@ command might replace the addresses even if they are still in the pool. The *reload sources* command causes *chronyd* to re-read all _*.sources_ files from the directories specified by the <<chrony.conf.adoc#sourcedir,*sourcedir*>> directive. ++ +Note that modified sources (e.g. specified with a new option) are not modified +in memory. They are removed and added again, which causes them to lose old +measurements and reset the selection state. [[sourcename]]*sourcename* _address_:: The *sourcename* command prints the original hostname or address that was diff --git a/doc/chronyc.man.in b/doc/chronyc.man.in index 38d8853..4541fc6 100644 --- a/doc/chronyc.man.in +++ b/doc/chronyc.man.in @@ -2,12 +2,12 @@ .\" Title: chronyc .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.20 -.\" Date: 2023-11-22 +.\" Date: 2023-12-05 .\" Manual: User manual .\" Source: chrony @CHRONY_VERSION@ .\" Language: English .\" -.TH "CHRONYC" "1" "2023-11-22" "chrony @CHRONY_VERSION@" "User manual" +.TH "CHRONYC" "1" "2023-12-05" "chrony @CHRONY_VERSION@" "User manual" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -1802,6 +1802,10 @@ command might replace the addresses even if they are still in the pool. The \fBreload sources\fP command causes \fBchronyd\fP to re\-read all \fI*.sources\fP files from the directories specified by the \fBsourcedir\fP directive. +.sp +Note that modified sources (e.g. specified with a new option) are not modified +in memory. They are removed and added again, which causes them to lose old +measurements and reset the selection state. .RE .sp \fBsourcename\fP \fIaddress\fP diff --git a/doc/chronyd.man.in b/doc/chronyd.man.in index 3edaa3a..96e87a0 100644 --- a/doc/chronyd.man.in +++ b/doc/chronyd.man.in @@ -2,12 +2,12 @@ .\" Title: chronyd .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.20 -.\" Date: 2023-11-22 +.\" Date: 2023-12-05 .\" Manual: System Administration .\" Source: chrony @CHRONY_VERSION@ .\" Language: English .\" -.TH "CHRONYD" "8" "2023-11-22" "chrony @CHRONY_VERSION@" "System Administration" +.TH "CHRONYD" "8" "2023-12-05" "chrony @CHRONY_VERSION@" "System Administration" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 diff --git a/doc/faq.adoc b/doc/faq.adoc index 32210c7..8fd350f 100644 --- a/doc/faq.adoc +++ b/doc/faq.adoc @@ -1,6 +1,7 @@ // This file is part of chrony // // Copyright (C) Richard P. Curnow 1997-2003 +// Copyright (C) Luke Valenta 2023 // Copyright (C) Miroslav Lichvar 2014-2016, 2020-2023 // // This program is free software; you can redistribute it and/or modify @@ -381,7 +382,7 @@ outliers corrupting the minimum delay. For example: server ntp.local minpoll -7 maxpoll -7 filter 31 maxdelayquant 0.3 xleave ---- -As an experimental feature added in version 4.2, `chronyd` supports an NTPv4 +Since version 4.2, `chronyd` supports an NTPv4 extension field containing an additional timestamp to enable frequency transfer and significantly improve stability of synchronisation. It can be enabled by the `extfield F323` option. For example: @@ -390,6 +391,18 @@ the `extfield F323` option. For example: server ntp.local minpoll 0 maxpoll 0 xleave extfield F323 ---- +Since version 4.5, `chronyd` can apply corrections from PTP one-step end-to-end +transparent clocks (e.g. network switches) to significantly improve accuracy of +synchronisation in local networks. It requires the PTP transport to be enabled +by the `ptpport` directive, HW timestamping, and the `extfield F324` option. +For example: + +---- +server ntp.local minpoll -4 maxpoll -4 xleave extfield F323 extfield F324 port 319 +ptpport 319 +hwtimestamp eth0 minpoll -4 +---- + === Does `chronyd` have an ntpdate mode? Yes. With the `-q` option `chronyd` will set the system clock once and exit. diff --git a/siv_gnutls.c b/siv_gnutls.c index 04628eb..a0a712c 100644 --- a/siv_gnutls.c +++ b/siv_gnutls.c @@ -2,7 +2,7 @@ chronyd/chronyc - Programs for keeping computer clocks accurate. ********************************************************************** - * Copyright (C) Miroslav Lichvar 2020 + * Copyright (C) Miroslav Lichvar 2020, 2023 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as @@ -5,6 +5,7 @@ * Copyright (C) Richard P. Curnow 1997-2003 * Copyright (C) Timo Teras 2009 * Copyright (C) Miroslav Lichvar 2009, 2013-2020 + * Copyright (C) Luke Valenta 2023 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as @@ -174,6 +174,9 @@ static int selected_source_index; /* Which source index is currently if no current valid reference) */ static int reported_no_majority; /* Flag to avoid repeated log message about no majority */ +static int report_selection_loss; /* Flag to force logging a message if + selection is lost in a transient state + (SRC_WAITS_STATS, SRC_WAITS_UPDATE) */ /* Score needed to replace the currently selected source */ #define SCORE_LIMIT 10.0 @@ -201,6 +204,8 @@ static LOG_FileID logfileid; /* Forward prototype */ static void update_sel_options(void); +static void unselect_selected_source(LOG_Severity severity, const char *format, + const char *arg); static void slew_sources(struct timespec *raw, struct timespec *cooked, double dfreq, double doffset, LCL_ChangeType change_type, void *anything); static void add_dispersion(double dispersion, void *anything); @@ -314,12 +319,8 @@ void SRC_DestroyInstance(SRC_Instance instance) if (last_updated_inst == instance) last_updated_inst = NULL; - /* Force reselection if currently selected */ - SRC_ResetInstance(instance); - assert(initialised); if (instance->index < 0 || instance->index >= n_sources || - instance->index == selected_source_index || instance != sources[instance->index]) assert(0); @@ -336,6 +337,10 @@ void SRC_DestroyInstance(SRC_Instance instance) if (selected_source_index > dead_index) --selected_source_index; + else if (selected_source_index == dead_index) + unselect_selected_source(LOGS_INFO, NULL, NULL); + + SRC_SelectSource(NULL); } /* ================================================== */ @@ -738,6 +743,26 @@ mark_ok_sources(SRC_Status status) } /* ================================================== */ +/* Reset the index of selected source and report the selection loss. If no + message is provided, assume it is a transient state and wait for another + call providing a message or selection of another source, which resets the + report_selection_loss flag. */ + +static void +unselect_selected_source(LOG_Severity severity, const char *format, const char *arg) +{ + if (selected_source_index != INVALID_SOURCE) { + selected_source_index = INVALID_SOURCE; + report_selection_loss = 1; + } + + if (report_selection_loss && format) { + log_selection_message(severity, format, arg); + report_selection_loss = 0; + } +} + +/* ================================================== */ static int combine_sources(int n_sel_sources, struct timespec *ref_time, double *offset, @@ -854,9 +879,7 @@ SRC_SelectSource(SRC_Instance updated_inst) } if (n_sources == 0) { - /* Removed sources are unselected before actual removal */ - if (selected_source_index != INVALID_SOURCE) - assert(0); + unselect_selected_source(LOGS_INFO, "Can't synchronise: no sources", NULL); return; } @@ -1041,15 +1064,13 @@ SRC_SelectSource(SRC_Instance updated_inst) if (n_badstats_sources && n_sel_sources && selected_source_index == INVALID_SOURCE && max_sel_reach_size < SOURCE_REACH_BITS && max_sel_reach >> 1 == max_badstat_reach) { mark_ok_sources(SRC_WAITS_STATS); + unselect_selected_source(LOGS_INFO, NULL, NULL); return; } if (n_endpoints == 0) { /* No sources provided valid endpoints */ - if (selected_source_index != INVALID_SOURCE) { - log_selection_message(LOGS_INFO, "Can't synchronise: no selectable sources", NULL); - selected_source_index = INVALID_SOURCE; - } + unselect_selected_source(LOGS_INFO, "Can't synchronise: no selectable sources", NULL); return; } @@ -1130,6 +1151,7 @@ SRC_SelectSource(SRC_Instance updated_inst) if (!reported_no_majority) { log_selection_message(LOGS_WARN, "Can't synchronise: no majority", NULL); reported_no_majority = 1; + report_selection_loss = 0; } if (selected_source_index != INVALID_SOURCE) { @@ -1186,12 +1208,9 @@ SRC_SelectSource(SRC_Instance updated_inst) } if (!n_sel_sources || sel_req_source || n_sel_sources < CNF_GetMinSources()) { - if (selected_source_index != INVALID_SOURCE) { - log_selection_message(LOGS_INFO, "Can't synchronise: %s selectable sources", - !n_sel_sources ? "no" : - sel_req_source ? "no required source in" : "not enough"); - selected_source_index = INVALID_SOURCE; - } + unselect_selected_source(LOGS_INFO, "Can't synchronise: %s selectable sources", + !n_sel_sources ? "no" : + sel_req_source ? "no required source in" : "not enough"); mark_ok_sources(SRC_WAITS_SOURCES); return; } @@ -1298,7 +1317,7 @@ SRC_SelectSource(SRC_Instance updated_inst) /* Before selecting the new synchronisation source wait until the reference can be updated */ if (sources[max_score_index]->updates == 0) { - selected_source_index = INVALID_SOURCE; + unselect_selected_source(LOGS_INFO, NULL, NULL); mark_ok_sources(SRC_WAITS_UPDATE); return; } @@ -1314,6 +1333,7 @@ SRC_SelectSource(SRC_Instance updated_inst) } reported_no_majority = 0; + report_selection_loss = 0; } mark_source(sources[selected_source_index], SRC_SELECTED); diff --git a/test/unit/util.c b/test/unit/util.c index f434671..d52a268 100644 --- a/test/unit/util.c +++ b/test/unit/util.c @@ -1,6 +1,6 @@ /* ********************************************************************** - * Copyright (C) Miroslav Lichvar 2017-2018, 2021 + * Copyright (C) Miroslav Lichvar 2017-2018, 2021, 2023 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as diff --git a/version.txt b/version.txt index e46ba43..4caecc7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -4.5-pre1 +4.5 |