mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 11:15:07 -05:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bcbea9bd2 | ||
|
|
2ac581e04a | ||
|
|
4a8da7e02d | ||
|
|
e463fcab49 | ||
|
|
df98fb4fc7 | ||
|
|
551bc266e4 | ||
|
|
c4234dd1f7 | ||
|
|
fd50f3c80c | ||
|
|
9b9823b377 | ||
|
|
c900dff314 | ||
|
|
2c6cbde058 | ||
|
|
cacd64bf4a | ||
|
|
6c2ee89970 | ||
|
|
68b2ffa97c | ||
|
|
f591133f4c | ||
|
|
48cc072c06 | ||
|
|
8211978570 | ||
|
|
4b2b6bbf97 | ||
|
|
551ad40a04 |
2
NEWS
2
NEWS
@@ -16,9 +16,11 @@ Enhancements
|
|||||||
* Improve quantile-based filtering to adapt faster to larger delay
|
* Improve quantile-based filtering to adapt faster to larger delay
|
||||||
* Improve logging of selection failures
|
* Improve logging of selection failures
|
||||||
* Detect clock interference from other processes
|
* Detect clock interference from other processes
|
||||||
|
* Try to reopen message log (-l option) on cyclelogs command
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
---------
|
---------
|
||||||
|
* Fix sourcedir reloading to not multiply sources
|
||||||
* Fix tracking offset after failed clock step
|
* Fix tracking offset after failed clock step
|
||||||
|
|
||||||
Removed features
|
Removed features
|
||||||
|
|||||||
2
client.c
2
client.c
@@ -3447,7 +3447,7 @@ static void
|
|||||||
display_gpl(void)
|
display_gpl(void)
|
||||||
{
|
{
|
||||||
printf("chrony version %s\n"
|
printf("chrony version %s\n"
|
||||||
"Copyright (C) 1997-2003, 2007, 2009-2024 Richard P. Curnow and others\n"
|
"Copyright (C) 1997-2003, 2007, 2009-2025 Richard P. Curnow and others\n"
|
||||||
"chrony comes with ABSOLUTELY NO WARRANTY. This is free software, and\n"
|
"chrony comes with ABSOLUTELY NO WARRANTY. This is free software, and\n"
|
||||||
"you are welcome to redistribute it under certain conditions. See the\n"
|
"you are welcome to redistribute it under certain conditions. See the\n"
|
||||||
"GNU General Public License version 2 for details.\n\n",
|
"GNU General Public License version 2 for details.\n\n",
|
||||||
|
|||||||
2
cmdmon.c
2
cmdmon.c
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Richard P. Curnow 1997-2003
|
* Copyright (C) Richard P. Curnow 1997-2003
|
||||||
* Copyright (C) Miroslav Lichvar 2009-2016, 2018-2024
|
* Copyright (C) Miroslav Lichvar 2009-2016, 2018-2025
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of version 2 of the GNU General Public License as
|
||||||
|
|||||||
11
conf.c
11
conf.c
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Richard P. Curnow 1997-2003
|
* Copyright (C) Richard P. Curnow 1997-2003
|
||||||
* Copyright (C) Miroslav Lichvar 2009-2017, 2020, 2024
|
* Copyright (C) Miroslav Lichvar 2009-2017, 2020, 2024-2025
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of version 2 of the GNU General Public License as
|
||||||
@@ -1872,8 +1872,8 @@ reload_source_dirs(void)
|
|||||||
NTP_Source *prev_sources, *new_sources, *source;
|
NTP_Source *prev_sources, *new_sources, *source;
|
||||||
unsigned int i, j, prev_size, new_size, unresolved;
|
unsigned int i, j, prev_size, new_size, unresolved;
|
||||||
char buf[MAX_LINE_LENGTH];
|
char buf[MAX_LINE_LENGTH];
|
||||||
|
int d, pass, was_added;
|
||||||
NSR_Status s;
|
NSR_Status s;
|
||||||
int d, pass;
|
|
||||||
|
|
||||||
/* Ignore reload command before adding configured sources */
|
/* Ignore reload command before adding configured sources */
|
||||||
if (!conf_ntp_sources_added)
|
if (!conf_ntp_sources_added)
|
||||||
@@ -1912,13 +1912,16 @@ reload_source_dirs(void)
|
|||||||
else
|
else
|
||||||
d = i < prev_size ? -1 : 1;
|
d = i < prev_size ? -1 : 1;
|
||||||
|
|
||||||
|
was_added = d <= 0 && (prev_sources[i].status == NSR_Success ||
|
||||||
|
prev_sources[i].status == NSR_UnresolvedName);
|
||||||
|
|
||||||
/* Remove missing sources before adding others to avoid conflicts */
|
/* Remove missing sources before adding others to avoid conflicts */
|
||||||
if (pass == 0 && d < 0 && prev_sources[i].status == NSR_Success) {
|
if (pass == 0 && d < 0 && was_added) {
|
||||||
NSR_RemoveSourcesById(prev_sources[i].conf_id);
|
NSR_RemoveSourcesById(prev_sources[i].conf_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add new sources and sources that could not be added before */
|
/* Add new sources and sources that could not be added before */
|
||||||
if (pass == 1 && (d > 0 || (d == 0 && prev_sources[i].status != NSR_Success))) {
|
if (pass == 1 && (d > 0 || (d == 0 && !was_added))) {
|
||||||
source = &new_sources[j];
|
source = &new_sources[j];
|
||||||
s = NSR_AddSourceByName(source->params.name, source->params.family, source->params.port,
|
s = NSR_AddSourceByName(source->params.name, source->params.family, source->params.port,
|
||||||
source->pool, source->type, &source->params.params,
|
source->pool, source->type, &source->params.params,
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
// Copyright (C) Richard P. Curnow 1997-2003
|
// Copyright (C) Richard P. Curnow 1997-2003
|
||||||
// Copyright (C) Stephen Wadeley 2016
|
// Copyright (C) Stephen Wadeley 2016
|
||||||
// Copyright (C) Bryan Christianson 2017
|
// Copyright (C) Bryan Christianson 2017
|
||||||
// Copyright (C) Miroslav Lichvar 2009-2024
|
// Copyright (C) Paul Donald 2025
|
||||||
|
// Copyright (C) Miroslav Lichvar 2009-2025
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// 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
|
// it under the terms of version 2 of the GNU General Public License as
|
||||||
@@ -251,11 +252,11 @@ authenticated source to be safely combined with unauthenticated sources in
|
|||||||
order to improve the accuracy of the clock. They can be selected and used for
|
order to improve the accuracy of the clock. They can be selected and used for
|
||||||
synchronisation only if they agree with the trusted and required source.
|
synchronisation only if they agree with the trusted and required source.
|
||||||
*xleave*:::
|
*xleave*:::
|
||||||
This option enables the interleaved mode of NTP. It enables the server to
|
This option enables the interleaved mode of NTP (RFC 9769). It enables the
|
||||||
respond with more accurate transmit timestamps (e.g. kernel or hardware
|
server to respond with more accurate transmit timestamps (e.g. kernel or
|
||||||
timestamps), which cannot be contained in the transmitted packet itself and
|
hardware timestamps), which cannot be contained in the transmitted packet
|
||||||
need to refer to a previous packet instead. This can significantly improve the
|
itself and need to refer to a previous packet instead. This can significantly
|
||||||
accuracy and stability of the measurements.
|
improve the accuracy and stability of the measurements.
|
||||||
+
|
+
|
||||||
The interleaved mode is compatible with servers that support only the basic
|
The interleaved mode is compatible with servers that support only the basic
|
||||||
mode. Note that even
|
mode. Note that even
|
||||||
|
|||||||
@@ -1472,7 +1472,7 @@ Note that log files enabled by the *log* directive are opened when the first
|
|||||||
entry is made. The message log file specified by the *chronyd*'s *-l* option is
|
entry is made. The message log file specified by the *chronyd*'s *-l* option is
|
||||||
opened early on start and closed on the *cyclelogs* command only if opening of
|
opened early on start and closed on the *cyclelogs* command only if opening of
|
||||||
the new file succeeds to avoid losing messages. If *chronyd* is configured to
|
the new file succeeds to avoid losing messages. If *chronyd* is configured to
|
||||||
drop root privileges and the directory containg the log file is not writable
|
drop root privileges and the directory containing the log file is not writable
|
||||||
for the specified user, *chronyd* will not be able to open the file again.
|
for the specified user, *chronyd* will not be able to open the file again.
|
||||||
|
|
||||||
[[dump]]*dump*::
|
[[dump]]*dump*::
|
||||||
|
|||||||
@@ -338,10 +338,10 @@ with local NTP server
|
|||||||
server ntp.local minpoll 2 maxpoll 4 polltarget 30 maxdelaydevratio 2
|
server ntp.local minpoll 2 maxpoll 4 polltarget 30 maxdelaydevratio 2
|
||||||
----
|
----
|
||||||
|
|
||||||
If your server supports the interleaved mode (e.g. it is running `chronyd`),
|
If your server supports the interleaved mode (RFC 9769), e.g. it is running
|
||||||
the `xleave` option should be added to the `server` directive to enable the
|
`chronyd` version 3.0 or later, the `xleave` option should be added to the
|
||||||
server to provide the client with more accurate transmit timestamps (kernel or
|
`server` directive to enable the server to provide the client with more
|
||||||
preferably hardware). For example:
|
accurate transmit timestamps (kernel or preferably hardware). For example:
|
||||||
|
|
||||||
----
|
----
|
||||||
server ntp.local minpoll 2 maxpoll 4 xleave
|
server ntp.local minpoll 2 maxpoll 4 xleave
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Use public NTP servers from the pool.ntp.org project.
|
# Use four public NTP servers from the pool.ntp.org project.
|
||||||
pool pool.ntp.org iburst
|
pool pool.ntp.org iburst
|
||||||
|
|
||||||
# Record the rate at which the system clock gains/losses time.
|
# Record the rate at which the system clock gains/losses time.
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# Use public servers from the pool.ntp.org project.
|
# Note: The general recommendation for an NTP client is to have at least
|
||||||
# Please consider joining the pool (https://www.pool.ntp.org/join.html).
|
# three NTP servers to be able to detect one server providing incorrect
|
||||||
|
# time (falseticker).
|
||||||
|
|
||||||
|
# Use four public NTP servers from the pool.ntp.org project. If this
|
||||||
|
# host has a static public IP address, please consider joining the pool:
|
||||||
|
# https://www.ntppool.org/join.html
|
||||||
pool pool.ntp.org iburst
|
pool pool.ntp.org iburst
|
||||||
|
|
||||||
# Record the rate at which the system clock gains/losses time.
|
# Record the rate at which the system clock gains/losses time.
|
||||||
|
|||||||
@@ -21,10 +21,12 @@
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
### SPECIFY YOUR NTP SERVERS
|
### SPECIFY YOUR NTP SERVERS
|
||||||
# Most computers using chrony will send measurement requests to one or
|
# Most computers using chrony will send measurement requests to one or
|
||||||
# more 'NTP servers'. You will probably find that your Internet Service
|
# more NTP servers. The general recommendation is to have at least
|
||||||
|
# three NTP servers to be able to detect one server providing incorrect
|
||||||
|
# time (falseticker). You will probably find that your Internet Service
|
||||||
# Provider or company have one or more NTP servers that you can specify.
|
# Provider or company have one or more NTP servers that you can specify.
|
||||||
# Failing that, there are a lot of public NTP servers. There is a list
|
# Failing that, there are a lot of public NTP servers. There is a list
|
||||||
# you can access at http://support.ntp.org/bin/view/Servers/WebHome or
|
# you can access at https://support.ntp.org/bin/view/Servers/WebHome or
|
||||||
# you can use servers from the pool.ntp.org project.
|
# you can use servers from the pool.ntp.org project.
|
||||||
|
|
||||||
! server ntp1.example.net iburst
|
! server ntp1.example.net iburst
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ LOG_Finalise(void)
|
|||||||
if (system_log)
|
if (system_log)
|
||||||
closelog();
|
closelog();
|
||||||
|
|
||||||
if (file_log)
|
if (file_log && file_log != stderr)
|
||||||
fclose(file_log);
|
fclose(file_log);
|
||||||
file_log = NULL;
|
file_log = NULL;
|
||||||
Free(file_log_path);
|
Free(file_log_path);
|
||||||
|
|||||||
2
main.c
2
main.c
@@ -126,7 +126,7 @@ notify_system_manager(int start)
|
|||||||
sock_fd = SCK_OpenUnixDatagramSocket(path, NULL, 0);
|
sock_fd = SCK_OpenUnixDatagramSocket(path, NULL, 0);
|
||||||
|
|
||||||
if (sock_fd < 0 || SCK_Send(sock_fd, message, strlen(message), 0) != strlen(message))
|
if (sock_fd < 0 || SCK_Send(sock_fd, message, strlen(message), 0) != strlen(message))
|
||||||
LOG_FATAL("Could not send notification");
|
LOG_FATAL("Could not send notification to $NOTIFY_SOCKET");
|
||||||
|
|
||||||
SCK_CloseSocket(sock_fd);
|
SCK_CloseSocket(sock_fd);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1960,7 +1960,7 @@ process_response(NCR_Instance inst, int saved, NTP_Local_Address *local_addr,
|
|||||||
/* The skew and estimated frequency offset relative to the remote source */
|
/* The skew and estimated frequency offset relative to the remote source */
|
||||||
double skew, source_freq_lo, source_freq_hi;
|
double skew, source_freq_lo, source_freq_hi;
|
||||||
|
|
||||||
/* RFC 5905 packet tests */
|
/* RFC 5905 and RFC 9769 packet tests */
|
||||||
int test1, test2n, test2i, test2, test3, test5, test6, test7;
|
int test1, test2n, test2i, test2, test3, test5, test6, test7;
|
||||||
int interleaved_packet, valid_packet, synced_packet;
|
int interleaved_packet, valid_packet, synced_packet;
|
||||||
|
|
||||||
@@ -2024,7 +2024,7 @@ process_response(NCR_Instance inst, int saved, NTP_Local_Address *local_addr,
|
|||||||
pkt_root_dispersion = UTI_Ntp32ToDouble(message->root_dispersion);
|
pkt_root_dispersion = UTI_Ntp32ToDouble(message->root_dispersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the packet is valid per RFC 5905, section 8.
|
/* Check if the packet is valid per RFC 5905 (section 8) and RFC 9769.
|
||||||
The test values are 1 when passed and 0 when failed. */
|
The test values are 1 when passed and 0 when failed. */
|
||||||
|
|
||||||
/* Test 1 checks for duplicate packet */
|
/* Test 1 checks for duplicate packet */
|
||||||
|
|||||||
@@ -138,12 +138,15 @@ static void refrtc_finalise(RCL_Instance instance)
|
|||||||
|
|
||||||
rtc = RCL_GetDriverData(instance);
|
rtc = RCL_GetDriverData(instance);
|
||||||
|
|
||||||
if (!rtc->polling) {
|
if (rtc->fd >= 0) {
|
||||||
SCH_RemoveFileHandler(rtc->fd);
|
if (!rtc->polling) {
|
||||||
RTC_Linux_SwitchInterrupt(rtc->fd, 0);
|
SCH_RemoveFileHandler(rtc->fd);
|
||||||
|
RTC_Linux_SwitchInterrupt(rtc->fd, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(rtc->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
close(rtc->fd);
|
|
||||||
Free(rtc);
|
Free(rtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Richard P. Curnow 1997-2003
|
* Copyright (C) Richard P. Curnow 1997-2003
|
||||||
* Copyright (C) Miroslav Lichvar 2012-2014
|
* Copyright (C) Miroslav Lichvar 2012-2014
|
||||||
|
* Copyright (C) Ahmad Fatoum, Pengutronix 2024
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of version 2 of the GNU General Public License as
|
||||||
|
|||||||
6
sched.c
6
sched.c
@@ -47,12 +47,6 @@ static int initialised = 0;
|
|||||||
/* One more than the highest file descriptor that is registered */
|
/* One more than the highest file descriptor that is registered */
|
||||||
static unsigned int one_highest_fd;
|
static unsigned int one_highest_fd;
|
||||||
|
|
||||||
#ifndef FD_SETSIZE
|
|
||||||
/* If FD_SETSIZE is not defined, assume that fd_set is implemented
|
|
||||||
as a fixed size array of bits, possibly embedded inside a record */
|
|
||||||
#define FD_SETSIZE (sizeof(fd_set) * 8)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SCH_FileHandler handler;
|
SCH_FileHandler handler;
|
||||||
SCH_ArbitraryArgument arg;
|
SCH_ArbitraryArgument arg;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Richard P. Curnow 1997-2003
|
* Copyright (C) Richard P. Curnow 1997-2003
|
||||||
* Copyright (C) Miroslav Lichvar 2011-2016, 2018, 2020-2024
|
* Copyright (C) Miroslav Lichvar 2011-2016, 2018, 2020-2025
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* 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) Richard P. Curnow 1997-2003
|
||||||
* Copyright (C) John G. Hasler 2009
|
* Copyright (C) John G. Hasler 2009
|
||||||
* Copyright (C) Miroslav Lichvar 2009-2012, 2014-2018
|
* Copyright (C) Miroslav Lichvar 2009-2012, 2014-2018
|
||||||
|
* Copyright (C) Shachar Raindel 2025
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of version 2 of the GNU General Public License as
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Richard P. Curnow 1997-2003
|
* Copyright (C) Richard P. Curnow 1997-2003
|
||||||
* Copyright (C) Miroslav Lichvar 2009-2012, 2014-2015, 2017
|
* Copyright (C) Miroslav Lichvar 2009-2012, 2014-2015, 2017, 2025
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of version 2 of the GNU General Public License as
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ touch Makefile
|
|||||||
for extra_config_opts in \
|
for extra_config_opts in \
|
||||||
"--all-privops" \
|
"--all-privops" \
|
||||||
"--disable-ipv6" \
|
"--disable-ipv6" \
|
||||||
|
"--disable-cmdmon" \
|
||||||
"--disable-nts" \
|
"--disable-nts" \
|
||||||
"--disable-scfilter" \
|
"--disable-scfilter" \
|
||||||
"--without-aes-gcm-siv" \
|
"--without-aes-gcm-siv" \
|
||||||
|
|||||||
@@ -43,4 +43,35 @@ check_chronyd_exit || test_fail
|
|||||||
check_source_selection || test_fail
|
check_source_selection || test_fail
|
||||||
check_sync || test_fail
|
check_sync || test_fail
|
||||||
|
|
||||||
|
# Sources with large distance should be ignored
|
||||||
|
|
||||||
|
servers=1
|
||||||
|
server_strata=2
|
||||||
|
server_conf="maxclockerror 1000"
|
||||||
|
jitter=1e-7
|
||||||
|
base_delay="(* -1.0 (equal 0.1 (min time 600) 600) (equal 0.1 from 2) (equal 0.1 to 1))"
|
||||||
|
|
||||||
|
run_test || test_fail
|
||||||
|
check_chronyd_exit || test_fail
|
||||||
|
check_packet_interval || test_fail
|
||||||
|
check_source_selection && test_fail
|
||||||
|
check_sync && test_fail
|
||||||
|
|
||||||
|
check_log_messages "Root distance of 192\.168\.123\.2 exceeds maxdistance of 3\." 1 1 || test_fail
|
||||||
|
|
||||||
|
# Sources with large jitter should be ignored
|
||||||
|
|
||||||
|
server_strata=1
|
||||||
|
server_conf=$default_server_conf
|
||||||
|
server_step="(pulse 64 64)"
|
||||||
|
base_delay=$default_base_delay
|
||||||
|
|
||||||
|
run_test || test_fail
|
||||||
|
check_chronyd_exit || test_fail
|
||||||
|
check_packet_interval || test_fail
|
||||||
|
check_source_selection && test_fail
|
||||||
|
check_sync && test_fail
|
||||||
|
|
||||||
|
check_log_messages "Jitter of 192\.168\.123\.1 exceeds maxjitter of 1\." 1 1 || test_fail
|
||||||
|
|
||||||
test_pass
|
test_pass
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
test_start "IPv6 addressing"
|
test_start "IPv6 addressing"
|
||||||
|
|
||||||
|
check_config_h 'FEAT_IPV6 1' || test_skip
|
||||||
|
|
||||||
ip_family=6
|
ip_family=6
|
||||||
|
|
||||||
run_test || test_fail
|
run_test || test_fail
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ client_conf="initstepslew 5 192.168.123.1 192.168.123.2"
|
|||||||
|
|
||||||
min_sync_time=1
|
min_sync_time=1
|
||||||
max_sync_time=500
|
max_sync_time=500
|
||||||
server_conf="deny all"
|
server_conf="deny 192.168.0.0/16"
|
||||||
|
|
||||||
run_test || test_fail
|
run_test || test_fail
|
||||||
check_chronyd_exit || test_fail
|
check_chronyd_exit || test_fail
|
||||||
|
|||||||
@@ -18,15 +18,30 @@ max_sync_time=70
|
|||||||
chronyc_start=70
|
chronyc_start=70
|
||||||
chronyc_conf="tracking"
|
chronyc_conf="tracking"
|
||||||
|
|
||||||
for refclock in "SHM 0" "PHC /dev/ptp0" "PHC /dev/ptp0:nocrossts"; do
|
for refclock in "SHM 0" "RTC /dev/rtc:utc" "PHC /dev/ptp0" "PHC /dev/ptp0:nocrossts"; do
|
||||||
client_conf="refclock $refclock stratum 3 delay 1e-3 refid GPS
|
client_conf="refclock $refclock stratum 3 delay 1e-3 refid GPS
|
||||||
logdir tmp
|
logdir tmp
|
||||||
log refclocks"
|
log refclocks"
|
||||||
|
|
||||||
|
if [[ $refclock =~ RTC ]]; then
|
||||||
|
check_config_h 'FEAT_RTC 1' || continue
|
||||||
|
wander=0.0
|
||||||
|
freq_offset=0.0
|
||||||
|
client_chronyd_options="-x"
|
||||||
|
else
|
||||||
|
wander=$default_wander
|
||||||
|
freq_offset=$default_freq_offset
|
||||||
|
client_chronyd_options=$default_client_chronyd_options
|
||||||
|
fi
|
||||||
|
|
||||||
run_test || test_fail
|
run_test || test_fail
|
||||||
check_chronyd_exit || test_fail
|
check_chronyd_exit || test_fail
|
||||||
check_source_selection || test_fail
|
check_source_selection || test_fail
|
||||||
check_sync || test_fail
|
if [[ $refclock =~ RTC ]]; then
|
||||||
|
check_chronyc_output "System time *: 0\.10000.... seconds fast" || test_fail
|
||||||
|
else
|
||||||
|
check_sync || test_fail
|
||||||
|
fi
|
||||||
check_chronyc_output "^Reference ID.*47505300 \(GPS\)
|
check_chronyc_output "^Reference ID.*47505300 \(GPS\)
|
||||||
Stratum.*: 4
|
Stratum.*: 4
|
||||||
.*
|
.*
|
||||||
|
|||||||
@@ -219,6 +219,11 @@ do
|
|||||||
run_test || test_fail
|
run_test || test_fail
|
||||||
check_chronyd_exit || test_fail
|
check_chronyd_exit || test_fail
|
||||||
check_chronyc_output "501 Not authorised$" || test_fail
|
check_chronyc_output "501 Not authorised$" || test_fail
|
||||||
|
|
||||||
|
server_conf="cmddeny 192.168.123.2"
|
||||||
|
run_test || test_fail
|
||||||
|
check_chronyd_exit || test_fail
|
||||||
|
check_chronyc_output "506 Cannot talk to daemon$" || test_fail
|
||||||
done
|
done
|
||||||
|
|
||||||
server_conf="server 192.168.123.1"
|
server_conf="server 192.168.123.1"
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ server_conf="broadcast 64 192.168.123.255"
|
|||||||
client_server_options="offline"
|
client_server_options="offline"
|
||||||
|
|
||||||
run_test || test_fail
|
run_test || test_fail
|
||||||
check_chronyd_exit || test_fail
|
if check_config_h 'FEAT_CMDMON 1'; then
|
||||||
|
check_chronyd_exit || test_fail
|
||||||
|
fi
|
||||||
check_packet_interval && test_fail
|
check_packet_interval && test_fail
|
||||||
|
|
||||||
check_file_messages " 1 2 " 150 160 log.packets || test_fail
|
check_file_messages " 1 2 " 150 160 log.packets || test_fail
|
||||||
|
|||||||
@@ -64,8 +64,11 @@ if check_config_h 'FEAT_IPV6 1'; then
|
|||||||
check_source_selection || test_fail
|
check_source_selection || test_fail
|
||||||
check_sync || test_fail
|
check_sync || test_fail
|
||||||
|
|
||||||
|
check_file_messages "20.*:123:1.* 111 111 1111" 75 80 measurements.log || test_fail
|
||||||
|
check_file_messages "20.*:123:1.* 111 001 0000" 37 39 measurements.log || test_fail
|
||||||
check_file_messages " 2 1 .* 4460 " 260 300 log.packets || test_fail
|
check_file_messages " 2 1 .* 4460 " 260 300 log.packets || test_fail
|
||||||
check_file_messages "." 6 6 ntskeys || test_fail
|
check_file_messages "." 6 6 ntskeys || test_fail
|
||||||
|
rm -f tmp/measurements.log
|
||||||
|
|
||||||
ip_family=$default_ip_family
|
ip_family=$default_ip_family
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
test_start "address refreshment"
|
test_start "address refreshment"
|
||||||
|
|
||||||
|
check_config_h 'FEAT_CMDMON 1' || test_skip
|
||||||
|
|
||||||
limit=1000
|
limit=1000
|
||||||
servers=5
|
servers=5
|
||||||
client_conf="logdir tmp
|
client_conf="logdir tmp
|
||||||
|
|||||||
189
test/simulation/149-sourcedir
Executable file
189
test/simulation/149-sourcedir
Executable file
@@ -0,0 +1,189 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
. ./test.common
|
||||||
|
|
||||||
|
test_start "sourcedir directive"
|
||||||
|
|
||||||
|
check_config_h 'FEAT_CMDMON 1' || test_skip
|
||||||
|
|
||||||
|
servers=4
|
||||||
|
limit=191
|
||||||
|
update_executable="tmp/update-sourcedir"
|
||||||
|
client_server_conf="sourcedir tmp"
|
||||||
|
base_delay="(+ 1e-4 (* 5 (equal 0.1 from $[servers + 2])))"
|
||||||
|
chronyc_start=1
|
||||||
|
chronyc_conf="timeout 6000
|
||||||
|
activity
|
||||||
|
$(for i in $(seq 1 18); do echo "reload sources"; echo activity; done)"
|
||||||
|
|
||||||
|
cat > tmp/sources.sources <<EOF
|
||||||
|
pool nodes-1-2-3-4.net1.clk iburst
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > tmp/update-sourcedir <<EOF
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
case "\$1" in
|
||||||
|
19) s="pool nodes-1-2-3-4.net1.clk";;
|
||||||
|
39) s="pool nodes-1-2-3-4.net1.clk maxsources 3";;
|
||||||
|
59) s="pool nodes-1-2-3.net1.clk";;
|
||||||
|
79) s="pool nodes-1-2-3.net1.clk
|
||||||
|
server nodes-3-4.net1.clk";;
|
||||||
|
99) s="server nodes-3-4.net1.clk";;
|
||||||
|
119) s="server nodes-1-2-3.net1.clk";;
|
||||||
|
139) s="server 192.168.123.2";;
|
||||||
|
159) s="server 192.168.123.2 maxdelay 0.1";;
|
||||||
|
179) s="";;
|
||||||
|
*) exit 0;;
|
||||||
|
esac
|
||||||
|
echo "\$s" > tmp/sources.sources
|
||||||
|
EOF
|
||||||
|
chmod 755 tmp/update-sourcedir
|
||||||
|
|
||||||
|
run_test || test_fail
|
||||||
|
check_chronyd_exit || test_fail
|
||||||
|
|
||||||
|
check_log_messages "T00:0.:[135].Z \(Added\|Removed\)" 0 0 || test_fail
|
||||||
|
check_log_messages "T00:0.:..Z Added pool nodes-1-2-3-4\." 3 3 || test_fail
|
||||||
|
check_log_messages "T00:0.:..Z Removed pool nodes-1-2-3-4\." 3 3 || test_fail
|
||||||
|
check_log_messages "T00:0.:..Z Added pool nodes-1-2-3\." 1 1 || test_fail
|
||||||
|
check_log_messages "T00:0.:..Z Removed pool nodes-1-2-3\." 1 1 || test_fail
|
||||||
|
check_log_messages "T00:0.:..Z Added source ID#" 2 2 || test_fail
|
||||||
|
check_log_messages "T00:0.:..Z Added source 192.168.123.[1234]" 2 2 || test_fail
|
||||||
|
check_log_messages "T00:0.:..Z Removed source 192.168.123.[1234]" 4 4 || test_fail
|
||||||
|
|
||||||
|
check_chronyc_output "^200 OK
|
||||||
|
0 sources online
|
||||||
|
0 sources offline
|
||||||
|
4 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
4 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
4 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
4 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
3 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
3 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
3 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
5 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
3 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
5 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
4 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
5 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
4 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
5 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
1 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
1 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
1 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
1 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
1 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
1 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
1 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
1 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address
|
||||||
|
200 OK
|
||||||
|
200 OK
|
||||||
|
0 sources online
|
||||||
|
0 sources offline
|
||||||
|
0 sources doing burst \(return to online\)
|
||||||
|
0 sources doing burst \(return to offline\)
|
||||||
|
0 sources with unknown address$" || test_fail
|
||||||
|
|
||||||
|
check_packet_interval || test_fail
|
||||||
|
|
||||||
|
test_pass
|
||||||
@@ -39,6 +39,7 @@ default_refclock_jitter=""
|
|||||||
default_refclock_offset=0.0
|
default_refclock_offset=0.0
|
||||||
|
|
||||||
default_update_interval=0
|
default_update_interval=0
|
||||||
|
default_update_executable=""
|
||||||
default_shift_pll=2
|
default_shift_pll=2
|
||||||
|
|
||||||
default_server_strata=1
|
default_server_strata=1
|
||||||
@@ -463,7 +464,9 @@ run_simulation() {
|
|||||||
-o tmp/log.offset -f tmp/log.freq -p tmp/log.packets \
|
-o tmp/log.offset -f tmp/log.freq -p tmp/log.packets \
|
||||||
-R $(awk "BEGIN {print $update_interval < 0 ? 2^-($update_interval) : 1}") \
|
-R $(awk "BEGIN {print $update_interval < 0 ? 2^-($update_interval) : 1}") \
|
||||||
-r $(awk "BEGIN {print $max_sync_time * 2^$update_interval}") \
|
-r $(awk "BEGIN {print $max_sync_time * 2^$update_interval}") \
|
||||||
-l $(awk "BEGIN {print $limit * 2^$update_interval}") && test_ok || test_error
|
-l $(awk "BEGIN {print $limit * 2^$update_interval}") \
|
||||||
|
$([ "$update_executable" != "" ] && printf "%s" "-e $update_executable") && \
|
||||||
|
test_ok || test_error
|
||||||
}
|
}
|
||||||
|
|
||||||
run_test() {
|
run_test() {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ check_chronyc_output "^Name/IP address Mode KeyID Type KLen Last Atm
|
|||||||
run_chronyc "clients" || test_fail
|
run_chronyc "clients" || test_fail
|
||||||
check_chronyc_output "^Hostname NTP Drop Int IntL Last Cmd Drop Int Last
|
check_chronyc_output "^Hostname NTP Drop Int IntL Last Cmd Drop Int Last
|
||||||
===============================================================================
|
===============================================================================
|
||||||
127\.0\.0\.1 [0-9 ]+ 0 [-0-9 ]+ - [ 0-9]+ 0 0 - -$" \
|
.*127\.0\.0\.1 [0-9 ]+ 0 [-0-9 ]+ - [ 0-9]+ 0 0 - -.*$" \
|
||||||
|| test_fail
|
|| test_fail
|
||||||
|
|
||||||
run_chronyc "ntpdata $server" || test_fail
|
run_chronyc "ntpdata $server" || test_fail
|
||||||
@@ -107,7 +107,7 @@ Total HW RX : 0$" || test_fail
|
|||||||
run_chronyc "selectdata" || test_fail
|
run_chronyc "selectdata" || test_fail
|
||||||
check_chronyc_output "^S Name/IP Address Auth COpts EOpts Last Score Interval Leap
|
check_chronyc_output "^S Name/IP Address Auth COpts EOpts Last Score Interval Leap
|
||||||
=======================================================================
|
=======================================================================
|
||||||
M 127\.0\.0\.1 N -PTR- -PTR- 0 1\.0 \+0ns \+0ns \?$" || test_fail
|
M 127\.0\.0\.1 N -PTR- -PTR- 0 1\.0 \+0ns \+0ns [\?N]$" || test_fail
|
||||||
|
|
||||||
run_chronyc "serverstats" || test_fail
|
run_chronyc "serverstats" || test_fail
|
||||||
check_chronyc_output "^NTP packets received : [0-9]+
|
check_chronyc_output "^NTP packets received : [0-9]+
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Miroslav Lichvar 2017
|
* Copyright (C) Miroslav Lichvar 2017, 2025
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of version 2 of the GNU General Public License as
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Miroslav Lichvar 2020
|
* Copyright (C) Miroslav Lichvar 2020, 2024
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of version 2 of the GNU General Public License as
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Miroslav Lichvar 2022
|
* Copyright (C) Miroslav Lichvar 2022, 2025
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of version 2 of the GNU General Public License as
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Luke Valenta 2023
|
* Copyright (C) Luke Valenta 2023
|
||||||
|
* Copyright (C) Miroslav Lichvar 2024
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of version 2 of the GNU General Public License as
|
||||||
|
|||||||
Reference in New Issue
Block a user