Hello community,

here is the log from the commit of package chrony for 
openSUSE:Leap:15.2:SLE-workarounds checked in at 2020-01-21 10:09:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2:SLE-workarounds/chrony (Old)
 and      /work/SRC/openSUSE:Leap:15.2:SLE-workarounds/.chrony.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "chrony"

Tue Jan 21 10:09:33 2020 rev:1 rq: version:3.2

Changes:
--------
New Changes file:

--- /dev/null   2019-12-19 10:12:34.003146842 +0100
+++ 
/work/SRC/openSUSE:Leap:15.2:SLE-workarounds/.chrony.new.26092/chrony.changes   
    2020-01-21 10:09:34.534728885 +0100
@@ -0,0 +1,409 @@
+-------------------------------------------------------------------
+Wed Jan  8 17:31:23 UTC 2020 - Reinhard Max <[email protected]>
+
+- bsc#1159840: Add chrony-ntp-era-split.patch from upstream to fix
+  "make check" builds made after 2019-12-20. Existing installations
+  do not need to be updated as the bug only affects the test, but
+  not chrony itself.
+
+-------------------------------------------------------------------
+Wed Mar 20 15:14:12 UTC 2019 - Reinhard Max <[email protected]>
+
+- Fix ordering and dependencies of chronyd.service, so that it is
+  started after name resolution is up (bsc#1129914).
+- Add chrony-service-ordering.patch
+
+-------------------------------------------------------------------
+Fri Dec 14 09:58:08 UTC 2018 - Martin Pluskal <[email protected]>
+
+- Make sure to generate correct sysconfig file (boo#1117147)
+
+-------------------------------------------------------------------
+Wed Apr 18 02:55:54 UTC 2018 - [email protected]
+
+- Added /etc/chrony.d/ directory to the package (bsc#1083597)
+  Modifed default chrony.conf to add "include /etc/chrony.d/*"
+
+-------------------------------------------------------------------
+Mon Mar 26 17:30:07 CEST 2018 - [email protected]
+
+- Use %license instead of %doc [bsc#1082318]
+
+-------------------------------------------------------------------
+Wed Mar 14 15:11:56 CET 2018 - [email protected]
+
+- Fix name of fillup template (was never installed before)
+- Fix Requires for fillup, it's used in post, not pre.
+
+-------------------------------------------------------------------
+Fri Feb  9 10:21:09 UTC 2018 - [email protected]
+
+- Enable pps support
+
+-------------------------------------------------------------------
+Thu Nov 23 13:47:05 UTC 2017 - [email protected]
+
+- Replace references to /var/adm/fillup-templates with new 
+  %_fillupdir macro (boo#1069468)
+
+-------------------------------------------------------------------
+Thu Oct 26 10:39:11 UTC 2017 - [email protected]
+
+- Cleanup spec file:
+  * Drop pre systemd support
+  * Run spec-cleaner
+
+-------------------------------------------------------------------
+Tue Oct 24 18:23:56 UTC 2017 - [email protected]
+
+- Modified the spec file to comment out the pool statement
+  in chrony.conf if _not_ building for openSUSE. (bsc#1063704).
+
+-------------------------------------------------------------------
+Thu Sep 28 16:17:08 UTC 2017 - [email protected]
+
+- refresh patches to apply cleanly again
+  - chrony-config.patch
+  - chrony-fix-open.patch
+
+-------------------------------------------------------------------
+Wed Sep 20 23:57:53 UTC 2017 - [email protected]
+
+- Upgraded to version 3.2:
+  Enhancements
+  * Improve stability with NTP sources and reference clocks
+  * Improve stability with hardware timestamping
+  * Improve support for NTP interleaved modes
+  * Control frequency of system clock on macOS 10.13 and later
+  * Set TAI-UTC offset of system clock with leapsectz directive
+  * Minimise data in client requests to improve privacy
+  * Allow transmit-only hardware timestamping
+  * Add support for new timestamping options introduced in Linux 4.13
+  * Add root delay, root dispersion and maximum error to tracking log
+  * Add mindelay and asymmetry options to server/peer/pool directive
+  * Add extpps option to PHC refclock to timestamp external PPS signal
+  * Add pps option to refclock directive to treat any refclock as PPS
+  * Add width option to refclock directive to filter wrong pulse edges
+  * Add rxfilter option to hwtimestamp directive
+  * Add -x option to disable control of system clock
+  * Add -l option to log to specified file instead of syslog
+  * Allow multiple command-line options to be specified together
+  * Allow starting without root privileges with -Q option
+  * Update seccomp filter for new glibc versions
+  * Dump history on exit by default with dumpdir directive
+  * Use hardening compiler options by default
+  Bug fixes
+  * Don't drop PHC samples with low-resolution system clock
+  * Ignore outliers in PHC tracking, RTC tracking, manual input
+  * Increase polling interval when peer is not responding
+  * Exit with error message when include directive fails
+  * Don't allow slash after hostname in allow/deny directive/command
+  * Try to connect to all addresses in chronyc before giving up
+- Upgraded clknetsim to version 71dbbc5.
+- Reworked chrony-fix-open.patch to fit the new version
+
+-------------------------------------------------------------------
+Tue Jan 31 16:38:05 UTC 2017 - [email protected]
+
+- Upgraded to version 3.1:
+  - Enhancements
+    - Add support for precise cross timestamping of PHC on Linux
+    - Add minpoll, precision, nocrossts options to hwtimestamp directive
+    - Add rawmeasurements option to log directive and modify measurements
+      option to log only valid measurements from synchronised sources
+    - Allow sub-second polling interval with NTP sources
+  - Bug fixes
+    - Fix time smoothing in interleaved mode
+- Upgraded clknetsim to version ce89a1b.
+- Reworked the following patches to fit the new versions
+  - chrony-config.patch
+  - chrony-service-helper.patch
+  - chrony-fix-open.patch
+
+-------------------------------------------------------------------
+Mon Jan 16 22:36:09 UTC 2017 - [email protected]
+
+- Upgraded to version 3.0:
+  - Enhancements
+    - Add support for software and hardware timestamping on Linux
+    - Add support for client/server and symmetric interleaved modes
+    - Add support for MS-SNTP authentication in Samba
+    - Add support for truncated MACs in NTPv4 packets
+    - Estimate and correct for asymmetric network jitter
+    - Increase default minsamples and polltarget to improve stability with 
very low jitter
+    - Add maxjitter directive to limit source selection by jitter
+    - Add offset option to server/pool/peer directive
+    - Add maxlockage option to refclock directive
+    - Add -t option to chronyd to exit after specified time
+    - Add partial protection against replay attacks on symmetric mode
+    - Don't reset polling interval when switching sources to online state
+    - Allow rate limiting with very short intervals
+    - Improve maximum server throughput on Linux and NetBSD
+    - Remove dump files after start
+    - Add tab-completion to chronyc with libedit/readline
+    - Add ntpdata command to print details about NTP measurements
+    - Allow all source options to be set in add server/peer command
+    - Indicate truncated addresses/hostnames in chronyc output
+    - Print reference IDs as hexadecimal numbers to avoid confusion with IPv4 
addresses
+  - Bug fixes
+    - Fix crash with disabled asynchronous name resolving
+- Upgraded clknetsim to version 6bb6519.
+
+-------------------------------------------------------------------
+Tue Nov 29 16:54:52 UTC 2016 - [email protected]
+
+- Upgraded to version 2.4.1:
+  - Bug fixes
+    - Fix processing of kernel timestamps on non-Linux systems
+    - Fix crash with smoothtime directive
+    - Fix validation of refclock sample times
+    - Fix parsing of refclock directive
+
+-------------------------------------------------------------------
+Wed Jun  8 10:02:51 UTC 2016 - [email protected]
+
+- update to 2.4:
+  - Enhancements
+    - Add orphan option to local directive for orphan mode
+      compatible with ntpd
+    - Add distance option to local directive to set activation
+      threshold (1 second by default)
+    - Add maxdrift directive to set maximum allowed drift of system
+      clock
+    - Try to replace NTP sources exceeding maximum distance
+    - Randomise source replacement to avoid getting stuck with bad
+      sources
+    - Randomise selection of sources from pools on start
+    - Ignore reference timestamp as ntpd doesn't always set it
+      correctly
+    - Modify tracking report to use same values as seen by NTP
+      clients
+    - Add -c option to chronyc to write reports in CSV format
+    - Provide detailed manual pages
+  - Bug fixes
+    - Fix SOCK refclock to work correctly when not specified as
+      last refclock
+    - Fix initstepslew and -q/-Q options to accept time from own
+      NTP clients
+    - Fix authentication with keys using 512-bit hash functions
+    - Fix crash on exit when multiple signals are received
+    - Fix conversion of very small floating-point numbers in
+      command packets
+  - Removed features
+    - Drop documentation in Texinfo format
+- update clknetsim to a5949fe for fixing a testsuite failure:
+  - add IP_PKTINFO socket option
+  - accept environment variables in make
+  - fix building with FORTIFY_SOURCE
++++ 212 more lines (skipped)
++++ between /dev/null
++++ and 
/work/SRC/openSUSE:Leap:15.2:SLE-workarounds/.chrony.new.26092/chrony.changes

New:
----
  chrony-3.2.tar.gz
  chrony-config.patch
  [email protected]
  [email protected]
  chrony-fix-open.patch
  chrony-logrotate.patch
  chrony-ntp-era-split.patch
  chrony-service-helper.patch
  chrony-service-ordering.patch
  chrony.changes
  chrony.dhclient
  chrony.helper
  chrony.spec
  chrony.sysconfig
  clknetsim-71dbbc5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ chrony.spec ++++++
#
# spec file for package chrony
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define vendorzone opensuse.
%global clknetsim_ver 71dbbc5
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir %{_localstatedir}/adm/fillup-templates
%endif
Name:           chrony
Version:        3.2
Release:        0
Summary:        System Clock Synchronization Client and Server
License:        GPL-2.0-only
Group:          Productivity/Networking/Other
Url:            http://chrony.tuxfamily.org/
Source:         http://download.tuxfamily.org/chrony/chrony-%{version}.tar.gz
Source2:        chrony.sysconfig
Source3:        chrony.dhclient
Source4:        chrony.helper
Source5:        [email protected]
Source6:        [email protected]
# Simulator for test suite
Source10:       
https://github.com/mlichvar/clknetsim/archive/%{clknetsim_ver}/clknetsim-%{clknetsim_ver}.tar.gz
# PATCH-MISSING-TAG -- See 
http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch0:         chrony-config.patch
# Add NTP servers from DHCP when starting service
Patch1:         chrony-service-helper.patch
Patch2:         chrony-logrotate.patch
Patch5:         chrony-fix-open.patch
Patch6:         chrony-service-ordering.patch
Patch7:         chrony-ntp-era-split.patch
BuildRequires:  NetworkManager-devel
BuildRequires:  bison
BuildRequires:  gcc-c++
BuildRequires:  libcap-devel
BuildRequires:  libedit-devel
BuildRequires:  mozilla-nss-devel
BuildRequires:  pkgconfig
BuildRequires:  pps-tools-devel
# The timezone package is needed for the "make check" tests. It can be
# removed if the call to make check is ever deleted.
BuildRequires:  timezone
BuildRequires:  pkgconfig(systemd)
Requires:       logrotate
Requires(post): %fillup_prereq
Requires(pre):  %{_sbindir}/groupadd
Requires(pre):  %{_sbindir}/useradd
Provides:       ntp-daemon
%ifarch s390 s390x ppc64le
BuildRequires:  libseccomp-devel >= 2.2.0
%else
BuildRequires:  libseccomp-devel
%endif

%description
Chrony is an implementation of the Network Time Protocol (NTP). It can
synchronize the system clock with NTP servers, reference clocks (e.g. a
GPS receiver), and manual input using wristwatch and keyboard. It can
also operate as an NTPv4 (RFC 5905) server and peer to provide a time
service to other computers in the network.

Chrony consists of two programs: chronyd and chronyc.

Chronyd is a daemon which runs in the background on the system. It
obtains measurements of the system clock’s offset relative to time
servers on other systems via the network and adjusts the system time
accordingly. For isolated systems, the user can periodically enter the
correct time by hand (using chronyc). In either case, chronyd
determines the rate at which the computer gains or loses time, and
compensates for this. Chronyd can act as either a client or a server.

Chronyc provides a user interface to chronyd for monitoring its
performance and configuring various settings. It can do so while
running on the same computer as the chronyd instance it is controlling
or a different computer.

%prep
%setup -q -a 10
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch5 -p1
%patch6
%patch7

# If this is an openSUSE build, use our vendor zone
# (2.*pool.ntp.org names include IPv6 addresses). If not
# an openSUSE build, comment out the pool statement
%if 0%{?is_opensuse}
sed -e 's|^\(pool \)\(pool.ntp.org\)|\12.%{vendorzone}\2|' \
        < examples/chrony.conf.example2 > chrony.conf
%else
sed -e 's|^\pool|! pool|' \
        < examples/chrony.conf.example2 > chrony.conf
%endif

cat << EOF >> chrony.conf

# Also include any directives found in configuration files in /etc/chrony.d
include /etc/chrony.d/*.conf
EOF

touch -r examples/chrony.conf.example2 chrony.conf

# regenerate the file from getdate.y
rm -f getdate.c

mv clknetsim-%{clknetsim_ver}* test/simulation/clknetsim

%build
# not autoconf:
export CFLAGS="%{optflags} -Wall -fpic -DPIC $(pkg-config --cflags libseccomp)"
export LDFLAGS="-pie -Wl,-z,relro,-z,now"
%configure                                  \
  --docdir="%{_docdir}/%{name}"             \
  %if %{with syscallfilter}
  --enable-scfilter                         \
  %endif
  --with-user=chrony                        \
  --with-hwclockfile=%{_sysconfdir}/adjtime \
  --with-sendmail=%{_sbindir}/sendmail
make %{?_smp_mflags} all docs

%install
%make_install
install -Dpm 0644 chrony.conf \
  %{buildroot}%{_sysconfdir}/chrony.conf
mkdir %{buildroot}%{_sysconfdir}/chrony.d
install -Dpm 0640 examples/chrony.keys.example \
  %{buildroot}%{_sysconfdir}/chrony.keys
install -Dpm 0755 examples/chrony.nm-dispatcher \
  %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony
install -Dpm 0755 %{SOURCE3} \
  %{buildroot}%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
install -Dpm 0644 examples/chrony.logrotate \
  %{buildroot}%{_sysconfdir}/logrotate.d/chrony
install -Dpm 0644 examples/chronyd.service \
  %{buildroot}%{_unitdir}/chronyd.service
install -Dpm 0644 examples/chrony-wait.service \
  %{buildroot}%{_unitdir}/chrony-wait.service
install -Dpm 0644 %{SOURCE5} \
  %{buildroot}%{_unitdir}/[email protected]
install -Dpm 0644 %{SOURCE6} \
  %{buildroot}%{_unitdir}/[email protected]

install -d %{buildroot}%{sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcchronyd
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcchrony-wait

install -d %{buildroot}%{_prefix}/lib/systemd/ntp-units.d
echo 'chronyd.service' > \
        %{buildroot}%{_prefix}/lib/systemd/ntp-units.d/50-chronyd.list

install -Dpm 0644 %{SOURCE2} \
  %{buildroot}%{_fillupdir}/sysconfig.chronyd
install -Dpm 755 %{SOURCE4} \
  %{buildroot}%{_datadir}/chrony-helper

install -d %{buildroot}%{_localstatedir}/log/chrony
touch %{buildroot}%{_localstatedir}/lib/chrony/{drift,rtc}

%check
# Set random seed to get deterministic results
export CLKNETSIM_RANDOM_SEED=24501
make %{?_smp_mflags} -C test/simulation/clknetsim
make %{?_smp_mflags} check

%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || useradd -r -g %{name} -d 
"%{_localstatedir}/lib/chrony" -s /bin/false -c "Chrony Daemon" %{name}
%service_add_pre chronyd.service chrony-wait.service

%preun
%service_del_preun chronyd.service chrony-wait.service

%post
%fillup_only -n chronyd
%service_add_post chronyd.service chrony-wait.service

%postun
%service_del_postun chronyd.service chrony-wait.service

%files
%license COPYING
%doc FAQ NEWS README
%doc examples
%config(noreplace) %attr(0640,root,%{name}) %{_sysconfdir}/chrony.conf
%config(noreplace) %attr(0640,root,%{name}) %verify(not md5 size mtime) 
%{_sysconfdir}/chrony.keys
%config(noreplace) %{_sysconfdir}/logrotate.d/chrony
%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony
%dir %{_sysconfdir}/chrony.d/
%dir %{_sysconfdir}/dhcp/
%dir %{_sysconfdir}/dhcp/dhclient.d/
%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
%{_bindir}/chronyc
%{_sbindir}/chronyd
%{_datadir}/chrony-helper
%{_mandir}/man1/chronyc.1%{ext_man}
%{_mandir}/man5/chrony.conf.5%{ext_man}
%{_mandir}/man8/chronyd.8%{ext_man}
%{_prefix}/lib/systemd/ntp-units.d/*.list
%{_unitdir}/chrony*.service
%{_unitdir}/chrony*.timer
%{_sbindir}/rcchrony*
%{_fillupdir}/sysconfig.chronyd
%dir %attr(750,chrony,chrony) %{_localstatedir}/lib/chrony
%ghost %attr(640,chrony,chrony) %{_localstatedir}/lib/chrony/drift
%ghost %attr(640,chrony,chrony) %{_localstatedir}/lib/chrony/rtc
%dir %attr(750,chrony,chrony) %{_localstatedir}/log/chrony

%changelog
++++++ chrony-config.patch ++++++
Index: chrony-3.2/examples/chrony.conf.example3
===================================================================
--- chrony-3.2.orig/examples/chrony.conf.example3
+++ chrony-3.2/examples/chrony.conf.example3
@@ -27,12 +27,38 @@
 # you can access at http://support.ntp.org/bin/view/Servers/WebHome or
 # you can use servers from the pool.ntp.org project.
 
-! server foo.example.net iburst
-! server bar.example.net iburst
-! server baz.example.net iburst
-
 ! pool pool.ntp.org iburst
  
+# for Europe:
+! server 0.europe.pool.ntp.org
+! server 1.europe.pool.ntp.org
+! server 2.europe.pool.ntp.org
+! server 3.europe.pool.ntp.org
+
+# for Asia:
+! server 0.asia.pool.ntp.org
+! server 1.asia.pool.ntp.org
+! server 2.asia.pool.ntp.org
+! server 3.asia.pool.ntp.org
+
+# for North America:
+! server 0.north-america.pool.ntp.org
+! server 1.north-america.pool.ntp.org
+! server 2.north-america.pool.ntp.org
+! server 3.north-america.pool.ntp.org
+
+# for South America:
+! server 0.south-america.pool.ntp.org
+! server 1.south-america.pool.ntp.org
+! server 2.south-america.pool.ntp.org
+! server 3.south-america.pool.ntp.org
+
+# for Oceania:
+! server 0.oceania.pool.ntp.org
+! server 1.oceania.pool.ntp.org
+! server 2.oceania.pool.ntp.org
+! server 3.oceania.pool.ntp.org
+
 #######################################################################
 ### AVOIDING POTENTIALLY BOGUS CHANGES TO YOUR CLOCK
 #
@@ -65,7 +91,7 @@
 # immediately so that it doesn't gain or lose any more time.  You
 # generally want this, so it is uncommented.
 
-driftfile /var/lib/chrony/drift
+driftfile /var/lib/chrony/chrony.drift
 
 # If you want to enable NTP authentication with symmetric keys, you will need
 # to uncomment the following line and edit the file to set up the keys.
@@ -124,8 +150,8 @@ driftfile /var/lib/chrony/drift
 # produce some graphs of your system's timekeeping performance, or you
 # need help in debugging a problem.
 
-! logdir /var/log/chrony
-! log measurements statistics tracking
+logdir /var/log/chrony
+log measurements statistics tracking
 
 # If you have real time clock support enabled (see below), you might want
 # this line instead:
++++++ [email protected] ++++++
[Unit]
Description=DNS SRV lookup of %I for chrony
After=chronyd.service network-online.target
Wants=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/share/chrony-helper update-dnssrv-servers %I
++++++ [email protected] ++++++
[Unit]
Description=Periodic DNS SRV lookup of %I for chrony

[Timer]
OnActiveSec=0
OnUnitInactiveSec=1h

[Install]
WantedBy=timers.target
++++++ chrony-fix-open.patch ++++++
Index: chrony-3.2/clknetsim-71dbbc509eee05cb29e33468be93d5ba52b79429/client.c
===================================================================
--- chrony-3.2.orig/clknetsim-71dbbc509eee05cb29e33468be93d5ba52b79429/client.c
+++ chrony-3.2/clknetsim-71dbbc509eee05cb29e33468be93d5ba52b79429/client.c
@@ -1008,6 +1008,8 @@ int open(const char *pathname, int flags
        else if (!strcmp(pathname, "/dev/ptp1"))
                return SYSCLK_FD;
 
+       if (!_open)
+               _open = (int (*)(const char *pathname, int 
flags))dlsym(RTLD_NEXT, "open");
        r = _open(pathname, flags);
        assert(r < 0 || (r < BASE_SOCKET_FD && r < BASE_TIMER_FD));
 
@@ -1026,6 +1028,8 @@ int close(int fd) {
                return 0;
        }
 
+       if (!_close)
+               _close = (int (*)(int fd))dlsym(RTLD_NEXT, "close");
        return _close(fd);
 }
 
++++++ chrony-logrotate.patch ++++++
Index: chrony-2.3/examples/chrony.logrotate
===================================================================
--- chrony-2.3.orig/examples/chrony.logrotate
+++ chrony-2.3/examples/chrony.logrotate
@@ -1,4 +1,5 @@
 /var/log/chrony/*.log {
+    su chrony chrony
     missingok
     nocreate
     sharedscripts
++++++ chrony-ntp-era-split.patch ++++++
commit 2d9eb5b6fa5225a7300c8eed95712969249900fb
Author: Miroslav Lichvar <[email protected]>
Date:   Fri Jan 3 11:25:55 2020 +0100

    test: fix util unit test for NTP era split
    
    The current default NTP era split passed the Unix epoch (~50 years ago),
    which means the epoch converted to an NTP timestamp and back ends up in
    the next NTP era (year 2106).
    
    Fix the test to take into account the era split.

--- test/unit/util.c.orig
+++ test/unit/util.c
@@ -43,11 +43,19 @@ void test_unit(void) {
   ntp_ts.hi = htonl(JAN_1970);
   ntp_ts.lo = 0xffffffff;
   UTI_Ntp64ToTimespec(&ntp_ts, &ts);
+#if defined(HAVE_LONG_TIME_T) && NTP_ERA_SPLIT > 0
+  TEST_CHECK(ts.tv_sec == 0x100000000LL * (1 + (NTP_ERA_SPLIT - 1) / 
0x100000000LL));
+#else
   TEST_CHECK(ts.tv_sec == 0);
+#endif
   TEST_CHECK(ts.tv_nsec == 999999999);
 
   UTI_AddDoubleToTimespec(&ts, 1e-9, &ts);
+#if defined(HAVE_LONG_TIME_T) && NTP_ERA_SPLIT > 0
+  TEST_CHECK(ts.tv_sec == 1 + 0x100000000LL * (1 + (NTP_ERA_SPLIT - 1) / 
0x100000000LL));
+#else
   TEST_CHECK(ts.tv_sec == 1);
+#endif
   TEST_CHECK(ts.tv_nsec == 0);
 
   ntp_fuzz.hi = 0;
++++++ chrony-service-helper.patch ++++++
--- chrony-3.1/examples/chronyd.service 2017-01-31 05:22:11.000000000 -0500
+++ chrony-3.1/examples/chronyd.service 2017-01-31 12:00:01.000000000 -0500
@@ -10,6 +10,7 @@
 PIDFile=/var/run/chronyd.pid
 EnvironmentFile=-/etc/sysconfig/chronyd
 ExecStart=/usr/sbin/chronyd $OPTIONS
+ExecStartPost=/usr/share/chrony-helper update-daemon
 PrivateTmp=yes
 ProtectHome=yes
 ProtectSystem=full
++++++ chrony-service-ordering.patch ++++++
--- examples/chronyd.service.orig
+++ examples/chronyd.service
@@ -1,7 +1,11 @@
 [Unit]
 Description=NTP client/server
 Documentation=man:chronyd(8) man:chrony.conf(5)
-After=ntpdate.service sntp.service ntpd.service
+After=nss-lookup.target
+Wants=network.target
+After=network.target
+Wants=time-sync.target
+Before=time-sync.target
 Conflicts=ntpd.service systemd-timesyncd.service
 ConditionCapability=CAP_SYS_TIME
 
++++++ chrony.dhclient ++++++
#!/bin/bash

SERVERFILE=$SAVEDIR/chrony.servers.$interface

chrony_config() {
        rm -f $SERVERFILE
        if [ "$PEERNTP" != "no" ]; then
                for server in $new_ntp_servers; do
                        echo "$server ${NTPSERVERARGS:-iburst}" >> $SERVERFILE
                done
                /usr/share/chrony-helper update-daemon || :
        fi
}

chrony_restore() {
        if [ -f $SERVERFILE ]; then
                rm -f $SERVERFILE
                /usr/share/chrony-helper update-daemon || :
        fi
}
++++++ chrony.helper ++++++
#!/bin/bash
# This script configures running chronyd to use NTP servers obtained from
# DHCP and _ntp._udp DNS SRV records. Files with servers from DHCP are managed
# externally (e.g. by a dhclient script). Files with servers from DNS SRV
# records are updated here using the dig utility.

chronyc=/usr/bin/chronyc
helper_dir=/var/run/chrony-helper
added_servers_file=$helper_dir/added_servers

network_sysconfig_file=/etc/sysconfig/network
dhclient_servers_files=/var/lib/dhclient/chrony.servers.*
dnssrv_servers_files=$helper_dir/dnssrv@*
dnssrv_timer_prefix=chrony-dnssrv@

chrony_command() {
    $chronyc -a -n -m "$1"
}

is_running() {
    chrony_command "tracking" &> /dev/null
}

is_update_needed() {
    for file in $dhclient_servers_files $dnssrv_servers_files \
            $added_servers_file; do
        [ -e "$file" ] && return 0
    done
    return 1
}

update_daemon() {
    local all_servers_with_args all_servers added_servers

    if ! is_running; then
        rm -f $added_servers_file
        return 0
    fi

    all_servers_with_args=$(
        cat $dhclient_servers_files $dnssrv_servers_files 2> /dev/null)

    all_servers=$(
        echo "$all_servers_with_args" |
            while read server serverargs; do
                echo "$server"
            done | sort -u)
    added_servers=$( (
        cat $added_servers_file 2> /dev/null
        echo "$all_servers_with_args" |
            while read server serverargs; do
                [ -z "$server" ] && continue
                chrony_command "add server $server $serverargs" &> /dev/null &&
                    echo "$server"
            done) | sort -u)

    comm -23 <(echo -n "$added_servers") <(echo -n "$all_servers") |
        while read server; do
            chrony_command "delete $server" &> /dev/null
        done

    added_servers=$(comm -12 <(echo -n "$added_servers") <(echo -n 
"$all_servers"))

    [ -n "$added_servers" ] && echo "$added_servers" > $added_servers_file ||
        rm -f $added_servers_file
}

get_dnssrv_servers() {
    local name=$1

    if ! command -v dig &> /dev/null; then
        echo "Missing dig (DNS lookup utility)" >&2
        return 1
    fi

    (
        . $network_sysconfig_file &> /dev/null

        output=$(dig "$name" srv +short +ndots=2 +search 2> /dev/null)
        [ $? -ne 0 ] && return 0

        echo "$output" | while read prio weight port target; do
            server=${target%.}
            [ -z "$server" ] && continue
            echo "$server port $port ${NTPSERVERARGS:-iburst}"
        done
    )
}

check_dnssrv_name() {
    local name=$1

    if [ -z "$name" ]; then
        echo "No DNS SRV name specified" >&2
        return 1
    fi

    if [ "${name:0:9}" != _ntp._udp ]; then
        echo "DNS SRV name $name doesn't start with _ntp._udp" >&2
        return 1
    fi
}

update_dnssrv_servers() {
    local name=$1
    local srv_file=$helper_dir/dnssrv@$name servers

    check_dnssrv_name "$name" || return 1

    servers=$(get_dnssrv_servers "$name")
    [ -n "$servers" ] && echo "$servers" > "$srv_file" || rm -f "$srv_file"
}

set_dnssrv_timer() {
    local state=$1 name=$2
    local srv_file=$helper_dir/dnssrv@$name servers
    local timer=$dnssrv_timer_prefix$name.timer

    check_dnssrv_name "$name" || return 1

    if [ "$state" = enable ]; then
        systemctl enable "$timer"
        systemctl start "$timer"
    elif [ "$state" = disable ]; then
        systemctl stop "$timer"
        systemctl disable "$timer"
        rm -f "$srv_file"
    fi
}

list_dnssrv_timers() {
    systemctl --all --full -t timer list-units | grep "^$dnssrv_timer_prefix" | 
\
        sed "s|^$dnssrv_timer_prefix\(.*\)\.timer.*|\1|"
}

prepare_helper_dir() {
    mkdir -p $helper_dir
    exec 100> $helper_dir/lock
    if ! flock -w 20 100; then
        echo "Failed to lock $helper_dir" >&2
        return 1
    fi
}

print_help() {
    echo "Usage: $0 COMMAND"
    echo
    echo "Commands:"
    echo "      update-daemon"
    echo "      update-dnssrv-servers NAME"
    echo "      enable-dnssrv NAME"
    echo "      disable-dnssrv NAME"
    echo "      list-dnssrv"
    echo "      is-running"
    echo "      command CHRONYC-COMMAND"
}

case "$1" in
    update-daemon|add-dhclient-servers|remove-dhclient-servers)
        is_update_needed || exit 0
        prepare_helper_dir && update_daemon
        ;;
    update-dnssrv-servers)
        prepare_helper_dir && update_dnssrv_servers "$2" && update_daemon
        ;;
    enable-dnssrv)
        set_dnssrv_timer enable "$2"
        ;;
    disable-dnssrv)
        set_dnssrv_timer disable "$2" && prepare_helper_dir && update_daemon
        ;;
    list-dnssrv)
        list_dnssrv_timers
        ;;
    is-running)
        is_running
        ;;
    command|forced-command)
        chrony_command "$2"
        ;;
    *)
        print_help
        exit 2
esac

exit $?
++++++ chrony.sysconfig ++++++
## Path:        Network/Chrony
## Description: Chrony time synchronization settings
## Type:        yesno
## Default:     "yes"
## ServiceRestart: chronyd
#
# Resolve hostnames with IPv4
#
CHRONY_IPV4="yes"

## Type:        yesno
## Default:     "yes"
## ServiceRestart: chronyd
#
# Resolve hostnames with IPv6
#
CHRONY_IPV6="yes"

## Type:        yesno
## Default:     "yes"
## ServiceRestart: chronyd
#
# Lock the chrony daemon process into RAM, preventing it from swapping out
#
CHRONY_LOCK_IN_RAM="no"


Reply via email to