mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 01:55:07 -05:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91f3f97ea7 | ||
|
|
65bb65b440 | ||
|
|
ea6e8d85a3 | ||
|
|
add932501f | ||
|
|
89390a738f | ||
|
|
ac4f6ab93b | ||
|
|
dbcb1b9b0b | ||
|
|
6375307798 | ||
|
|
fb78e60d26 | ||
|
|
b822c7164f | ||
|
|
aa295730a0 | ||
|
|
69d70703b2 | ||
|
|
b2b6ef00dc | ||
|
|
5dc86c236b | ||
|
|
2563dd9d29 | ||
|
|
a899e3df33 | ||
|
|
692cea49f8 | ||
|
|
bcedacaa3d | ||
|
|
be3c1b5243 | ||
|
|
e626ec6c37 | ||
|
|
49d52b547f | ||
|
|
74a546a9e7 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,9 +1,12 @@
|
|||||||
.deps
|
.deps
|
||||||
.vimrc
|
.vimrc
|
||||||
|
*.gcda
|
||||||
|
*.gcno
|
||||||
*.o
|
*.o
|
||||||
*.swp
|
*.swp
|
||||||
*.dSYM
|
*.dSYM
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
|
core.*
|
||||||
tags
|
tags
|
||||||
/RELEASES
|
/RELEASES
|
||||||
/Makefile
|
/Makefile
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ distclean : clean
|
|||||||
-rm -f Makefile config.h config.log
|
-rm -f Makefile config.h config.log
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
-rm -f *.o *.s chronyc chronyd core *~
|
-rm -f *.o *.s chronyc chronyd core.* *~
|
||||||
|
-rm -f *.gcda *.gcno
|
||||||
-rm -rf .deps
|
-rm -rf .deps
|
||||||
-rm -rf *.dSYM
|
-rm -rf *.dSYM
|
||||||
|
|
||||||
@@ -117,6 +118,9 @@ check : chronyd chronyc
|
|||||||
$(MAKE) -C test/unit check
|
$(MAKE) -C test/unit check
|
||||||
cd test/simulation && ./run -i 20 -m 2
|
cd test/simulation && ./run -i 20 -m 2
|
||||||
|
|
||||||
|
print-chronyd-objects :
|
||||||
|
@echo $(OBJS) $(EXTRA_OBJS)
|
||||||
|
|
||||||
Makefile : Makefile.in configure
|
Makefile : Makefile.in configure
|
||||||
@echo
|
@echo
|
||||||
@echo Makefile needs to be regenerated, run ./configure
|
@echo Makefile needs to be regenerated, run ./configure
|
||||||
|
|||||||
2
client.c
2
client.c
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Richard P. Curnow 1997-2003
|
* Copyright (C) Richard P. Curnow 1997-2003
|
||||||
* Copyright (C) Lonnie Abelbeck 2016
|
* Copyright (C) Lonnie Abelbeck 2016, 2018
|
||||||
* Copyright (C) Miroslav Lichvar 2009-2018
|
* Copyright (C) Miroslav Lichvar 2009-2018
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|||||||
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
|
* Copyright (C) Miroslav Lichvar 2009-2016, 2018
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
2
configure
vendored
2
configure
vendored
@@ -647,7 +647,7 @@ fi
|
|||||||
|
|
||||||
if [ $feat_asyncdns = "1" ] && \
|
if [ $feat_asyncdns = "1" ] && \
|
||||||
test_code 'pthread' 'pthread.h' '-pthread' '' \
|
test_code 'pthread' 'pthread.h' '-pthread' '' \
|
||||||
'return pthread_create((void *)1, NULL, (void *)1, NULL);'
|
'return (int)pthread_create((void *)1, NULL, (void *)1, NULL);'
|
||||||
then
|
then
|
||||||
add_def FEAT_ASYNCDNS
|
add_def FEAT_ASYNCDNS
|
||||||
add_def USE_PTHREAD_ASYNCDNS
|
add_def USE_PTHREAD_ASYNCDNS
|
||||||
|
|||||||
@@ -661,6 +661,13 @@ The *minsamples* directive sets the default minimum number of samples that
|
|||||||
*chronyd* should keep for each source. This setting can be overridden for
|
*chronyd* should keep for each source. This setting can be overridden for
|
||||||
individual sources in the <<server,*server*>> and <<refclock,*refclock*>>
|
individual sources in the <<server,*server*>> and <<refclock,*refclock*>>
|
||||||
directives. The default value is 6. The useful range is 4 to 64.
|
directives. The default value is 6. The useful range is 4 to 64.
|
||||||
|
+
|
||||||
|
Forcing *chronyd* to keep more samples than it would normally keep reduces
|
||||||
|
noise in the estimated frequency and offset, but slows down the response to
|
||||||
|
changes in the frequency and offset of the clock. The offsets in the
|
||||||
|
<<chronyc.adoc#tracking,*tracking*>> and
|
||||||
|
<<chronyc.adoc#sourcestats,*sourcestats*>> reports (and the _tracking.log_ and
|
||||||
|
_statistics.log_ files) may be smaller than the actual offsets.
|
||||||
|
|
||||||
=== Source selection
|
=== Source selection
|
||||||
|
|
||||||
@@ -2049,6 +2056,10 @@ that has password shorter than 80 bits.
|
|||||||
The <<chronyc.adoc#keygen,*keygen*>> command of *chronyc* can be used to
|
The <<chronyc.adoc#keygen,*keygen*>> command of *chronyc* can be used to
|
||||||
generate random keys for the key file. By default, it generates 160-bit MD5 or
|
generate random keys for the key file. By default, it generates 160-bit MD5 or
|
||||||
SHA1 keys.
|
SHA1 keys.
|
||||||
|
+
|
||||||
|
For security reasons, the file should be readable only by root and the user
|
||||||
|
under which *chronyd* is normally running (to allow *chronyd* to re-read the
|
||||||
|
file when the <<chronyc.adoc#rekey,*rekey*>> command is issued by *chronyc*).
|
||||||
|
|
||||||
[[lock_all]]*lock_all*::
|
[[lock_all]]*lock_all*::
|
||||||
The *lock_all* directive will lock chronyd into RAM so that it will never be
|
The *lock_all* directive will lock chronyd into RAM so that it will never be
|
||||||
|
|||||||
23
doc/faq.adoc
23
doc/faq.adoc
@@ -238,6 +238,29 @@ specified on the command line. For example:
|
|||||||
# chronyd -q 'pool pool.ntp.org iburst'
|
# chronyd -q 'pool pool.ntp.org iburst'
|
||||||
----
|
----
|
||||||
|
|
||||||
|
=== Can `chronyd` be configured to control the clock like `ntpd`?
|
||||||
|
|
||||||
|
It is not possible to perfectly emulate `ntpd`, but there are some options that
|
||||||
|
can configure `chronyd` to behave more like `ntpd`.
|
||||||
|
|
||||||
|
In the following example the `minsamples` directive slows down the response to
|
||||||
|
changes in the frequency and offset of the clock. The `maxslewrate` and
|
||||||
|
`corrtimeratio` directives reduce the maximum frequency error due to an offset
|
||||||
|
correction and the `maxdrift` directive reduces the maximum assumed frequency
|
||||||
|
error of the clock. The `makestep` directive enables a step threshold and the
|
||||||
|
`maxchange` directive enables a panic threshold. The `maxclockerror` directive
|
||||||
|
increases the minimum dispersion rate.
|
||||||
|
|
||||||
|
----
|
||||||
|
minsamples 32
|
||||||
|
maxslewrate 500
|
||||||
|
corrtimeratio 100
|
||||||
|
maxdrift 500
|
||||||
|
makestep 0.128 -1
|
||||||
|
maxchange 1000 1 1
|
||||||
|
maxclockerror 15
|
||||||
|
----
|
||||||
|
|
||||||
=== What happened to the `commandkey` and `generatecommandkey` directives?
|
=== What happened to the `commandkey` and `generatecommandkey` directives?
|
||||||
|
|
||||||
They were removed in version 2.2. Authentication is no longer supported in the
|
They were removed in version 2.2. Authentication is no longer supported in the
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ driftfile /var/lib/chrony/drift
|
|||||||
# still running and bail out. If you want to change the path to the PID
|
# still running and bail out. If you want to change the path to the PID
|
||||||
# file, uncomment this line and edit it. The default path is shown.
|
# file, uncomment this line and edit it. The default path is shown.
|
||||||
|
|
||||||
! pidfile /var/run/chronyd.pid
|
! pidfile /var/run/chrony/chronyd.pid
|
||||||
|
|
||||||
# If the system timezone database is kept up to date and includes the
|
# If the system timezone database is kept up to date and includes the
|
||||||
# right/UTC timezone, chronyd can use it to determine the current
|
# right/UTC timezone, chronyd can use it to determine the current
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# This is an example chrony keys file. It is used for NTP authentication with
|
# This is an example chrony keys file. It enables authentication of NTP
|
||||||
# symmetric keys. It should be readable only by root or the user to which
|
# packets with symmetric keys when its location is specified by the keyfile
|
||||||
# chronyd is configured to switch to after start.
|
# directive in chrony.conf(5). It should be readable only by root and the
|
||||||
|
# user under which chronyd is running.
|
||||||
#
|
#
|
||||||
# Don't use the example keys! It's recommended to generate random keys using
|
# Don't use the example keys! It's recommended to generate random keys using
|
||||||
# the chronyc keygen command.
|
# the chronyc keygen command.
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
%global chrony_version @@VERSION@@
|
|
||||||
%if 0%(echo %{chrony_version} | grep -q pre && echo 1)
|
|
||||||
%global prerelease %(echo %{chrony_version} | sed 's/.*-//')
|
|
||||||
%endif
|
|
||||||
Summary: An NTP client/server
|
|
||||||
Name: chrony
|
|
||||||
Version: %(echo %{chrony_version} | sed 's/-.*//')
|
|
||||||
Release: %{!?prerelease:1}%{?prerelease:0.1.%{prerelease}}
|
|
||||||
Source: chrony-%{version}%{?prerelease:-%{prerelease}}.tar.gz
|
|
||||||
License: GPLv2
|
|
||||||
Group: Applications/Utilities
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(id -u -n)
|
|
||||||
|
|
||||||
%description
|
|
||||||
chrony is a client and server for the Network Time Protocol (NTP).
|
|
||||||
This program keeps your computer's clock accurate. It was specially
|
|
||||||
designed to support systems with intermittent Internet connections,
|
|
||||||
but it also works well in permanently connected environments. It can
|
|
||||||
also use hardware reference clocks, the system real-time clock, or
|
|
||||||
manual input as time references.
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q -n %{name}-%{version}%{?prerelease:-%{prerelease}}
|
|
||||||
|
|
||||||
%build
|
|
||||||
./configure \
|
|
||||||
--prefix=%{_prefix} \
|
|
||||||
--bindir=%{_bindir} \
|
|
||||||
--sbindir=%{_sbindir} \
|
|
||||||
--mandir=%{_mandir}
|
|
||||||
make
|
|
||||||
|
|
||||||
%install
|
|
||||||
rm -rf $RPM_BUILD_ROOT
|
|
||||||
make install DESTDIR=$RPM_BUILD_ROOT
|
|
||||||
|
|
||||||
%files
|
|
||||||
%{_sbindir}/chronyd
|
|
||||||
%{_bindir}/chronyc
|
|
||||||
%{_mandir}/man1/chronyc.1.gz
|
|
||||||
%{_mandir}/man5/chrony.conf.5.gz
|
|
||||||
%{_mandir}/man8/chronyd.8.gz
|
|
||||||
%doc README FAQ NEWS COPYING
|
|
||||||
%doc examples/chrony.conf.example*
|
|
||||||
%doc examples/chrony.keys.example
|
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
chronyd/chronyc - Programs for keeping computer clocks accurate.
|
chronyd/chronyc - Programs for keeping computer clocks accurate.
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Miroslav Lichvar 2012
|
* Copyright (C) Miroslav Lichvar 2012, 2018
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
chronyd/chronyc - Programs for keeping computer clocks accurate.
|
chronyd/chronyc - Programs for keeping computer clocks accurate.
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Miroslav Lichvar 2016-2017
|
* Copyright (C) Miroslav Lichvar 2016-2018
|
||||||
*
|
*
|
||||||
* 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 2011-2014
|
* Copyright (C) Miroslav Lichvar 2011-2014, 2018
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
2
main.c
2
main.c
@@ -4,7 +4,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 2012-2017
|
* Copyright (C) Miroslav Lichvar 2012-2018
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ cd RELEASES/$subdir || exit 1
|
|||||||
|
|
||||||
echo $version > version.txt
|
echo $version > version.txt
|
||||||
|
|
||||||
sed -i -e "s%@@VERSION@@%${version}%" examples/chrony.spec
|
|
||||||
|
|
||||||
./configure && make -C doc man txt || exit 1
|
./configure && make -C doc man txt || exit 1
|
||||||
|
|
||||||
iconv -f utf-8 -t ascii//TRANSLIT < doc/installation.txt > INSTALL
|
iconv -f utf-8 -t ascii//TRANSLIT < doc/installation.txt > INSTALL
|
||||||
|
|||||||
2
ntp_io.c
2
ntp_io.c
@@ -4,7 +4,7 @@
|
|||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Richard P. Curnow 1997-2003
|
* Copyright (C) Richard P. Curnow 1997-2003
|
||||||
* Copyright (C) Timo Teras 2009
|
* Copyright (C) Timo Teras 2009
|
||||||
* Copyright (C) Miroslav Lichvar 2009, 2013-2016
|
* Copyright (C) Miroslav Lichvar 2009, 2013-2016, 2018
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
chronyd/chronyc - Programs for keeping computer clocks accurate.
|
chronyd/chronyc - Programs for keeping computer clocks accurate.
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Miroslav Lichvar 2009-2011, 2013-2014, 2016-2017
|
* Copyright (C) Miroslav Lichvar 2009-2011, 2013-2014, 2016-2018
|
||||||
*
|
*
|
||||||
* 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-2017
|
* Copyright (C) Miroslav Lichvar 2009-2018
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ SPF_CreateInstance(int min_samples, int max_samples, double max_dispersion, doub
|
|||||||
filter->last = -1;
|
filter->last = -1;
|
||||||
/* Set the first estimate to the system precision */
|
/* Set the first estimate to the system precision */
|
||||||
filter->avg_var_n = 0;
|
filter->avg_var_n = 0;
|
||||||
filter->avg_var = LCL_GetSysPrecisionAsQuantum() * LCL_GetSysPrecisionAsQuantum();
|
filter->avg_var = SQUARE(LCL_GetSysPrecisionAsQuantum());
|
||||||
filter->max_var = SQUARE(max_dispersion);
|
filter->max_var = SQUARE(max_dispersion);
|
||||||
filter->combine_ratio = combine_ratio;
|
filter->combine_ratio = combine_ratio;
|
||||||
filter->samples = MallocArray(NTP_Sample, filter->max_samples);
|
filter->samples = MallocArray(NTP_Sample, filter->max_samples);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Richard P. Curnow 1997-2003
|
* Copyright (C) Richard P. Curnow 1997-2003
|
||||||
* Copyright (C) Miroslav Lichvar 2011-2016
|
* Copyright (C) Miroslav Lichvar 2011-2016, 2018
|
||||||
*
|
*
|
||||||
* 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 2011-2014, 2016-2017
|
* Copyright (C) Miroslav Lichvar 2011-2014, 2016-2018
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
@@ -4,7 +4,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-2017
|
* Copyright (C) Miroslav Lichvar 2009-2012, 2014-2018
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
15
test/simulation/012-daemonts
Executable file
15
test/simulation/012-daemonts
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. ./test.common
|
||||||
|
|
||||||
|
test_start "daemon timestamping"
|
||||||
|
|
||||||
|
export CLKNETSIM_TIMESTAMPING=0
|
||||||
|
|
||||||
|
run_test || test_fail
|
||||||
|
check_chronyd_exit || test_fail
|
||||||
|
check_source_selection || test_fail
|
||||||
|
check_packet_interval || test_fail
|
||||||
|
check_sync || test_fail
|
||||||
|
|
||||||
|
test_pass
|
||||||
@@ -95,6 +95,8 @@ for chronyc_conf in \
|
|||||||
"delete 10.0.0.0" \
|
"delete 10.0.0.0" \
|
||||||
"deny 1.2.3.4" \
|
"deny 1.2.3.4" \
|
||||||
"deny all 1.2.3.0/24" \
|
"deny all 1.2.3.0/24" \
|
||||||
|
"dfreq 1.0e-3" \
|
||||||
|
"doffset -1.0" \
|
||||||
"dump" \
|
"dump" \
|
||||||
"local stratum 5 distance 1.0 orphan" \
|
"local stratum 5 distance 1.0 orphan" \
|
||||||
"local off" \
|
"local off" \
|
||||||
@@ -126,6 +128,7 @@ for chronyc_conf in \
|
|||||||
"settime 16:30" \
|
"settime 16:30" \
|
||||||
"settime 16:30:05" \
|
"settime 16:30:05" \
|
||||||
"settime Nov 21, 2015 16:30:05" \
|
"settime Nov 21, 2015 16:30:05" \
|
||||||
|
"serverstats" \
|
||||||
"shutdown" \
|
"shutdown" \
|
||||||
"smoothtime reset" \
|
"smoothtime reset" \
|
||||||
"smoothtime activate" \
|
"smoothtime activate" \
|
||||||
@@ -137,4 +140,24 @@ do
|
|||||||
check_chronyc_output "501 Not authorised" || test_fail
|
check_chronyc_output "501 Not authorised" || test_fail
|
||||||
done
|
done
|
||||||
|
|
||||||
|
chronyc_conf="dns -n
|
||||||
|
dns +n
|
||||||
|
dns -4
|
||||||
|
dns -6
|
||||||
|
dns -46
|
||||||
|
timeout 200
|
||||||
|
retries 1
|
||||||
|
keygen
|
||||||
|
keygen 10 MD5 128
|
||||||
|
help
|
||||||
|
quit
|
||||||
|
nosuchcommand"
|
||||||
|
|
||||||
|
run_test || test_fail
|
||||||
|
|
||||||
|
check_chronyc_output "^1 (MD5|SHA1) HEX:........................................
|
||||||
|
10 MD5 HEX:................................
|
||||||
|
System clock:.*this help
|
||||||
|
*$" || test_fail
|
||||||
|
|
||||||
test_pass
|
test_pass
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ limit=100
|
|||||||
min_sync_time=100
|
min_sync_time=100
|
||||||
max_sync_time=104
|
max_sync_time=104
|
||||||
client_chronyd_options="-r"
|
client_chronyd_options="-r"
|
||||||
client_conf="dumpdir tmp"
|
client_conf="dumpdir tmp
|
||||||
|
maxupdateskew 10000"
|
||||||
|
|
||||||
run_test || test_fail
|
run_test || test_fail
|
||||||
|
|
||||||
|
|||||||
30
test/simulation/134-log
Executable file
30
test/simulation/134-log
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. ./test.common
|
||||||
|
test_start "log directive"
|
||||||
|
|
||||||
|
refclock_jitter=$jitter
|
||||||
|
client_server_options="maxpoll 6"
|
||||||
|
client_conf="refclock PHC /dev/ptp0 dpoll 4 poll 6 noselect
|
||||||
|
logbanner 10
|
||||||
|
logdir tmp
|
||||||
|
log tracking rawmeasurements measurements statistics rtc refclocks tempcomp
|
||||||
|
tempcomp tmp/tempcomp 64 0.0 0.0 0.0 0.0"
|
||||||
|
|
||||||
|
echo 0.0 > tmp/tempcomp
|
||||||
|
|
||||||
|
run_test || test_fail
|
||||||
|
check_chronyd_exit || test_fail
|
||||||
|
check_source_selection || test_fail
|
||||||
|
check_packet_interval || test_fail
|
||||||
|
check_sync || test_fail
|
||||||
|
|
||||||
|
check_file_messages "=============" 31 33 \
|
||||||
|
tracking.log measurements.log tempcomp.log || test_fail
|
||||||
|
check_file_messages "20.*192\.168\.123\.1" 150 160 \
|
||||||
|
tracking.log measurements.log statistics.log || test_fail
|
||||||
|
check_file_messages "20.*PHC0" 150 160 statistics.log || test_fail
|
||||||
|
check_file_messages "20.*PHC0" 750 800 refclocks.log || test_fail
|
||||||
|
check_file_messages "20.* 0\.0000" 150 160 tempcomp.log || test_fail
|
||||||
|
|
||||||
|
test_pass
|
||||||
18
test/simulation/135-ratelimit
Executable file
18
test/simulation/135-ratelimit
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. ./test.common
|
||||||
|
test_start "ratelimit directive"
|
||||||
|
|
||||||
|
server_conf="ratelimit interval 6 burst 2 leak 4"
|
||||||
|
client_server_options="minpoll 3 maxpoll 3"
|
||||||
|
min_sync_time=16
|
||||||
|
|
||||||
|
run_test || test_fail
|
||||||
|
check_chronyd_exit || test_fail
|
||||||
|
check_packet_interval || test_fail
|
||||||
|
check_sync || test_fail
|
||||||
|
|
||||||
|
check_file_messages " 2 1 " 1200 1300 log.packets || test_fail
|
||||||
|
check_file_messages " 1 2 " 180 220 log.packets || test_fail
|
||||||
|
|
||||||
|
test_pass
|
||||||
16
test/simulation/136-broadcast
Executable file
16
test/simulation/136-broadcast
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. ./test.common
|
||||||
|
|
||||||
|
test_start "broadcast directive"
|
||||||
|
|
||||||
|
server_conf="broadcast 64 192.168.123.255"
|
||||||
|
client_server_options="offline"
|
||||||
|
|
||||||
|
run_test || test_fail
|
||||||
|
check_chronyd_exit || test_fail
|
||||||
|
check_packet_interval && test_fail
|
||||||
|
|
||||||
|
check_file_messages " 1 2 " 150 160 log.packets || test_fail
|
||||||
|
|
||||||
|
test_pass
|
||||||
@@ -337,7 +337,7 @@ check_chronyc_output() {
|
|||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check the number of messages matching a matter in the client logs
|
# Check the number of messages matching a pattern in the client logs
|
||||||
check_log_messages() {
|
check_log_messages() {
|
||||||
local i count ret=0 pattern=$1 min=$2 max=$3
|
local i count ret=0 pattern=$1 min=$2 max=$3
|
||||||
|
|
||||||
@@ -355,6 +355,25 @@ check_log_messages() {
|
|||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check the number of messages matching a pattern in a specified file
|
||||||
|
check_file_messages() {
|
||||||
|
local i count ret=0 pattern=$1 min=$2 max=$3
|
||||||
|
shift 3
|
||||||
|
|
||||||
|
test_message 2 1 "checking number of messages \"$pattern\":"
|
||||||
|
|
||||||
|
for i; do
|
||||||
|
count=$(grep "$pattern" tmp/$i | wc -l)
|
||||||
|
test_message 3 0 "$i: $count"
|
||||||
|
|
||||||
|
[ "$min" -le "$count" ] && [ "$count" -le "$max" ] && \
|
||||||
|
test_ok || test_bad
|
||||||
|
[ $? -eq 0 ] || ret=1
|
||||||
|
done
|
||||||
|
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
# Check if only NTP port (123) was used
|
# Check if only NTP port (123) was used
|
||||||
check_packet_port() {
|
check_packet_port() {
|
||||||
local i ret=0 port=123
|
local i ret=0 port=123
|
||||||
|
|||||||
@@ -11,13 +11,15 @@ SHARED_OBJS = test.o
|
|||||||
TEST_OBJS := $(sort $(patsubst %.c,%.o,$(wildcard *.c)))
|
TEST_OBJS := $(sort $(patsubst %.c,%.o,$(wildcard *.c)))
|
||||||
TESTS := $(patsubst %.o,%.test,$(filter-out $(SHARED_OBJS),$(TEST_OBJS)))
|
TESTS := $(patsubst %.o,%.test,$(filter-out $(SHARED_OBJS),$(TEST_OBJS)))
|
||||||
|
|
||||||
FILTER_OBJS = %/main.o %/client.o %/getdate.o
|
CHRONYD_OBJS := $(patsubst %.o,$(CHRONY_SRCDIR)/%.o,$(filter-out main.o,\
|
||||||
CHRONY_OBJS := $(filter-out $(FILTER_OBJS),$(wildcard $(CHRONY_SRCDIR)/*.o))
|
$(filter %.o,$(shell $(MAKE) -f $(CHRONY_SRCDIR)/Makefile print-chronyd-objects))))
|
||||||
|
|
||||||
all: $(TESTS)
|
all: $(TESTS)
|
||||||
|
|
||||||
%.test: %.o $(SHARED_OBJS)
|
$(CHRONYD_OBJS): ;
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(CHRONY_OBJS:%/$*.o=) $(LDFLAGS)
|
|
||||||
|
%.test: %.o $(SHARED_OBJS) $(CHRONYD_OBJS)
|
||||||
|
$(CC) $(CFLAGS) -o $@ $(filter-out $(CHRONY_SRCDIR)/$<,$^) $(LDFLAGS)
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
|
||||||
@@ -30,7 +32,7 @@ check: $(TESTS)
|
|||||||
exit $$ret
|
exit $$ret
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o $(TESTS)
|
rm -f *.o *.gcda *.gcno core.* $(TESTS)
|
||||||
rm -rf .deps
|
rm -rf .deps
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Miroslav Lichvar 2016-2017
|
* Copyright (C) Miroslav Lichvar 2016-2018
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
@@ -18,9 +18,13 @@
|
|||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <samplefilt.c>
|
#include <local.h>
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
|
#define LCL_GetSysPrecisionAsQuantum() (1.0e-6)
|
||||||
|
|
||||||
|
#include <samplefilt.c>
|
||||||
|
|
||||||
void
|
void
|
||||||
test_unit(void)
|
test_unit(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Miroslav Lichvar 2016
|
* Copyright (C) Miroslav Lichvar 2016, 2018
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
2
util.c
2
util.c
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* Copyright (C) Richard P. Curnow 1997-2003
|
* Copyright (C) Richard P. Curnow 1997-2003
|
||||||
* Copyright (C) Miroslav Lichvar 2009, 2012-2017
|
* Copyright (C) Miroslav Lichvar 2009, 2012-2018
|
||||||
*
|
*
|
||||||
* 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