chrony-4.7/0000755000000000000000000000000015022277664011377 5ustar rootrootchrony-4.7/COPYING0000644000000000000000000004310315022277513012424 0ustar rootroot GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. chrony-4.7/Makefile.in0000644000000000000000000000771715022277513013451 0ustar rootroot################################################## # # chronyd/chronyc - Programs for keeping computer clocks accurate. # # Copyright (C) Richard P. Curnow 1997-2003 # # 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 # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ======================================================================= # # Makefile template SYSCONFDIR = @SYSCONFDIR@ BINDIR = @BINDIR@ SBINDIR = @SBINDIR@ LOCALSTATEDIR = @LOCALSTATEDIR@ CHRONYVARDIR = @CHRONYVARDIR@ DESTDIR = CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ GETDATE_CFLAGS = @GETDATE_CFLAGS@ EXTRA_OBJS = @EXTRA_OBJS@ OBJS = addrfilt.o array.o clientlog.o cmdparse.o conf.o keys.o leapdb.o \ local.o logging.o main.o memory.o nameserv.o nameserv_async.o \ ntp_auth.o ntp_core.o ntp_ext.o ntp_io.o ntp_sources.o quantiles.o \ reference.o regress.o rtc.o samplefilt.o sched.o socket.o sources.o sourcestats.o \ stubs.o smooth.o sys.o sys_null.o tempcomp.o util.o $(EXTRA_OBJS) EXTRA_CLI_OBJS = @EXTRA_CLI_OBJS@ CLI_OBJS = array.o client.o cmdparse.o getdate.o memory.o nameserv.o \ pktlength.o socket.o util.o $(EXTRA_CLI_OBJS) ALL_OBJS = $(OBJS) $(CLI_OBJS) LIBS = @LIBS@ EXTRA_LIBS = @EXTRA_LIBS@ EXTRA_CLI_LIBS = @EXTRA_CLI_LIBS@ # Until we have a main procedure we can link, just build object files # to test compilation all : chronyd chronyc chronyd : $(OBJS) $(CC) $(CFLAGS) -o chronyd $(OBJS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) chronyc : $(CLI_OBJS) $(CC) $(CFLAGS) -o chronyc $(CLI_OBJS) $(LDFLAGS) $(LIBS) $(EXTRA_CLI_LIBS) getdate.o: CFLAGS += $(GETDATE_CFLAGS) distclean : clean $(MAKE) -C doc distclean $(MAKE) -C test/unit distclean -rm -f .DS_Store -rm -f Makefile config.h config.log clean : $(MAKE) -C test/unit clean -rm -f *.o *.s chronyc chronyd core.* *~ -rm -f *.gcda *.gcno -rm -rf .deps -rm -rf *.dSYM getdate.c : getdate.y bison -o getdate.c getdate.y # This can be used to force regeneration of getdate.c getdate : bison -o getdate.c getdate.y # For install, don't use the install command, because its switches # seem to vary between systems. install: chronyd chronyc [ -d $(DESTDIR)$(SYSCONFDIR) ] || mkdir -p $(DESTDIR)$(SYSCONFDIR) [ -d $(DESTDIR)$(SBINDIR) ] || mkdir -p $(DESTDIR)$(SBINDIR) [ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) [ -d $(DESTDIR)$(CHRONYVARDIR) ] || mkdir -p $(DESTDIR)$(CHRONYVARDIR) if [ -f $(DESTDIR)$(SBINDIR)/chronyd ]; then rm -f $(DESTDIR)$(SBINDIR)/chronyd ; fi if [ -f $(DESTDIR)$(BINDIR)/chronyc ]; then rm -f $(DESTDIR)$(BINDIR)/chronyc ; fi cp chronyd $(DESTDIR)$(SBINDIR)/chronyd chmod 755 $(DESTDIR)$(SBINDIR)/chronyd cp chronyc $(DESTDIR)$(BINDIR)/chronyc chmod 755 $(DESTDIR)$(BINDIR)/chronyc $(MAKE) -C doc install docs : $(MAKE) -C doc docs install-docs : $(MAKE) -C doc install-docs %.o : %.c $(CC) $(CFLAGS) $(CPPFLAGS) -c $< %.s : %.c $(CC) $(CFLAGS) $(CPPFLAGS) -S $< quickcheck : chronyd chronyc $(MAKE) -C test/unit check cd test/simulation && ./run cd test/system && ./run check : chronyd chronyc $(MAKE) -C test/unit check cd test/simulation && ./run -i 20 -m 2 cd test/system && ./run print-chronyd-objects : @echo $(OBJS) Makefile : Makefile.in configure @echo @echo Makefile needs to be regenerated, run ./configure @echo @exit 1 .deps: @mkdir .deps .deps/%.d: %.c | .deps @$(CC) -MM $(CPPFLAGS) -MT '$(<:%.c=%.o) $@' $< -o $@ ifndef NODEPS -include $(ALL_OBJS:%.o=.deps/%.d) endif chrony-4.7/NEWS0000644000000000000000000012062615022277513012076 0ustar rootrootNew in version 4.7 ================== Enhancements ------------ * Add opencommands directive to select remote monitoring commands * Add interval option to driftfile directive * Add waitsynced and waitunsynced options to local directive * Add sanity checks for integer values in configuration * Add support for systemd Type=notify service * Add RTC refclock driver * Allow PHC refclock to be specified with network interface name * Don't require multiple refclock samples per poll to simplify filter configuration * Keep refclock reachable when dropping samples with large delay * Improve quantile-based filtering to adapt faster to larger delay * Improve logging of selection failures * Detect clock interference from other processes * Try to reopen message log (-l option) on cyclelogs command Bug fixes --------- * Fix sourcedir reloading to not multiply sources * Fix tracking offset after failed clock step Removed features ---------------- * Drop support for NTS with Nettle < 3.6 and GnuTLS < 3.6.14 * Drop support for building without POSIX threads New in version 4.6.1 ==================== Enhancements ------------ * Add ntsaeads directive to enable only selected AEAD algorithms for NTS Workarounds ----------- * Negotiate use of compliant NTS keys with AES-128-GCM-SIV AEAD algorithm (by default the keys are generated differently than in RFC 8915 for compatibility with chrony server and client versions 4.4, 4.5, and 4.6) * Switch to compliant NTS keys if first response from server is NTS NAK New in version 4.6 ================== Enhancements ------------ * Add activate option to local directive to set activation threshold * Add ipv4 and ipv6 options to server/pool/peer directive * Add kod option to ratelimit directive for server KoD RATE support * Add leapseclist directive to read NIST/IERS leap-seconds.list file * Add ptpdomain directive to set PTP domain for NTP over PTP * Allow disabling pidfile * Improve copy server option to accept unsynchronised status instantly * Log one selection failure on start * Add offset command to modify source offset correction * Add timestamp sources to ntpdata report Bug fixes --------- * Fix crash on sources reload during initstepslew or RTC initialisation * Fix source refreshment to not repeat failed name resolving attempts New in version 4.5 ================== Enhancements ------------ * Add support for AES-GCM-SIV in GnuTLS * Add support for corrections from PTP transparent clocks * Add support for systemd socket activation Bug fixes --------- * Fix presend in interleaved mode * Fix reloading of modified sources from sourcedir New in version 4.4 ================== Enhancements ------------ * Add support for AES-GCM-SIV with Nettle >= 3.9 to shorten NTS cookies to avoid some length-specific blocking of NTP on Internet * Add support for multiple refclocks using extpps option on one PHC * Add maxpoll option to hwtimestamp directive to improve PHC tracking with low packet rates * Add hwtstimeout directive to configure timeout for late timestamps * Handle late hardware transmit timestamps of NTP requests on all sockets * Handle mismatched 32/64-bit time_t in SOCK refclock samples * Improve source replacement * Log important changes made by command requests (chronyc) * Refresh address of NTP sources periodically * Request nanosecond kernel RX timestamping on FreeBSD * Set DSCP for IPv6 packets * Shorten NTS-KE retry interval when network is down * Update seccomp filter for musl * Warn if loading keys from file with unexpected permissions * Warn if source selection fails or falseticker is detected * Add selectopts command to modify source-specific selection options * Add timestamp sources to serverstats report and make its fields 64-bit * Add -e option to chronyc to indicate end of response New in version 4.3 ================== Enhancements ------------ * Add local option to refclock directive to stabilise system clock with more stable free-running clock (e.g. TCXO, OCXO) * Add maxdelayquant option to server/pool/peer directive to replace maxdelaydevratio filter with long-term quantile-based filtering * Add selection option to log directive * Allow external PPS in PHC refclock without configurable pin * Don't accept first interleaved response to minimise error in delay * Don't use arc4random on Linux to avoid server performance loss * Improve filter option to better handle missing NTP samples * Improve stability with hardware timestamping and PHC refclock * Update seccomp filter Bug fixes --------- * Fix waitsync command to reconnect when not getting response New in version 4.2 ================== Enhancements ------------ * Add support for NTPv4 extension field improving synchronisation stability and resolution of root delay and dispersion (experimental) * Add support for NTP over PTP (experimental) * Add support for AES-CMAC and hash functions in GnuTLS * Improve server interleaved mode to be more reliable and support multiple clients behind NAT * Update seccomp filter * Add statistics about interleaved mode to serverstats report Bug fixes --------- * Fix RTC support with 64-bit time_t on 32-bit Linux * Fix seccomp filter to work correctly with bind*device directives * Suppress kernel adjustments of system clock (dosynctodr) on illumos Other changes ------------- * Switch Solaris support to illumos New in version 4.1 ================== Enhancements ------------ * Add support for NTS servers specified by IP address (matching Subject Alternative Name in server certificate) * Add source-specific configuration of trusted certificates * Allow multiple files and directories with trusted certificates * Allow multiple pairs of server keys and certificates * Add copy option to server/pool directive * Increase PPS lock limit to 40% of pulse interval * Perform source selection immediately after loading dump files * Reload dump files for addresses negotiated by NTS-KE server * Update seccomp filter and add less restrictive level * Restart ongoing name resolution on online command Bug fixes --------- * Fix responding to IPv4 command requests on FreeBSD * Fix dump files to not include uncorrected offset * Fix initstepslew to accept time from own NTP clients * Reset NTP address and port when no longer negotiated by NTS-KE server New in version 4.0 ================== Enhancements ------------ * Add support for Network Time Security (NTS) authentication * Add support for AES-CMAC keys (AES128, AES256) with Nettle * Add authselectmode directive to control selection of unauthenticated sources * Add binddevice, bindacqdevice, bindcmddevice directives * Add confdir directive to better support fragmented configuration * Add sourcedir directive and "reload sources" command to support dynamic NTP sources specified in files * Add clockprecision directive * Add dscp directive to set Differentiated Services Code Point (DSCP) * Add -L option to limit log messages by severity * Add -p option to print whole configuration with included files * Add -U option to allow start under non-root user * Allow maxsamples to be set to 1 for faster update with -q/-Q option * Avoid replacing NTP sources with sources that have unreachable address * Improve pools to repeat name resolution to get "maxsources" sources * Improve source selection with trusted sources * Improve NTP loop test to prevent synchronisation to itself * Repeat iburst when NTP source is switched from offline state to online * Update clock synchronisation status and leap status more frequently * Update seccomp filter * Add "add pool" command * Add "reset sources" command to drop all measurements * Add authdata command to print details about NTP authentication * Add selectdata command to print details about source selection * Add -N option and sourcename command to print original names of sources * Add -a option to some commands to print also unresolved sources * Add -k, -p, -r options to clients command to select, limit, reset data Bug fixes --------- * Don't set interface for NTP responses to allow asymmetric routing * Handle RTCs that don't support interrupts * Respond to command requests with correct address on multihomed hosts Removed features ---------------- * Drop support for RIPEMD keys (RMD128, RMD160, RMD256, RMD320) * Drop support for long (non-standard) MACs in NTPv4 packets (chrony 2.x clients using non-MD5/SHA1 keys need to use option "version 3") * Drop support for line editing with GNU Readline New in version 3.5.1 ==================== Security fixes -------------- * Create new file when writing pidfile (CVE-2020-14367) New in version 3.5 ================== Enhancements ------------ * Add support for more accurate reading of PHC on Linux 5.0 * Add support for hardware timestamping on interfaces with read-only timestamping configuration * Add support for memory locking and real-time priority on FreeBSD, NetBSD, Solaris * Update seccomp filter to work on more architectures * Validate refclock driver options Bug fixes --------- * Fix bindaddress directive on FreeBSD * Fix transposition of hardware RX timestamp on Linux 4.13 and later * Fix building on non-glibc systems New in version 3.4 ================== Enhancements ------------ * Add filter option to server/pool/peer directive * Add minsamples and maxsamples options to hwtimestamp directive * Add support for faster frequency adjustments in Linux 4.19 * Change default pidfile to /var/run/chrony/chronyd.pid to allow chronyd without root privileges to remove it on exit * Disable sub-second polling intervals for distant NTP sources * Extend range of supported sub-second polling intervals * Get/set IPv4 destination/source address of NTP packets on FreeBSD * Make burst options and command useful with short polling intervals * Modify auto_offline option to activate when sending request failed * Respond from interface that received NTP request if possible * Add onoffline command to switch between online and offline state according to current system network configuration * Improve example NetworkManager dispatcher script Bug fixes --------- * Avoid waiting in Linux getrandom system call * Fix PPS support on FreeBSD and NetBSD New in version 3.3 ================== Enhancements ------------ * Add burst option to server/pool directive * Add stratum and tai options to refclock directive * Add support for Nettle crypto library * Add workaround for missing kernel receive timestamps on Linux * Wait for late hardware transmit timestamps * Improve source selection with unreachable sources * Improve protection against replay attacks on symmetric mode * Allow PHC refclock to use socket in /var/run/chrony * Add shutdown command to stop chronyd * Simplify format of response to manual list command * Improve handling of unknown responses in chronyc Bug fixes --------- * Respond to NTPv1 client requests with zero mode * Fix -x option to not require CAP_SYS_TIME under non-root user * Fix acquisitionport directive to work with privilege separation * Fix handling of socket errors on Linux to avoid high CPU usage * Fix chronyc to not get stuck in infinite loop after clock step New in 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 New in 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 New in 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 New in 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 New in version 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 New in version 2.3 ================== Enhancements ------------ * Add support for NTP and command response rate limiting * Add support for dropping root privileges on Mac OS X, FreeBSD, Solaris * Add require and trust options for source selection * Enable logchange by default (1 second threshold) * Set RTC on Mac OS X with rtcsync directive * Allow binding to NTP port after dropping root privileges on NetBSD * Drop CAP_NET_BIND_SERVICE capability on Linux when NTP port is disabled * Resolve names in separate process when seccomp filter is enabled * Replace old records in client log when memory limit is reached * Don't reveal local time and synchronisation state in client packets * Don't keep client sockets open for longer than necessary * Ignore poll in KoD RATE packets as ntpd doesn't always set it correctly * Warn when using keys shorter than 80 bits * Add keygen command to generate random keys easily * Add serverstats command to report NTP and command packet statistics Bug fixes --------- * Fix clock correction after making step on Mac OS X * Fix building on Solaris New in version 2.2.1 ==================== Security fixes -------------- * Restrict authentication of NTP server/peer to specified key (CVE-2016-1567) New in version 2.2 ================== Enhancements ------------ * Add support for configuration and monitoring over Unix domain socket (accessible by root or chrony user when root privileges are dropped) * Add support for system call filtering with seccomp on Linux (experimental) * Add support for dropping root privileges on NetBSD * Control frequency of system clock on FreeBSD, NetBSD, Solaris * Add system leap second handling mode on FreeBSD, NetBSD, Solaris * Add dynamic drift removal on Mac OS X * Add support for setting real-time priority on Mac OS X * Add maxdistance directive to limit source selection by root distance (3 seconds by default) * Add refresh command to get new addresses of NTP sources * Allow wildcard patterns in include directive * Restore time from driftfile with -s option if later than RTC time * Add configure option to set default hwclockfile * Add -d option to chronyc to enable debug messages * Allow multiple addresses to be specified for chronyc with -h option and reconnect when no valid reply is received * Make check interval in waitsync command configurable Bug fixes --------- * Fix building on NetBSD, Solaris * Restore time from driftfile with -s option if reading RTC failed Removed features ---------------- * Drop support for authentication with command key (run-time configuration is now allowed only for local users that can access the Unix domain socket) New in version 2.1.1 ==================== Bug fixes --------- * Fix clock stepping by integer number of seconds on Linux New in version 2.1 ================== Enhancements ------------ * Add support for Mac OS X * Try to replace unreachable and falseticker servers/peers specified by name like pool sources * Add leaponly option to smoothtime directive to allow synchronised leap smear between multiple servers * Use specific reference ID when smoothing served time * Add smoothing command to report time smoothing status * Add smoothtime command to activate or reset time smoothing Bug fixes --------- * Fix crash in source selection with preferred sources * Fix resetting of time smoothing * Include packet precision in peer dispersion * Fix crash in chronyc on invalid command syntax New in version 2.0 ================== Enhancements ------------ * Update to NTP version 4 (RFC 5905) * Add pool directive to specify pool of NTP servers * Add leapsecmode directive to select how to correct clock for leap second * Add smoothtime directive to smooth served time and enable leap smear * Add minsources directive to set required number of selectable sources * Add minsamples and maxsamples options for all sources * Add tempcomp configuration with list of points * Allow unlimited number of NTP sources, refclocks and keys * Allow unreachable sources to remain selected * Improve source selection * Handle offline sources as unreachable * Open NTP server port only when necessary (client access is allowed by allow directive/command or peer/broadcast is configured) * Change default bindcmdaddress to loopback address * Change default maxdelay to 3 seconds * Change default stratumweight to 0.001 * Update adjtimex synchronisation status * Use system headers for adjtimex * Check for memory allocation errors * Reduce memory usage * Add configure options to compile without NTP, cmdmon, refclock support * Extend makestep command to set automatic clock stepping Bug fixes --------- * Add sanity checks for time and frequency offset * Don't report synchronised status during leap second * Don't combine reference clocks with close NTP sources * Fix accepting requests from configured sources * Fix initial fallback drift setting New in version 1.31.1 ===================== Security fixes -------------- * Protect authenticated symmetric NTP associations against DoS attacks (CVE-2015-1853) * Fix access configuration with subnet size indivisible by 4 (CVE-2015-1821) * Fix initialization of reply slots for authenticated commands (CVE-2015-1822) New in version 1.31 =================== Enhancements ------------ * Support operation in other NTP eras (next era begins in 2036), NTP time is mapped to [-50, +86] years around build date by default * Restore time from driftfile with -s when RTC is missing/unsupported * Close connected client sockets when not waiting for reply * Use one client socket with random port when acquisitionport is 0 * Use NTP packets instead of UDP echo for presend * Don't adjust polling interval when sending fails * Allow binding to addresses that don't exist yet * Ignore measurements around leap second * Improve detection of unexpected time jumps * Include example of logrotate configuration, systemd services and NetworkManager dispatcher script Bug fixes --------- * Reconnect client sockets for each request to follow changes in network configuration automatically * Restart timer when polling interval is changed on reset New in version 1.30 =================== Enhancements ------------ * Add asynchronous name resolving with POSIX threads * Add PTP hardware clock (PHC) refclock driver * Add new generic clock driver to slew by adjusting frequency only (without kernel PLL or adjtime) and use it on Linux * Add rtcautotrim directive to trim RTC automatically * Add hwclockfile directive to share RTC LOCAL/UTC setting with hwclock * Add maxslewrate directive to set maximum allowed slew rate * Add maxdispersion option for refclocks * Add -q/-Q options to set clock/print offset once and exit * Allow directives to be specified on chronyd command line * Replace frequency scaling in Linux driver with retaining of tick * Try to detect unexpected forward time jumps and reset state * Exit with non-zero code when maxchange limit is reached * Improve makestep to not start and stop slew unnecessarily * Change default corrtimeratio to 3.0 to improve frequency accuracy * Announce leap second only on last day of June and December * Use separate connected client sockets for each NTP server * Remove separate NTP implementation used for initstepslew * Limit maximum minpoll set by KoD RATE to default maxpoll * Don't send NTP requests with unknown key * Print warning when source is added with unknown key * Take leap second in PPS refclock from locked source * Make reading of RTC for initial trim more reliable * Don't create cmdmon sockets when cmdport is 0 * Add configure option to set default user to drop root privileges * Add configure option to compile with debug messages * Print debug messages when -d is used more than once * Change format of messages written to terminal with -d * Write fatal messages also to stderr with -n * Use IP_RECVERR socket option in chronyc to not wait unnecessarily * Shorten default chronyc timeout for localhost * Change default hostname in chronyc from localhost to 127.0.0.1 * Print error message on invalid syntax with all chronyc commands * Include simulation test suite using clknetsim Bug fixes --------- * Fix crash when selecting with multiple preferred sources * Fix frequency calculation with large frequency offsets * Fix code writing drift and RTC files to compile correctly * Fix -4/-6 options in chronyc to not reset hostname set by -h * Fix refclock sample validation with sub-second polling interval * Set stratum correctly with non-PPS SOCK refclock and local stratum * Modify dispersion accounting in refclocks to prevent PPS getting stuck with large dispersion and not accepting new samples New in version 1.29.1 ===================== Security fixes -------------- * Modify chronyc protocol to prevent amplification attacks (CVE-2014-0021) (incompatible with previous protocol version, chronyc supports both) New in version 1.29 =================== Security fixes -------------- * Fix crash when processing crafted commands (CVE-2012-4502) (possible with IP addresses allowed by cmdallow and localhost) * Don't send uninitialized data in SUBNETS_ACCESSED and CLIENT_ACCESSES replies (CVE-2012-4503) (not used by chronyc) Other changes ------------- * Drop support for SUBNETS_ACCESSED and CLIENT_ACCESSES commands New in version 1.28 =================== * Combine sources to improve accuracy * Make config and command parser strict * Add -a option to chronyc to authenticate automatically * Add -R option to ignore initstepslew and makestep directives * Add generatecommandkey, minsamples, maxsamples and user directives * Improve compatibility with NTPv1 and NTPv2 clients * Create sockets only in selected family with -4/-6 option * Treat address bind errors as non-fatal * Extend tracking log * Accept float values as initstepslew threshold * Allow hostnames in offline, online and burst commands * Fix and improve peer polling * Fix crash in config parsing with too many servers * Fix crash with duplicated initstepslew address * Fix delta calculation with extreme frequency offsets * Set local stratum correctly * Remove unnecessary adjtimex calls * Set paths in documentation by configure * Update chrony.spec New in version 1.27 =================== * Support for stronger keys via NSS or libtomcrypt library * Support reading leap second data from tz database * Support for precise clock stepping on Linux * Support for nanoseconds in SHM refclock * Make offset corrections smoother on Linux * Make transmit timestamps random below clock precision * Add corrtimeratio and maxchange directives * Extend tracking, sources and activity reports * Wait in foreground process until daemon is fully initialized * Fix crash with slow name resolving * Fix iburst with jittery sources * Fix offset stored in rtc data right after trimrtc * Fix crash and hang with RTC or manual samples * Don't use readonly adjtime on Linux kernels before 2.6.28 * Changed chronyc protocol, incompatible with older versions New in version 1.26 =================== * Add compatibility with Linux 3.0 and later * Use proper source address in NTP replies on multihomed IPv6 hosts * Accept NTP packets with versions 4, 3 and 2 * Cope with unexpected backward time jumps * Don't reset kernel frequency on start without drift file * Retry on permanent DNS error by default * Add waitsync command New in version 1.25 =================== * Improve accuracy with NTP sources * Improve accuracy with reference clocks * Improve polling interval adjustment * Improve stability with temporary asymmetric delays * Improve source selection * Improve initial synchronisation * Add delayed server name resolving * Add temperature compensation * Add nanosecond slewing to Linux driver * Add fallback drifts * Add iburst, minstratum, maxdelaydevratio, polltarget, prefer, noselect options * Add rtcsync directive to enable Linux 11-minute mode * Add reselectdist, stratumweight, logbanner, maxclockerror, include directives * Add -n option to not detach daemon from terminal * Fix pidfile directive * Fix name resolving with disabled IPv6 support * Fix reloading sample histories with reference clocks * Fix crash with auto_offline option * Fix online command on auto_offline sources * Fix file descriptor leaks * Increase burst polling interval and stop on KoD RATE * Set maxupdateskew to 1000 ppm by default * Require password for clients command * Update drift file at most once per hour * Use system headers for Linux RTC support * Reduce default chronyc timeout and make it configurable * Avoid large values in chronyc sources and sourcestats output * Add reselect command to force reselecting best source * Add -m option to allow multiple commands on command line New in version 1.24 =================== Security fixes -------------- * Don't reply to invalid cmdmon packets (CVE-2010-0292) * Limit client log memory size (CVE-2010-0293) * Limit rate of syslog messages (CVE-2010-0294) Bug fixes/Enhancements ---------------------- * Support for reference clocks (SHM, SOCK, PPS drivers) * IPv6 support * Linux capabilities support (to drop root privileges) * Memory locking support on Linux * Real-time scheduler support on Linux * Leap second support on Linux * Support for editline library * Support for new Linux readonly adjtime * NTP client support for KoD RATE * Read kernel timestamps for received NTP packets * Reply to NTP requests with correct address on multihomed hosts * Retry name resolving after temporary failure * Fix makestep command, make it available on all systems * Add makestep directive for automatic clock stepping * Don't require _bigadj kernel symbol on NetBSD * Avoid blocking read in Linux RTC driver * Support for Linux on S/390 and PowerPC * Fix various bugs on 64-bit systems * Fix valgrind errors and compiler warnings * Improve configure to support common options and variables * Improve status checking and printing in chronyc * Return non-zero exit code on errors in chronyc * Reduce request timeout in chronyc * Print estimated offset in sourcestats * Changed chronyc protocol, incompatible with older versions New in version 1.23 =================== * Support for MIPS, x86_64, sparc, alpha, arm, FreeBSD * Fix serious sign-extension error in handling IP addresses * RTC support can be excluded at compile time * Make sources gcc-4 compatible * Fix various compiler warnings * Handle fluctuations in peer distance better. * Fixed handling of stratum zero. * Fix various problems for 64-bit systems * Flush chronyc output streams after each command, to allow it to be driven through pipes * Manpage improvements Version 1.22 ============ This release number was claimed by a release that Mandriva made to patch important bugs in 1.21. The official numbering has jumped to 1.23 as a consequence. New in version 1.21 =================== * Don't include Linux kernel header files any longer : allows chrony to compile on recent distros. * Stop trying to use RTC if continuous streams of error messages would occur (Linux with HPET). New in version 1.20 =================== * Many small tidy-ups and security improvements * Improve documentation (RTC support in post 2.0 kernels) * Remove trailing \n from syslog messages * Syslog messages now include IP and port number when packet cannot be sent. * Added the "acquisitionport" directive. (Kalle Olavi Niemitalo) * Use uname(2) instead of /proc/version to get kernel version. * Merge support for Linux on Alpha * Merge support for 64bit architectures * Don't link -lm if it's not needed * Fix Solaris build (broken by 64bit change) * Add detection of Linux 2.5 * Allow arbitrary value of HZ in Linux kernel * Fix for chrony.spec on SuSE (Paul Elliot) * Fix handling of initstepslew if no servers are listed (John Hasler) * Fix install rule in Makefile if chronyd is in use (Juliusz Chroboczek) * Replace sprintf by snprintf to remove risk of buffer overrun (John Hasler) * Add --help to configure script New in version 1.19 =================== * Auto-detect kernel's timer interrupt rate (so-called 'HZ') when chronyd starts instead of relying on compiled-in value. * Fix 2 bugs in function that creates the directory for the log and dump files. * Amended webpage URL and contact details. * Generate more informative syslog messages before exiting on failed assertions. * Fix bugs in clamping code for the tick value used when slewing a large offset. * Don't chown files to root during install (should be pointless, and makes RPM building awkward as ordinary user.) * Include chrony.spec file for building RPMs New in version 1.18 =================== * Amend homepage and mailing list information to chrony.sunsite.dk * Delete pidfile on exit from chronyd. * Improvements to readline interface to chronyc * Only generate syslog message when synchronisation is initially lost (instead of on every failed synchronisation attempt) * Use double fork approach when initialising daemon. * More things in contrib directory. * New options to help package builders: --infodir/--mandir for configure, and DESTDIR=xxx for make. (See section 2.2 of chrony.txt for details). * Changed the wording of the messages generated by mailonchange and logchange directives. New in version 1.17 =================== * Port to NetBSD * Configuration supports Linux on PPC * Fix compilation warnings * Several documentation improvements * Bundled manpages (taken from the 'missing manpages project') * Cope with lack of bzero function for Solaris 2.3 systems * Store chronyd's pid in a file (default /var/run/chronyd.pid) and check if chronyd may already be running when starting up. New pidfile directive in configuration file. * Any size subnet is now allowed in allow and deny commands. (Example: 6.7.8/20 or 6.7.8.x/20 (any x) mean a 20 bit subnet). * The environment variables CC and CFLAGS passed to configure can now be used to select the compiler and optimisation/debug options to use * Write syslog messages when chronyd loses synchronisation. * Print GPL text when chronyc is run. * Add NTP broadcast server capability (new broadcast directive). * Add 'auto_offline' option to server/peer (conf file) or add server/peer (via chronyc). * Add 'activity' command to chronyc, to report how many servers/peers are currently online/offline. * Fix long-standing bug with how the system time quantum was calculated. * Include support for systems with HZ!=100 (HZ is the timer interrupt frequency). * Include example chrony.conf and chrony.keys files (examples subdirectory). * Include support for readline in chronyc. New in version 1.16.1 ===================== * Fix compilation problem on Linux 2.4.13 (spinlock.h / spinlock_t) New in version 1.16 =================== * More informative captions for 'sources' and 'sourcestats' commands in chronyc (use 'sources -v' and 'sourcestats -v' to get them). * Correct behaviour for Solaris versions>=2.6 (dosynctodr not required on these versions.) * Remove some compiler warnings (Solaris) * If last line of keys file doesn't have end-of-line, don't truncate final character of that key. * Change timestamp format used in logfiles to make it fully numeric (to aid importing data into spreadsheets etc) * Minor documentation updates and improvements. New in version 1.15 =================== * Add contributed change to 'configure' to support Solaris 2.8 on x86 * Workaround for assertion failure that arises if two received packets occur close together. (Still need to find out why this happens at all.) * Hopefully fix problem where fast slewing was incompatible with machines that have a large background drift rate (=> tick value went out of range for adjtimex() on Linux.) * Fix rtc_linux.c compile problems with 2.4.x kernel include files. * Include support for RTC device not being at /dev/rtc (new rtcdevice directive in configuration file). * Include support for restricting network interfaces for commands (new bindcmdaddress directive in configuration file) * Fix potential linking fault in pktlength.c (use of CROAK macro replaced by normal assert). * Add some material on bug reporting + contributing to the chrony.texi file * Made the chrony.texi file "Vim6-friendly" (removed xrefs on @node lines, added folding markers to chapters + sections.) * Switched over to GPL for the licence New in version 1.14 =================== * Fix compilation for certain other Linux distributions (including Mandrake 7.1) New in version 1.13 =================== * Fixed compilation problems on Redhat/SuSE installations with recent 2.2.x kernels. * Minor tidy-ups and documentation enhancements. * Add support for Linux 2.4 kernels New in version 1.12 =================== * Trial fix for long-standing bug in Linux RTC estimator when system time is slewed. * Fix bug in chronyc if -h is specified without a hostname * Fixes to logging various error conditions when operating in daemon mode. * More stuff under contrib/ * Changes to README file (e.g. about the new chrony-users mailing list) New in version 1.11a ==================== * Minor changes to contact details * Minor changes to installation details (chrony subdirectory under doc/) New in version 1.11 =================== * Improve robustness of installation procedure * Tidy up documenation and contact details * Distribute manual as .txt rather than as .ps * Add -n option to chronyc to work with numeric IP addresses rather than names. * Add material in contrib subdirectory * Improve robustness of handling drift file and RTC coefficients file * Improve robustness of regression algorithm New in version 1.1 ================== Bug fixes --------- * Made linear regression more resistant to rounding errors (old one occasionally generated negative variances which made everything go haywire). Trap infinite or 'not-a-number' values being used to alter system clock to increase robustness further. Other changes/Enhancements -------------------------- * Support for Linux 2.1 and 2.2 kernels * New command 'makestep' in chronyc to immediately jump the system time to match the NTP estimated time (Linux only) - a response to systems booting an hour wrong after summertime/wintertime changes, due to RTCs running on local time. Needs extending to Sun driver files too. * New directives 'logchange' and 'mailonchange' to log to syslog or email to a specific address respectively if chronyd detects a clock offset exceeding a defined threshold. * Added capability to log all client/peer NTP accesses and command accesses (can be turned off with conf file directive 'noclientlog'). Added 'clients' command to chronyc to display this data. * Improved manual mode to use robust regression rather than 2 point fit. * Added 'manual list' and 'manual delete' commands to chronyc to allow display of entered timestamps and discretionary deletion of outliers. * If host goes unsynchronised the dummy IP address 0.0.0.0 is detected to avoid attempting a reverse name lookup (to stop dial on demand IP links from being started) * Changed chronyc/chronyd protocol so messages are now all variable length. Saves on network bandwidth particularly for large replies from chronyd to chronyc (to support the clients command). * Added bindaddress directive to configuration file, to give additional control over limiting which hosts can access the local server. * Groundwork done for a port to Windows NT to compile with Cygwin toolkit. chronyc works (to monitor another host). sys_winnt.c needs finishing to use NT clock control API. Program structure needs adapting to use Windows NT service functions, so it can be started at boot time. Hopefully a Windows NT / Cygwin guru with some spare time can take this port over :-) New in version 1.02 =================== Bug fixes --------- * Fix error messages in chronyc if daemon is not reachable. * Fix config file problem for 'allow all' and 'deny all' without a trailing machine address. * Remove fatal failed assertion if command socket cannot be read from in daemon. * Rewrote timezone handling for Linux real time clock, following various reported problems related to daylight saving. Other changes/Enhancements -------------------------- * Configure script recognizes BSD/386 and uses SunOS 4.1 driver for it. * Log files now print date as day-month-year rather than as a day number. Milliseconds removed from timestamps of logged data. Banners included in file to give meanings of columns. * Only do 1 initial step (followed by a trimming slew) when initialising from RTC on Linux (previously did 2 steps). New in version 1.01 =================== Bug fixes --------- * Handle timezone of RTC correctly with respect to daylight saving time * Syntax check the chronyc 'local' command properly * Fixed assertion failed fault in median finder (used by RTC regression fitting) Other changes/Enhancements -------------------------- * Log selection of new NTP reference source to syslog. * Don't zero-pad IP address fields * Add new command to chronyc to allow logfiles to be cycled. * Extend allow/deny directive syntax in configuration file to so directive can apply to all hosts on the Internet. * Tidy up printout of timestamps to make it clear they are in UTC * Make 'configure' check the processor type as well as the operating system. chrony-4.7/README0000644000000000000000000001247215022277513012256 0ustar rootrootThis is the README for chrony. What is chrony? =============== chrony is a versatile implementation of the Network Time Protocol (NTP). It can synchronise the system clock with NTP servers, reference clocks (e.g. 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. It is designed to perform well in a wide range of conditions, including intermittent network connections, heavily congested networks, changing temperatures (ordinary computer clocks are sensitive to temperature), and systems that do not run continuously, or run on a virtual machine. Typical accuracy between two machines synchronised over the Internet is within a few milliseconds; on a LAN, accuracy is typically in tens of microseconds. With hardware timestamping, or a hardware reference clock, sub-microsecond accuracy may be possible. Two programs are included in chrony, chronyd is a daemon that can be started at boot time and chronyc is a command-line interface program which can be used to monitor chronyd's performance and to change various operating parameters whilst it is running. What will chrony run on? ======================== The software is known to work on Linux, FreeBSD, NetBSD, macOS and illumos. Closely related systems may work too. Any other system will likely require a porting exercise. How do I set it up? =================== The file INSTALL gives instructions. On supported systems the compilation process should be automatic. You will need a C compiler, e.g. gcc or clang. What documentation is there? ============================ The distribution includes manual pages and a document containing Frequently Asked Questions (FAQ). The documentation is also available on the chrony web pages, accessible through the URL https://chrony-project.org/ License ======= chrony is distributed under the GNU General Public License version 2. Authors ======= Richard P. Curnow Miroslav Lichvar Acknowledgements ================ In writing the chronyd program, extensive use has been made of the NTPv3 (RFC 1305) and NTPv4 (RFC 5905) specification. The source code of the xntpd/ntpd implementation written by Dennis Fergusson, Lars Mathiesen, David Mills, and others has been used to check the details of the protocol. The following people have provided patches and other major contributions to chrony: Lonnie Abelbeck Benny Lyne Amorsen Andrew Bishop Vincent Blut Luca Boccassi Stephan I. Boettcher David Bohman Goswin Brederlow Leigh Brown Erik Bryer Jonathan Cameron Bryan Christianson Juliusz Chroboczek Paul Donald Dan Drown Kamil Dudka Christian Ehrhardt Paul Elliott Robert Fairley Ahmad Fatoum Andreas Fenkart Stefan R. Filipek Andy Fiddaman Mike Fleetwood Rob Gill Alexander Gretencord Andrew Griffiths Walter Haidinger Juergen Hannken-Illjes John Hasler Tjalling Hattink Liam Hatton Holger Hoffstätte Jachym Holecek Håkan Johansson Jim Knoble Antti Jrvinen Uwe Kleine-König Eric Lammerts Stefan Lucke Victor Lum Kevin Lyda Paul Menzel Vladimir Michl Victor Moroz Kalle Olavi Niemitalo Patrick Oppenlander Frank Otto Denny Page Rupesh Patel Chris Perl Gautier PHILIPPON Andreas Piesk Shachar Raindel Mike Ryan Baruch Siach Josef 'Jeff' Sipek Foster Snowhill Andreas Steinmetz NAKAMURA Takumi Timo Teras Bill Unruh Luke Valenta Stephen Wadeley Bernhard Weiss Wolfgang Weisselberg Bernhard M. Wiedemann Joachim Wiedorn Ralf Wildenhues Ulrich Windl Michael Witten Doug Woodward Thomas Zajic Many other people have contributed bug reports and suggestions. We are sorry we cannot identify all of you individually. chrony-4.7/addressing.h0000644000000000000000000000341315022277513013665 0ustar rootroot/* chronyd/chronyc - Programs for keeping computer clocks accurate. ********************************************************************** * Copyright (C) Richard P. Curnow 1997-2002 * * 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 * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ********************************************************************** ======================================================================= Types used for addressing sources etc */ #ifndef GOT_ADDRESSING_H #define GOT_ADDRESSING_H #include "sysincl.h" /* This type is used to represent an IPv4 address or IPv6 address. Addresses which are not resolved yet can be represented with an ID. All parts are in HOST order, NOT network order. */ #define IPADDR_UNSPEC 0 #define IPADDR_INET4 1 #define IPADDR_INET6 2 #define IPADDR_ID 3 typedef struct { union { uint32_t in4; uint8_t in6[16]; uint32_t id; } addr; uint16_t family; uint16_t _pad; } IPAddr; typedef struct { IPAddr ip_addr; uint16_t port; } IPSockAddr; typedef IPSockAddr NTP_Remote_Address; #define INVALID_IF_INDEX -1 typedef struct { IPAddr ip_addr; int if_index; int sock_fd; } NTP_Local_Address; #endif /* GOT_ADDRESSING_H */ chrony-4.7/addrfilt.c0000644000000000000000000002223415022277513013330 0ustar rootroot/* chronyd/chronyc - Programs for keeping computer clocks accurate. ********************************************************************** * Copyright (C) Richard P. Curnow 1997,1998,1999,2000,2001,2002,2005 * Copyright (C) Miroslav Lichvar 2009, 2015 * * 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 * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ********************************************************************** ======================================================================= This module provides a set of routines for checking IP addresses against a set of rules and deciding whether they are allowed or disallowed. */ #include "config.h" #include "sysincl.h" #include "addrfilt.h" #include "memory.h" /* Define the number of bits which are stripped off per level of indirection in the tables */ #define NBITS 4 /* Define the table size */ #define TABLE_SIZE (1UL<addr.in6[i * 4 + 0] << 24 | ip->addr.in6[i * 4 + 1] << 16 | ip->addr.in6[i * 4 + 2] << 8 | ip->addr.in6[i * 4 + 3]; } /* ================================================== */ inline static uint32_t get_subnet(uint32_t *addr, unsigned int where) { int off; off = where / 32; where %= 32; return (addr[off] >> (32 - NBITS - where)) & ((1UL << NBITS) - 1); } /* ================================================== */ ADF_AuthTable ADF_CreateTable(void) { ADF_AuthTable result; result = MallocNew(struct ADF_AuthTableInst); /* Default is that nothing is allowed */ result->base4.state = DENY; result->base4.extended = NULL; result->base6.state = DENY; result->base6.extended = NULL; return result; } /* ================================================== */ /* This function deletes all definitions of child nodes, in effect pruning a whole subnet definition back to a single parent record. */ static void close_node(TableNode *node) { int i; TableNode *child_node; if (node->extended != NULL) { for (i=0; iextended[i]); close_node(child_node); } Free(node->extended); node->extended = NULL; } } /* ================================================== */ /* Allocate the extension field in a node, and set all the children's states to default to that of the node being extended */ static void open_node(TableNode *node) { int i; TableNode *child_node; if (node->extended == NULL) { node->extended = MallocArray(struct _TableNode, TABLE_SIZE); for (i=0; iextended[i]); child_node->state = AS_PARENT; child_node->extended = NULL; } } } /* ================================================== */ static ADF_Status set_subnet(TableNode *start_node, uint32_t *ip, int ip_len, int subnet_bits, State new_state, int delete_children) { int bits_to_go, bits_consumed; uint32_t subnet; TableNode *node; bits_consumed = 0; bits_to_go = subnet_bits; node = start_node; if ((subnet_bits < 0) || (subnet_bits > 32 * ip_len)) { return ADF_BADSUBNET; } else { if ((bits_to_go & (NBITS-1)) == 0) { while (bits_to_go > 0) { subnet = get_subnet(ip, bits_consumed); if (!(node->extended)) { open_node(node); } node = &(node->extended[subnet]); bits_to_go -= NBITS; bits_consumed += NBITS; } if (delete_children) { close_node(node); } node->state = new_state; } else { /* Have to set multiple entries */ int N, i, j; TableNode *this_node; while (bits_to_go >= NBITS) { subnet = get_subnet(ip, bits_consumed); if (!(node->extended)) { open_node(node); } node = &(node->extended[subnet]); bits_to_go -= NBITS; bits_consumed += NBITS; } /* How many subnet entries to set : 1->8, 2->4, 3->2 */ N = 1 << (NBITS-bits_to_go); subnet = get_subnet(ip, bits_consumed) & ~(N - 1); assert(subnet + N <= TABLE_SIZE); if (!(node->extended)) { open_node(node); } for (i=subnet, j=0; jextended[i]); if (delete_children) { close_node(this_node); } this_node->state = new_state; } } return ADF_SUCCESS; } } /* ================================================== */ static ADF_Status set_subnet_(ADF_AuthTable table, IPAddr *ip_addr, int subnet_bits, State new_state, int delete_children) { uint32_t ip6[4]; switch (ip_addr->family) { case IPADDR_INET4: return set_subnet(&table->base4, &ip_addr->addr.in4, 1, subnet_bits, new_state, delete_children); case IPADDR_INET6: split_ip6(ip_addr, ip6); return set_subnet(&table->base6, ip6, 4, subnet_bits, new_state, delete_children); case IPADDR_UNSPEC: /* Apply to both, subnet_bits has to be 0 */ if (subnet_bits != 0) return ADF_BADSUBNET; memset(ip6, 0, sizeof (ip6)); if (set_subnet(&table->base4, ip6, 1, 0, new_state, delete_children) == ADF_SUCCESS && set_subnet(&table->base6, ip6, 4, 0, new_state, delete_children) == ADF_SUCCESS) return ADF_SUCCESS; break; default: break; } return ADF_BADSUBNET; } ADF_Status ADF_Allow(ADF_AuthTable table, IPAddr *ip, int subnet_bits) { return set_subnet_(table, ip, subnet_bits, ALLOW, 0); } /* ================================================== */ ADF_Status ADF_AllowAll(ADF_AuthTable table, IPAddr *ip, int subnet_bits) { return set_subnet_(table, ip, subnet_bits, ALLOW, 1); } /* ================================================== */ ADF_Status ADF_Deny(ADF_AuthTable table, IPAddr *ip, int subnet_bits) { return set_subnet_(table, ip, subnet_bits, DENY, 0); } /* ================================================== */ ADF_Status ADF_DenyAll(ADF_AuthTable table, IPAddr *ip, int subnet_bits) { return set_subnet_(table, ip, subnet_bits, DENY, 1); } /* ================================================== */ void ADF_DestroyTable(ADF_AuthTable table) { close_node(&table->base4); close_node(&table->base6); Free(table); } /* ================================================== */ static int check_ip_in_node(TableNode *start_node, uint32_t *ip) { uint32_t subnet; int bits_consumed = 0; int result = 0; int finished = 0; TableNode *node; State state=DENY; node = start_node; do { if (node->state != AS_PARENT) { state = node->state; } if (node->extended) { subnet = get_subnet(ip, bits_consumed); node = &(node->extended[subnet]); bits_consumed += NBITS; } else { /* Make decision on this node */ finished = 1; } } while (!finished); switch (state) { case ALLOW: result = 1; break; case DENY: result = 0; break; case AS_PARENT: assert(0); break; } return result; } /* ================================================== */ int ADF_IsAllowed(ADF_AuthTable table, IPAddr *ip_addr) { uint32_t ip6[4]; switch (ip_addr->family) { case IPADDR_INET4: return check_ip_in_node(&table->base4, &ip_addr->addr.in4); case IPADDR_INET6: split_ip6(ip_addr, ip6); return check_ip_in_node(&table->base6, ip6); default: return 0; } } /* ================================================== */ static int is_any_allowed(TableNode *node, State parent) { State state; int i; state = node->state != AS_PARENT ? node->state : parent; assert(state != AS_PARENT); if (node->extended) { for (i = 0; i < TABLE_SIZE; i++) { if (is_any_allowed(&node->extended[i], state)) return 1; } } else if (state == ALLOW) { return 1; } return 0; } /* ================================================== */ int ADF_IsAnyAllowed(ADF_AuthTable table, int family) { switch (family) { case IPADDR_INET4: return is_any_allowed(&table->base4, AS_PARENT); case IPADDR_INET6: return is_any_allowed(&table->base6, AS_PARENT); default: return 0; } } chrony-4.7/addrfilt.h0000644000000000000000000000541015022277513013332 0ustar rootroot/* chronyd/chronyc - Programs for keeping computer clocks accurate. ********************************************************************** * Copyright (C) Richard P. Curnow 1997-2002 * * 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 * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ********************************************************************** ======================================================================= Module for providing an authorisation filter on IP addresses */ #ifndef GOT_ADDRFILT_H #define GOT_ADDRFILT_H #include "addressing.h" typedef struct ADF_AuthTableInst *ADF_AuthTable; typedef enum { ADF_SUCCESS, ADF_BADSUBNET } ADF_Status; /* Create a new table. The default rule is deny for everything */ extern ADF_AuthTable ADF_CreateTable(void); /* Allow anything in the supplied subnet, EXCEPT for any more specific subnets that are already defined */ extern ADF_Status ADF_Allow(ADF_AuthTable table, IPAddr *ip, int subnet_bits); /* Allow anything in the supplied subnet, overwriting existing definitions for any more specific subnets */ extern ADF_Status ADF_AllowAll(ADF_AuthTable table, IPAddr *ip, int subnet_bits); /* Deny anything in the supplied subnet, EXCEPT for any more specific subnets that are already defined */ extern ADF_Status ADF_Deny(ADF_AuthTable table, IPAddr *ip, int subnet_bits); /* Deny anything in the supplied subnet, overwriting existing definitions for any more specific subnets */ extern ADF_Status ADF_DenyAll(ADF_AuthTable table, IPAddr *ip, int subnet_bits); /* Clear up the table */ extern void ADF_DestroyTable(ADF_AuthTable table); /* Check whether a given IP address is allowed by the rules in the table */ extern int ADF_IsAllowed(ADF_AuthTable table, IPAddr *ip); /* Check if at least one address from a given family is allowed by the rules in the table */ extern int ADF_IsAnyAllowed(ADF_AuthTable table, int family); #endif /* GOT_ADDRFILT_H */ chrony-4.7/array.c0000644000000000000000000000630315022277513012654 0ustar rootroot/* chronyd/chronyc - Programs for keeping computer clocks accurate. ********************************************************************** * Copyright (C) Miroslav Lichvar 2014 * * 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 * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ********************************************************************** ======================================================================= Functions implementing an array with automatic memory allocation. */ #include "config.h" #include "sysincl.h" #include "array.h" #include "memory.h" struct ARR_Instance_Record { void *data; unsigned int elem_size; unsigned int used; unsigned int allocated; }; ARR_Instance ARR_CreateInstance(unsigned int elem_size) { ARR_Instance array; assert(elem_size > 0); array = MallocNew(struct ARR_Instance_Record); array->data = NULL; array->elem_size = elem_size; array->used = 0; array->allocated = 0; return array; } void ARR_DestroyInstance(ARR_Instance array) { Free(array->data); Free(array); } static void realloc_array(ARR_Instance array, unsigned int min_size) { assert(min_size <= 2 * min_size); if (array->allocated >= min_size && array->allocated <= 2 * min_size) return; if (array->allocated < min_size) { while (array->allocated < min_size) array->allocated = array->allocated ? 2 * array->allocated : 1; } else { array->allocated = min_size; } array->data = Realloc2(array->data, array->allocated, array->elem_size); } void * ARR_GetNewElement(ARR_Instance array) { array->used++; realloc_array(array, array->used); return ARR_GetElement(array, array->used - 1); } void * ARR_GetElement(ARR_Instance array, unsigned int index) { assert(index < array->used); return (void *)((char *)array->data + (size_t)index * array->elem_size); } void * ARR_GetElements(ARR_Instance array) { /* Return a non-NULL pointer when the array has zero size */ if (!array->data) { assert(!array->used); return array; } return array->data; } void ARR_AppendElement(ARR_Instance array, void *element) { void *e; e = ARR_GetNewElement(array); memcpy(e, element, array->elem_size); } void ARR_RemoveElement(ARR_Instance array, unsigned int index) { void *e, *l; e = ARR_GetElement(array, index); l = ARR_GetElement(array, array->used - 1); if (e < l) memmove(e, (char *)e + array->elem_size, (char *)l - (char *)e); array->used--; realloc_array(array, array->used); } void ARR_SetSize(ARR_Instance array, unsigned int size) { realloc_array(array, size); array->used = size; } unsigned int ARR_GetSize(ARR_Instance array) { return array->used; } chrony-4.7/array.h0000644000000000000000000000404015022277513012655 0ustar rootroot/* chronyd/chronyc - Programs for keeping computer clocks accurate. ********************************************************************** * Copyright (C) Miroslav Lichvar 2014 * * 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 * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ********************************************************************** ======================================================================= Header file for array functions. */ #ifndef GOT_ARRAY_H #define GOT_ARRAY_H typedef struct ARR_Instance_Record *ARR_Instance; /* Create a new array with given element size */ extern ARR_Instance ARR_CreateInstance(unsigned int elem_size); /* Destroy the array */ extern void ARR_DestroyInstance(ARR_Instance array); /* Return pointer to a new element added to the end of the array */ extern void *ARR_GetNewElement(ARR_Instance array); /* Return element with given index */ extern void *ARR_GetElement(ARR_Instance array, unsigned int index); /* Return pointer to the internal array of elements */ extern void *ARR_GetElements(ARR_Instance array); /* Add a new element to the end of the array */ extern void ARR_AppendElement(ARR_Instance array, void *element); /* Remove element with given index */ extern void ARR_RemoveElement(ARR_Instance array, unsigned int index); /* Set the size of the array */ extern void ARR_SetSize(ARR_Instance array, unsigned int size); /* Return current size of the array */ extern unsigned int ARR_GetSize(ARR_Instance array); #endif chrony-4.7/candm.h0000644000000000000000000005030215022277513012623 0ustar rootroot/* chronyd/chronyc - Programs for keeping computer clocks accurate. ********************************************************************** * Copyright (C) Richard P. Curnow 1997-2003 * * 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 * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ********************************************************************** ======================================================================= Definitions for the network protocol used for command and monitoring of the timeserver. */ #ifndef GOT_CANDM_H #define GOT_CANDM_H #include "sysincl.h" #include "addressing.h" /* This is the default port to use for CANDM, if no alternative is defined */ #define DEFAULT_CANDM_PORT 323 /* Request codes */ #define REQ_ONLINE 1 #define REQ_OFFLINE 2 #define REQ_BURST 3 #define REQ_MODIFY_MINPOLL 4 #define REQ_MODIFY_MAXPOLL 5 #define REQ_DUMP 6 #define REQ_MODIFY_MAXDELAY 7 #define REQ_MODIFY_MAXDELAYRATIO 8 #define REQ_MODIFY_MAXUPDATESKEW 9 #define REQ_LOGON 10 #define REQ_SETTIME 11 #define REQ_LOCAL 12 #define REQ_MANUAL 13 #define REQ_N_SOURCES 14 #define REQ_SOURCE_DATA 15 #define REQ_REKEY 16 #define REQ_ALLOW 17 #define REQ_ALLOWALL 18 #define REQ_DENY 19 #define REQ_DENYALL 20 #define REQ_CMDALLOW 21 #define REQ_CMDALLOWALL 22 #define REQ_CMDDENY 23 #define REQ_CMDDENYALL 24 #define REQ_ACCHECK 25 #define REQ_CMDACCHECK 26 #define REQ_ADD_SERVER 27 #define REQ_ADD_PEER 28 #define REQ_DEL_SOURCE 29 #define REQ_WRITERTC 30 #define REQ_DFREQ 31 #define REQ_DOFFSET 32 #define REQ_TRACKING 33 #define REQ_SOURCESTATS 34 #define REQ_RTCREPORT 35 #define REQ_TRIMRTC 36 #define REQ_CYCLELOGS 37 #define REQ_SUBNETS_ACCESSED 38 #define REQ_CLIENT_ACCESSES 39 #define REQ_CLIENT_ACCESSES_BY_INDEX 40 #define REQ_MANUAL_LIST 41 #define REQ_MANUAL_DELETE 42 #define REQ_MAKESTEP 43 #define REQ_ACTIVITY 44 #define REQ_MODIFY_MINSTRATUM 45 #define REQ_MODIFY_POLLTARGET 46 #define REQ_MODIFY_MAXDELAYDEVRATIO 47 #define REQ_RESELECT 48 #define REQ_RESELECTDISTANCE 49 #define REQ_MODIFY_MAKESTEP 50 #define REQ_SMOOTHING 51 #define REQ_SMOOTHTIME 52 #define REQ_REFRESH 53 #define REQ_SERVER_STATS 54 #define REQ_CLIENT_ACCESSES_BY_INDEX2 55 #define REQ_LOCAL2 56 #define REQ_NTP_DATA 57 #define REQ_ADD_SERVER2 58 #define REQ_ADD_PEER2 59 #define REQ_ADD_SERVER3 60 #define REQ_ADD_PEER3 61 #define REQ_SHUTDOWN 62 #define REQ_ONOFFLINE 63 #define REQ_ADD_SOURCE 64 #define REQ_NTP_SOURCE_NAME 65 #define REQ_RESET_SOURCES 66 #define REQ_AUTH_DATA 67 #define REQ_CLIENT_ACCESSES_BY_INDEX3 68 #define REQ_SELECT_DATA 69 #define REQ_RELOAD_SOURCES 70 #define REQ_DOFFSET2 71 #define REQ_MODIFY_SELECTOPTS 72 #define REQ_MODIFY_OFFSET 73 #define REQ_LOCAL3 74 #define N_REQUEST_TYPES 75 /* Structure used to exchange timespecs independent of time_t size */ typedef struct { uint32_t tv_sec_high; uint32_t tv_sec_low; uint32_t tv_nsec; } Timespec; /* This is used in tv_sec_high for 32-bit timestamps */ #define TV_NOHIGHSEC 0x7fffffff /* Structure for 64-bit integers (not requiring 64-bit alignment) */ typedef struct { uint32_t high; uint32_t low; } Integer64; /* 32-bit floating-point format consisting of 7-bit signed exponent and 25-bit signed coefficient without hidden bit. The result is calculated as: 2^(exp - 25) * coef */ typedef struct { int32_t f; } Float; /* The EOR (end of record) fields are used by the offsetof operator in pktlength.c, to get the number of bytes that ought to be transmitted for each packet type. */ typedef struct { int32_t EOR; } REQ_Null; typedef struct { IPAddr mask; IPAddr address; int32_t EOR; } REQ_Online; typedef struct { IPAddr mask; IPAddr address; int32_t EOR; } REQ_Offline; typedef struct { IPAddr mask; IPAddr address; int32_t n_good_samples; int32_t n_total_samples; int32_t EOR; } REQ_Burst; typedef struct { IPAddr address; int32_t new_minpoll; int32_t EOR; } REQ_Modify_Minpoll; typedef struct { IPAddr address; int32_t new_maxpoll; int32_t EOR; } REQ_Modify_Maxpoll; typedef struct { int32_t pad; int32_t EOR; } REQ_Dump; typedef struct { IPAddr address; Float new_max_delay; int32_t EOR; } REQ_Modify_Maxdelay; typedef struct { IPAddr address; Float new_max_delay_ratio; int32_t EOR; } REQ_Modify_Maxdelayratio; typedef struct { IPAddr address; Float new_max_delay_dev_ratio; int32_t EOR; } REQ_Modify_Maxdelaydevratio; typedef struct { IPAddr address; int32_t new_min_stratum; int32_t EOR; } REQ_Modify_Minstratum; typedef struct { IPAddr address; int32_t new_poll_target; int32_t EOR; } REQ_Modify_Polltarget; typedef struct { Float new_max_update_skew; int32_t EOR; } REQ_Modify_Maxupdateskew; typedef struct { int32_t limit; Float threshold; int32_t EOR; } REQ_Modify_Makestep; typedef struct { Timespec ts; int32_t EOR; } REQ_Settime; typedef struct { int32_t on_off; int32_t stratum; Float distance; int32_t orphan; Float activate; Float wait_synced; Float wait_unsynced; int32_t EOR; } REQ_Local; typedef struct { int32_t option; int32_t EOR; } REQ_Manual; typedef struct { int32_t index; int32_t EOR; } REQ_Source_Data; typedef struct { IPAddr ip; int32_t subnet_bits; int32_t EOR; } REQ_Allow_Deny; typedef struct { IPAddr ip; int32_t EOR; } REQ_Ac_Check; /* Source types in NTP source requests */ #define REQ_ADDSRC_SERVER 1 #define REQ_ADDSRC_PEER 2 #define REQ_ADDSRC_POOL 3 /* Flags used in NTP source requests */ #define REQ_ADDSRC_ONLINE 0x1 #define REQ_ADDSRC_AUTOOFFLINE 0x2 #define REQ_ADDSRC_IBURST 0x4 #define REQ_ADDSRC_PREFER 0x8 #define REQ_ADDSRC_NOSELECT 0x10 #define REQ_ADDSRC_TRUST 0x20 #define REQ_ADDSRC_REQUIRE 0x40 #define REQ_ADDSRC_INTERLEAVED 0x80 #define REQ_ADDSRC_BURST 0x100 #define REQ_ADDSRC_NTS 0x200 #define REQ_ADDSRC_COPY 0x400 #define REQ_ADDSRC_EF_EXP_MONO_ROOT 0x800 #define REQ_ADDSRC_EF_EXP_NET_CORRECTION 0x1000 #define REQ_ADDSRC_IPV4 0x2000 #define REQ_ADDSRC_IPV6 0x4000 typedef struct { uint32_t type; uint8_t name[256]; uint32_t port; int32_t minpoll; int32_t maxpoll; int32_t presend_minpoll; uint32_t min_stratum; uint32_t poll_target; uint32_t version; uint32_t max_sources; int32_t min_samples; int32_t max_samples; uint32_t authkey; uint32_t nts_port; Float max_delay; Float max_delay_ratio; Float max_delay_dev_ratio; Float min_delay; Float asymmetry; Float offset; uint32_t flags; int32_t filter_length; uint32_t cert_set; Float max_delay_quant; uint32_t reserved[1]; int32_t EOR; } REQ_NTP_Source; typedef struct { IPAddr ip_addr; int32_t EOR; } REQ_Del_Source; typedef struct { Float dfreq; int32_t EOR; } REQ_Dfreq; typedef struct { Float doffset; int32_t EOR; } REQ_Doffset; typedef struct { uint32_t index; int32_t EOR; } REQ_Sourcestats; /* This is based on the response size rather than the request size */ #define MAX_CLIENT_ACCESSES 8 typedef struct { uint32_t first_index; uint32_t n_clients; uint32_t min_hits; uint32_t reset; int32_t EOR; } REQ_ClientAccessesByIndex; typedef struct { int32_t index; int32_t EOR; } REQ_ManualDelete; typedef struct { Float distance; int32_t EOR; } REQ_ReselectDistance; #define REQ_SMOOTHTIME_RESET 0 #define REQ_SMOOTHTIME_ACTIVATE 1 typedef struct { int32_t option; int32_t EOR; } REQ_SmoothTime; typedef struct { IPAddr ip_addr; int32_t EOR; } REQ_NTPData; typedef struct { IPAddr ip_addr; int32_t EOR; } REQ_NTPSourceName; typedef struct { IPAddr ip_addr; int32_t EOR; } REQ_AuthData; typedef struct { uint32_t index; int32_t EOR; } REQ_SelectData; /* Mask and options reuse the REQ_ADDSRC flags */ typedef struct { IPAddr address; uint32_t ref_id; uint32_t mask; uint32_t options; int32_t EOR; } REQ_Modify_SelectOpts; typedef struct { IPAddr address; uint32_t ref_id; Float new_offset; int32_t EOR; } REQ_Modify_Offset; /* ================================================== */ #define PKT_TYPE_CMD_REQUEST 1 #define PKT_TYPE_CMD_REPLY 2 /* This version number needs to be incremented whenever the packet size and/or the format of any of the existing messages is changed. Other changes, e.g. new command types, should be handled cleanly by client.c and cmdmon.c anyway, so the version can stay the same. Version 1 : original version with fixed size packets Version 2 : both command and reply packet sizes made capable of being variable length. Version 3 : NTP_Source message lengthened (auto_offline) Version 4 : IPv6 addressing added, 64-bit time values, sourcestats and tracking reports extended, added flags to NTP source request, trimmed source report, replaced fixed-point format with floating-point and used also instead of integer microseconds, new commands: modify stratum, modify polltarget, modify maxdelaydevratio, reselect, reselectdistance Version 5 : auth data moved to the end of the packet to allow hashes with different sizes, extended sources, tracking and activity reports, dropped subnets accessed and client accesses Version 6 : added padding to requests to prevent amplification attack, changed maximum number of samples in manual list to 16, new commands: modify makestep, smoothing, smoothtime Support for authentication was removed later in version 6 of the protocol and commands that required authentication are allowed only locally over Unix domain socket. Version 6 (no authentication) : changed format of client accesses by index (two times), delta offset, and manual timestamp, added new fields and flags to NTP source request and report, made length of manual list constant, added new commands: authdata, ntpdata, onoffline, refresh, reset, selectdata, serverstats, shutdown, sourcename */ #define PROTO_VERSION_NUMBER 6 /* The oldest protocol versions that are compatible enough with the current version to report a version mismatch for the server and the client */ #define PROTO_VERSION_MISMATCH_COMPAT_SERVER 5 #define PROTO_VERSION_MISMATCH_COMPAT_CLIENT 4 /* The first protocol version using padding in requests */ #define PROTO_VERSION_PADDING 6 /* The maximum length of padding in request packet, currently defined by CLIENT_ACCESSES_BY_INDEX3 */ #define MAX_PADDING_LENGTH 484 /* ================================================== */ typedef struct { uint8_t version; /* Protocol version */ uint8_t pkt_type; /* What sort of packet this is */ uint8_t res1; uint8_t res2; uint16_t command; /* Which command is being issued */ uint16_t attempt; /* How many resends the client has done (count up from zero for same sequence number) */ uint32_t sequence; /* Client's sequence number */ uint32_t pad1; uint32_t pad2; union { REQ_Null null; REQ_Online online; REQ_Offline offline; REQ_Burst burst; REQ_Modify_Minpoll modify_minpoll; REQ_Modify_Maxpoll modify_maxpoll; REQ_Dump dump; REQ_Modify_Maxdelay modify_maxdelay; REQ_Modify_Maxdelayratio modify_maxdelayratio; REQ_Modify_Maxdelaydevratio modify_maxdelaydevratio; REQ_Modify_Minstratum modify_minstratum; REQ_Modify_Polltarget modify_polltarget; REQ_Modify_Maxupdateskew modify_maxupdateskew; REQ_Modify_Makestep modify_makestep; REQ_Settime settime; REQ_Local local; REQ_Manual manual; REQ_Source_Data source_data; REQ_Allow_Deny allow_deny; REQ_Ac_Check ac_check; REQ_NTP_Source ntp_source; REQ_Del_Source del_source; REQ_Dfreq dfreq; REQ_Doffset doffset; REQ_Sourcestats sourcestats; REQ_ClientAccessesByIndex client_accesses_by_index; REQ_ManualDelete manual_delete; REQ_ReselectDistance reselect_distance; REQ_SmoothTime smoothtime; REQ_NTPData ntp_data; REQ_NTPSourceName ntp_source_name; REQ_AuthData auth_data; REQ_SelectData select_data; REQ_Modify_SelectOpts modify_select_opts; REQ_Modify_Offset modify_offset; } data; /* Command specific parameters */ /* Padding used to prevent traffic amplification. It only defines the maximum size of the packet, there is no hole after the data field. */ uint8_t padding[MAX_PADDING_LENGTH]; } CMD_Request; /* ================================================== */ /* Reply codes */ #define RPY_NULL 1 #define RPY_N_SOURCES 2 #define RPY_SOURCE_DATA 3 #define RPY_MANUAL_TIMESTAMP 4 #define RPY_TRACKING 5 #define RPY_SOURCESTATS 6 #define RPY_RTC 7 #define RPY_SUBNETS_ACCESSED 8 #define RPY_CLIENT_ACCESSES 9 #define RPY_CLIENT_ACCESSES_BY_INDEX 10 #define RPY_MANUAL_LIST 11 #define RPY_ACTIVITY 12 #define RPY_SMOOTHING 13 #define RPY_SERVER_STATS 14 #define RPY_CLIENT_ACCESSES_BY_INDEX2 15 #define RPY_NTP_DATA 16 #define RPY_MANUAL_TIMESTAMP2 17 #define RPY_MANUAL_LIST2 18 #define RPY_NTP_SOURCE_NAME 19 #define RPY_AUTH_DATA 20 #define RPY_CLIENT_ACCESSES_BY_INDEX3 21 #define RPY_SERVER_STATS2 22 #define RPY_SELECT_DATA 23 #define RPY_SERVER_STATS3 24 #define RPY_SERVER_STATS4 25 #define RPY_NTP_DATA2 26 #define N_REPLY_TYPES 27 /* Status codes */ #define STT_SUCCESS 0 #define STT_FAILED 1 #define STT_UNAUTH 2 #define STT_INVALID 3 #define STT_NOSUCHSOURCE 4 #define STT_INVALIDTS 5 #define STT_NOTENABLED 6 #define STT_BADSUBNET 7 #define STT_ACCESSALLOWED 8 #define STT_ACCESSDENIED 9 #define STT_NOHOSTACCESS 10 /* Deprecated */ #define STT_SOURCEALREADYKNOWN 11 #define STT_TOOMANYSOURCES 12 #define STT_NORTC 13 #define STT_BADRTCFILE 14 #define STT_INACTIVE 15 #define STT_BADSAMPLE 16 #define STT_INVALIDAF 17 #define STT_BADPKTVERSION 18 #define STT_BADPKTLENGTH 19 #define STT_INVALIDNAME 21 typedef struct { int32_t EOR; } RPY_Null; typedef struct { uint32_t n_sources; int32_t EOR; } RPY_N_Sources; #define RPY_SD_MD_CLIENT 0 #define RPY_SD_MD_PEER 1 #define RPY_SD_MD_REF 2 #define RPY_SD_ST_SELECTED 0 #define RPY_SD_ST_NONSELECTABLE 1 #define RPY_SD_ST_FALSETICKER 2 #define RPY_SD_ST_JITTERY 3 #define RPY_SD_ST_UNSELECTED 4 #define RPY_SD_ST_SELECTABLE 5 typedef struct { IPAddr ip_addr; int16_t poll; uint16_t stratum; uint16_t state; uint16_t mode; uint16_t flags; uint16_t reachability; uint32_t since_sample; Float orig_latest_meas; Float latest_meas; Float latest_meas_err; int32_t EOR; } RPY_Source_Data; typedef struct { uint32_t ref_id; IPAddr ip_addr; uint16_t stratum; uint16_t leap_status; Timespec ref_time; Float current_correction; Float last_offset; Float rms_offset; Float freq_ppm; Float resid_freq_ppm; Float skew_ppm; Float root_delay; Float root_dispersion; Float last_update_interval; int32_t EOR; } RPY_Tracking; typedef struct { uint32_t ref_id; IPAddr ip_addr; uint32_t n_samples; uint32_t n_runs; uint32_t span_seconds; Float sd; Float resid_freq_ppm; Float skew_ppm; Float est_offset; Float est_offset_err; int32_t EOR; } RPY_Sourcestats; typedef struct { Timespec ref_time; uint16_t n_samples; uint16_t n_runs; uint32_t span_seconds; Float rtc_seconds_fast; Float rtc_gain_rate_ppm; int32_t EOR; } RPY_Rtc; typedef struct { Float offset; Float dfreq_ppm; Float new_afreq_ppm; int32_t EOR; } RPY_ManualTimestamp; typedef struct { IPAddr ip; uint32_t ntp_hits; uint32_t nke_hits; uint32_t cmd_hits; uint32_t ntp_drops; uint32_t nke_drops; uint32_t cmd_drops; int8_t ntp_interval; int8_t nke_interval; int8_t cmd_interval; int8_t ntp_timeout_interval; uint32_t last_ntp_hit_ago; uint32_t last_nke_hit_ago; uint32_t last_cmd_hit_ago; } RPY_ClientAccesses_Client; typedef struct { uint32_t n_indices; /* how many indices there are in the server's table */ uint32_t next_index; /* the index 1 beyond those processed on this call */ uint32_t n_clients; /* the number of valid entries in the following array */ RPY_ClientAccesses_Client clients[MAX_CLIENT_ACCESSES]; int32_t EOR; } RPY_ClientAccessesByIndex; typedef struct { Integer64 ntp_hits; Integer64 nke_hits; Integer64 cmd_hits; Integer64 ntp_drops; Integer64 nke_drops; Integer64 cmd_drops; Integer64 log_drops; Integer64 ntp_auth_hits; Integer64 ntp_interleaved_hits; Integer64 ntp_timestamps; Integer64 ntp_span_seconds; Integer64 ntp_daemon_rx_timestamps; Integer64 ntp_daemon_tx_timestamps; Integer64 ntp_kernel_rx_timestamps; Integer64 ntp_kernel_tx_timestamps; Integer64 ntp_hw_rx_timestamps; Integer64 ntp_hw_tx_timestamps; Integer64 reserved[4]; int32_t EOR; } RPY_ServerStats; #define MAX_MANUAL_LIST_SAMPLES 16 typedef struct { Timespec when; Float slewed_offset; Float orig_offset; Float residual; } RPY_ManualListSample; typedef struct { uint32_t n_samples; RPY_ManualListSample samples[MAX_MANUAL_LIST_SAMPLES]; int32_t EOR; } RPY_ManualList; typedef struct { int32_t online; int32_t offline; int32_t burst_online; int32_t burst_offline; int32_t unresolved; int32_t EOR; } RPY_Activity; #define RPY_SMT_FLAG_ACTIVE 0x1 #define RPY_SMT_FLAG_LEAPONLY 0x2 typedef struct { uint32_t flags; Float offset; Float freq_ppm; Float wander_ppm; Float last_update_ago; Float remaining_time; int32_t EOR; } RPY_Smoothing; #define RPY_NTP_FLAGS_TESTS 0x3ff #define RPY_NTP_FLAG_INTERLEAVED 0x4000 #define RPY_NTP_FLAG_AUTHENTICATED 0x8000 typedef struct { IPAddr remote_addr; IPAddr local_addr; uint16_t remote_port; uint8_t leap; uint8_t version; uint8_t mode; uint8_t stratum; int8_t poll; int8_t precision; Float root_delay; Float root_dispersion; uint32_t ref_id; Timespec ref_time; Float offset; Float peer_delay; Float peer_dispersion; Float response_time; Float jitter_asymmetry; uint16_t flags; uint8_t tx_tss_char; uint8_t rx_tss_char; uint32_t total_tx_count; uint32_t total_rx_count; uint32_t total_valid_count; uint32_t total_good_count; uint32_t total_kernel_tx_ts; uint32_t total_kernel_rx_ts; uint32_t total_hw_tx_ts; uint32_t total_hw_rx_ts; uint32_t reserved[4]; int32_t EOR; } RPY_NTPData; typedef struct { uint8_t name[256]; int32_t EOR; } RPY_NTPSourceName; #define RPY_AD_MD_NONE 0 #define RPY_AD_MD_SYMMETRIC 1 #define RPY_AD_MD_NTS 2 typedef struct { uint16_t mode; uint16_t key_type; uint32_t key_id; uint16_t key_length; uint16_t ke_attempts; uint32_t last_ke_ago; uint16_t cookies; uint16_t cookie_length; uint16_t nak; uint16_t pad; int32_t EOR; } RPY_AuthData; #define RPY_SD_OPTION_NOSELECT 0x1 #define RPY_SD_OPTION_PREFER 0x2 #define RPY_SD_OPTION_TRUST 0x4 #define RPY_SD_OPTION_REQUIRE 0x8 typedef struct { uint32_t ref_id; IPAddr ip_addr; uint8_t state_char; uint8_t authentication; uint8_t leap; uint8_t pad; uint16_t conf_options; uint16_t eff_options; uint32_t last_sample_ago; Float score; Float lo_limit; Float hi_limit; int32_t EOR; } RPY_SelectData; typedef struct { uint8_t version; uint8_t pkt_type; uint8_t res1; uint8_t res2; uint16_t command; /* Which command is being replied to */ uint16_t reply; /* Which format of reply this is */ uint16_t status; /* Status of command processing */ uint16_t pad1; /* Padding for compatibility and 4 byte alignment */ uint16_t pad2; uint16_t pad3; uint32_t sequence; /* Echo of client's sequence number */ uint32_t pad4; uint32_t pad5; union { RPY_Null null; RPY_N_Sources n_sources; RPY_Source_Data source_data; RPY_ManualTimestamp manual_timestamp; RPY_Tracking tracking; RPY_Sourcestats sourcestats; RPY_Rtc rtc; RPY_ClientAccessesByIndex client_accesses_by_index; RPY_ServerStats server_stats; RPY_ManualList manual_list; RPY_Activity activity; RPY_Smoothing smoothing; RPY_NTPData ntp_data; RPY_NTPSourceName ntp_source_name; RPY_AuthData auth_data; RPY_SelectData select_data; } data; /* Reply specific parameters */ } CMD_Reply; /* ================================================== */ #endif /* GOT_CANDM_H */ chrony-4.7/client.c0000644000000000000000000031445215022277513013023 0ustar rootroot/* chronyd/chronyc - Programs for keeping computer clocks accurate. ********************************************************************** * Copyright (C) Richard P. Curnow 1997-2003 * Copyright (C) Lonnie Abelbeck 2016, 2018 * Copyright (C) Miroslav Lichvar 2009-2024 * * 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 * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ********************************************************************** ======================================================================= Command line client for configuring the daemon and obtaining status from it whilst running. */ #include "config.h" #include "sysincl.h" #include "array.h" #include "candm.h" #include "cmac.h" #include "logging.h" #include "memory.h" #include "nameserv.h" #include "getdate.h" #include "cmdparse.h" #include "pktlength.h" #include "socket.h" #include "util.h" #ifdef FEAT_READLINE #include #endif /* ================================================== */ struct Address { SCK_AddressType type; union { IPSockAddr ip; char *path; } addr; }; static ARR_Instance server_addresses; static int sock_fd = -1; static volatile int quit = 0; static int on_terminal = 0; static int no_dns = 0; static int source_names = 0; static int csv_mode = 0; static int end_dot = 0; /* ================================================== */ /* Log a message. This is a minimalistic replacement of the logging.c implementation to avoid linking with it and other modules. */ LOG_Severity log_min_severity = LOGS_INFO; void LOG_Message(LOG_Severity severity, #if DEBUG > 0 int line_number, const char *filename, const char *function_name, #endif const char *format, ...) { va_list ap; if (severity < log_min_severity) return; va_start(ap, format); vfprintf(stderr, format, ap); putc('\n', stderr); va_end(ap); } /* ================================================== */ /* Read a single line of commands from standard input */ #ifdef FEAT_READLINE static char **command_name_completion(const char *text, int start, int end); #endif static char * read_line(void) { static char line[2048]; static const char *prompt = "chronyc> "; if (on_terminal) { #ifdef FEAT_READLINE char *cmd; rl_attempted_completion_function = command_name_completion; rl_basic_word_break_characters = " \t\n\r"; /* save line only if not empty */ cmd = readline(prompt); if( cmd == NULL ) return( NULL ); /* user pressed return */ if( *cmd != '\0' ) { strncpy(line, cmd, sizeof(line) - 1); line[sizeof(line) - 1] = '\0'; add_history(cmd); } else { /* simulate the user has entered an empty line */ *line = '\0'; } Free(cmd); return( line ); #else printf("%s", prompt); fflush(stdout); #endif } if (fgets(line, sizeof(line), stdin)) { return line; } else { return NULL; } } /* ================================================== */ static ARR_Instance get_addresses(const char *hostnames, int port) { struct Address *addr; ARR_Instance addrs; char *hostname, *s1, *s2; IPAddr ip_addrs[DNS_MAX_ADDRESSES]; int i; addrs = ARR_CreateInstance(sizeof (*addr)); s1 = Strdup(hostnames); /* Parse the comma-separated list of hostnames */ for (hostname = s1; hostname && *hostname; hostname = s2) { s2 = strchr(hostname, ','); if (s2) *s2++ = '\0'; /* hostname starting with / is considered a path of Unix domain socket */ if (hostname[0] == '/') { addr = ARR_GetNewElement(addrs); addr->type = SCK_ADDR_UNIX; addr->addr.path = Strdup(hostname); } else { if (DNS_Name2IPAddress(hostname, ip_addrs, DNS_MAX_ADDRESSES) != DNS_Success) { DEBUG_LOG("Could not get IP address for %s", hostname); continue; } for (i = 0; i < DNS_MAX_ADDRESSES && ip_addrs[i].family != IPADDR_UNSPEC; i++) { addr = ARR_GetNewElement(addrs); addr->type = SCK_ADDR_IP; addr->addr.ip.ip_addr = ip_addrs[i]; addr->addr.ip.port = port; DEBUG_LOG("Resolved %s to %s", hostname, UTI_IPToString(&ip_addrs[i])); } } } Free(s1); return addrs; } /* ================================================== */ static void free_addresses(ARR_Instance addresses) { struct Address *addr; unsigned int i; for (i = 0; i < ARR_GetSize(addresses); i++) { addr = ARR_GetElement(addresses, i); if (addr->type == SCK_ADDR_UNIX) Free(addr->addr.path); } ARR_DestroyInstance(addresses); } /* ================================================== */ /* Initialise the socket used to talk to the daemon */ static int open_socket(struct Address *addr) { char *dir, *local_addr; size_t local_addr_len; switch (addr->type) { case SCK_ADDR_IP: sock_fd = SCK_OpenUdpSocket(&addr->addr.ip, NULL, NULL, 0); break; case SCK_ADDR_UNIX: /* Construct path of our socket. Use the same directory as the server socket and include our process ID to allow multiple chronyc instances running at the same time. */ dir = UTI_PathToDir(addr->addr.path); local_addr_len = strlen(dir) + 50; local_addr = Malloc(local_addr_len); snprintf(local_addr, local_addr_len, "%s/chronyc.%d.sock", dir, (int)getpid()); sock_fd = SCK_OpenUnixDatagramSocket(addr->addr.path, local_addr, SCK_FLAG_ALL_PERMISSIONS); Free(dir); Free(local_addr); break; default: assert(0); } if (sock_fd < 0) return 0; return 1; } /* ================================================== */ static void close_io(void) { if (sock_fd < 0) return; SCK_RemoveSocket(sock_fd); SCK_CloseSocket(sock_fd); sock_fd = -1; } /* ================================================== */ static int open_io(void) { static unsigned int address_index = 0; struct Address *addr; /* If a socket is already opened, close it and try the next address */ if (sock_fd >= 0) { close_io(); address_index++; } /* Find an address for which a socket can be opened and connected */ for (; address_index < ARR_GetSize(server_addresses); address_index++) { addr = ARR_GetElement(server_addresses, address_index); if (open_socket(addr)) return 1; close_io(); } /* Start from the first address if called again */ address_index = 0; return 0; } /* ================================================== */ static void bits_to_mask(int bits, int family, IPAddr *mask) { int i; mask->family = family; switch (family) { case IPADDR_INET4: if (bits > 32 || bits < 0) bits = 32; if (bits > 0) { mask->addr.in4 = -1; mask->addr.in4 <<= 32 - bits; } else { mask->addr.in4 = 0; } break; case IPADDR_INET6: if (bits > 128 || bits < 0) bits = 128; for (i = 0; i < bits / 8; i++) mask->addr.in6[i] = 0xff; if (i < 16) mask->addr.in6[i++] = (0xff << (8 - bits % 8)) & 0xff; for (; i < 16; i++) mask->addr.in6[i] = 0x0; break; case IPADDR_ID: mask->family = IPADDR_UNSPEC; break; default: assert(0); } } /* ================================================== */ static int parse_source_address(char *word, IPAddr *address) { if (UTI_StringToIdIP(word, address)) return 1; if (DNS_Name2IPAddress(word, address, 1) == DNS_Success) return 1; return 0; } /* ================================================== */ static int parse_source_address_or_refid(char *s, IPAddr *address, uint32_t *ref_id) { address->family = IPADDR_UNSPEC; *ref_id = 0; /* Don't allow hostnames to avoid conflicts with reference IDs */ if (UTI_StringToIdIP(s, address) || UTI_StringToIP(s, address)) return 1; if (CPS_ParseRefid(s, ref_id) > 0) return 1; return 0; } /* ================================================== */ static int read_mask_address(char *line, IPAddr *mask, IPAddr *address) { unsigned int bits; char *p, *q; p = line; if (!*p) { mask->family = address->family = IPADDR_UNSPEC; return 1; } else { q = strchr(p, '/'); if (q) { *q++ = 0; if (UTI_StringToIP(p, mask)) { p = q; if (UTI_StringToIP(p, address)) { if (address->family == mask->family) return 1; } else if (sscanf(p, "%u", &bits) == 1) { *address = *mask; bits_to_mask(bits, address->family, mask); return 1; } } } else { if (parse_source_address(p, address)) { bits_to_mask(-1, address->family, mask); return 1; } else { LOG(LOGS_ERR, "Could not get address for hostname"); return 0; } } } LOG(LOGS_ERR, "Invalid syntax for mask/address"); return 0; } /* ================================================== */ static int process_cmd_offline(CMD_Request *msg, char *line) { IPAddr mask, address; int ok; if (read_mask_address(line, &mask, &address)) { UTI_IPHostToNetwork(&mask, &msg->data.offline.mask); UTI_IPHostToNetwork(&address, &msg->data.offline.address); msg->command = htons(REQ_OFFLINE); ok = 1; } else { ok = 0; } return ok; } /* ================================================== */ static int process_cmd_online(CMD_Request *msg, char *line) { IPAddr mask, address; int ok; if (read_mask_address(line, &mask, &address)) { UTI_IPHostToNetwork(&mask, &msg->data.online.mask); UTI_IPHostToNetwork(&address, &msg->data.online.address); msg->command = htons(REQ_ONLINE); ok = 1; } else { ok = 0; } return ok; } /* ================================================== */ static void process_cmd_onoffline(CMD_Request *msg, char *line) { msg->command = htons(REQ_ONOFFLINE); } /* ================================================== */ static int read_address_integer(char *line, IPAddr *address, int *value) { char *hostname; int ok = 0; hostname = line; line = CPS_SplitWord(line); if (sscanf(line, "%d", value) != 1) { LOG(LOGS_ERR, "Invalid syntax for address value"); ok = 0; } else { if (!parse_source_address(hostname, address)) { LOG(LOGS_ERR, "Could not get address for hostname"); ok = 0; } else { ok = 1; } } return ok; } /* ================================================== */ static int read_address_double(char *line, IPAddr *address, double *value) { char *hostname; int ok = 0; hostname = line; line = CPS_SplitWord(line); if (sscanf(line, "%lf", value) != 1) { LOG(LOGS_ERR, "Invalid syntax for address value"); ok = 0; } else { if (!parse_source_address(hostname, address)) { LOG(LOGS_ERR, "Could not get address for hostname"); ok = 0; } else { ok = 1; } } return ok; } /* ================================================== */ static int process_cmd_minpoll(CMD_Request *msg, char *line) { IPAddr address; int minpoll; int ok; if (read_address_integer(line, &address, &minpoll)) { UTI_IPHostToNetwork(&address, &msg->data.modify_minpoll.address); msg->data.modify_minpoll.new_minpoll = htonl(minpoll); msg->command = htons(REQ_MODIFY_MINPOLL); ok = 1; } else { ok = 0; } return ok; } /* ================================================== */ static int process_cmd_maxpoll(CMD_Request *msg, char *line) { IPAddr address; int maxpoll; int ok; if (read_address_integer(line, &address, &maxpoll)) { UTI_IPHostToNetwork(&address, &msg->data.modify_maxpoll.address); msg->data.modify_maxpoll.new_maxpoll = htonl(maxpoll); msg->command = htons(REQ_MODIFY_MAXPOLL); ok = 1; } else { ok = 0; } return ok; } /* ================================================== */ static int process_cmd_maxdelay(CMD_Request *msg, char *line) { IPAddr address; double max_delay; int ok; if (read_address_double(line, &address, &max_delay)) { UTI_IPHostToNetwork(&address, &msg->data.modify_maxdelay.address); msg->data.modify_maxdelay.new_max_delay = UTI_FloatHostToNetwork(max_delay); msg->command = htons(REQ_MODIFY_MAXDELAY); ok = 1; } else { ok = 0; } return ok; } /* ================================================== */ static int process_cmd_maxdelaydevratio(CMD_Request *msg, char *line) { IPAddr address; double max_delay_dev_ratio; int ok; if (read_address_double(line, &address, &max_delay_dev_ratio)) { UTI_IPHostToNetwork(&address, &msg->data.modify_maxdelaydevratio.address); msg->data.modify_maxdelayratio.new_max_delay_ratio = UTI_FloatHostToNetwork(max_delay_dev_ratio); msg->command = htons(REQ_MODIFY_MAXDELAYDEVRATIO); ok = 1; } else { ok = 0; } return ok; } /* ================================================== */ static int process_cmd_maxdelayratio(CMD_Request *msg, char *line) { IPAddr address; double max_delay_ratio; int ok; if (read_address_double(line, &address, &max_delay_ratio)) { UTI_IPHostToNetwork(&address, &msg->data.modify_maxdelayratio.address); msg->data.modify_maxdelayratio.new_max_delay_ratio = UTI_FloatHostToNetwork(max_delay_ratio); msg->command = htons(REQ_MODIFY_MAXDELAYRATIO); ok = 1; } else { ok = 0; } return ok; } /* ================================================== */ static int process_cmd_minstratum(CMD_Request *msg, char *line) { IPAddr address; int min_stratum; int ok; if (read_address_integer(line, &address, &min_stratum)) { UTI_IPHostToNetwork(&address, &msg->data.modify_minstratum.address); msg->data.modify_minstratum.new_min_stratum = htonl(min_stratum); msg->command = htons(REQ_MODIFY_MINSTRATUM); ok = 1; } else { ok = 0; } return ok; } /* ================================================== */ static int process_cmd_polltarget(CMD_Request *msg, char *line) { IPAddr address; int poll_target; int ok; if (read_address_integer(line, &address, &poll_target)) { UTI_IPHostToNetwork(&address, &msg->data.modify_polltarget.address); msg->data.modify_polltarget.new_poll_target = htonl(poll_target); msg->command = htons(REQ_MODIFY_POLLTARGET); ok = 1; } else { ok = 0; } return ok; } /* ================================================== */ static int process_cmd_maxupdateskew(CMD_Request *msg, char *line) { int ok; double new_max_update_skew; if (sscanf(line, "%lf", &new_max_update_skew) == 1) { msg->data.modify_maxupdateskew.new_max_update_skew = UTI_FloatHostToNetwork(new_max_update_skew); msg->command = htons(REQ_MODIFY_MAXUPDATESKEW); ok = 1; } else { ok = 0; } return ok; } /* ================================================== */ static void process_cmd_dump(CMD_Request *msg, char *line) { msg->command = htons(REQ_DUMP); msg->data.dump.pad = htonl(0); } /* ================================================== */ static void process_cmd_writertc(CMD_Request *msg, char *line) { msg->command = htons(REQ_WRITERTC); } /* ================================================== */ static void process_cmd_trimrtc(CMD_Request *msg, char *line) { msg->command = htons(REQ_TRIMRTC); } /* ================================================== */ static void process_cmd_cyclelogs(CMD_Request *msg, char *line) { msg->command = htons(REQ_CYCLELOGS); } /* ================================================== */ static int process_cmd_burst(CMD_Request *msg, char *line) { int n_good_samples, n_total_samples; char *s1, *s2; IPAddr address, mask; s1 = line; s2 = CPS_SplitWord(s1); CPS_SplitWord(s2); if (sscanf(s1, "%d/%d", &n_good_samples, &n_total_samples) != 2) { LOG(LOGS_ERR, "Invalid syntax for burst command"); return 0; } mask.family = address.family = IPADDR_UNSPEC; if (*s2 && !read_mask_address(s2, &mask, &address)) { return 0; } msg->command = htons(REQ_BURST); msg->data.burst.n_good_samples = ntohl(n_good_samples); msg->data.burst.n_total_samples = ntohl(n_total_samples); UTI_IPHostToNetwork(&mask, &msg->data.burst.mask); UTI_IPHostToNetwork(&address, &msg->data.burst.address); return 1; } /* ================================================== */ static int process_cmd_local(CMD_Request *msg, char *line) { double distance = 0.0, activate = 0.0, wait_synced = 0.0, wait_unsynced = 0.0; int on_off, stratum = 0, orphan = 0; if (!strcmp(line, "off")) { on_off = 0; } else if (CPS_ParseLocal(line, &stratum, &orphan, &distance, &activate, &wait_synced, &wait_unsynced) == CPS_Success) { on_off = 1; } else { LOG(LOGS_ERR, "Invalid syntax for local command"); return 0; } msg->command = htons(REQ_LOCAL3); msg->data.local.on_off = htonl(on_off); msg->data.local.stratum = htonl(stratum); msg->data.local.distance = UTI_FloatHostToNetwork(distance); msg->data.local.orphan = htonl(orphan); msg->data.local.activate = UTI_FloatHostToNetwork(activate); msg->data.local.wait_synced = UTI_FloatHostToNetwork(wait_synced); msg->data.local.wait_unsynced = UTI_FloatHostToNetwork(wait_unsynced); return 1; } /* ================================================== */ static int process_cmd_manual(CMD_Request *msg, const char *line) { const char *p; p = line; if (!strcmp(p, "off")) { msg->data.manual.option = htonl(0); } else if (!strcmp(p, "on")) { msg->data.manual.option = htonl(1); } else if (!strcmp(p, "reset")) { msg->data.manual.option = htonl(2); } else { LOG(LOGS_ERR, "Invalid syntax for manual command"); return 0; } msg->command = htons(REQ_MANUAL); return 1; } /* ================================================== */ static int process_cmd_allowdeny(CMD_Request *msg, char *line, int cmd, int allcmd) { int all, subnet_bits; IPAddr ip; if (!CPS_ParseAllowDeny(line, &all, &ip, &subnet_bits)) { LOG(LOGS_ERR, "Could not read address"); return 0; } msg->command = htons(all ? allcmd : cmd); UTI_IPHostToNetwork(&ip, &msg->data.allow_deny.ip); msg->data.allow_deny.subnet_bits = htonl(subnet_bits); return 1; } /* ================================================== */ static int process_cmd_accheck(CMD_Request *msg, char *line) { IPAddr ip; msg->command = htons(REQ_ACCHECK); if (DNS_Name2IPAddress(line, &ip, 1) == DNS_Success) { UTI_IPHostToNetwork(&ip, &msg->data.ac_check.ip); return 1; } else { LOG(LOGS_ERR, "Could not read address"); return 0; } } /* ================================================== */ static int process_cmd_cmdaccheck(CMD_Request *msg, char *line) { IPAddr ip; msg->command = htons(REQ_CMDACCHECK); if (DNS_Name2IPAddress(line, &ip, 1) == DNS_Success) { UTI_IPHostToNetwork(&ip, &msg->data.ac_check.ip); return 1; } else { LOG(LOGS_ERR, "Could not read address"); return 0; } } /* ================================================== */ static int process_cmd_dfreq(CMD_Request *msg, char *line) { double dfreq; msg->command = htons(REQ_DFREQ); if (sscanf(line, "%lf", &dfreq) != 1) { LOG(LOGS_ERR, "Invalid value"); return 0; } msg->data.dfreq.dfreq = UTI_FloatHostToNetwork(dfreq); return 1; } /* ================================================== */ static int process_cmd_doffset(CMD_Request *msg, char *line) { double doffset; msg->command = htons(REQ_DOFFSET2); if (sscanf(line, "%lf", &doffset) != 1) { LOG(LOGS_ERR, "Invalid value"); return 0; } msg->data.doffset.doffset = UTI_FloatHostToNetwork(doffset); return 1; } /* ================================================== */ static int convert_addsrc_sel_options(int options) { return (options & SRC_SELECT_PREFER ? REQ_ADDSRC_PREFER : 0) | (options & SRC_SELECT_NOSELECT ? REQ_ADDSRC_NOSELECT : 0) | (options & SRC_SELECT_TRUST ? REQ_ADDSRC_TRUST : 0) | (options & SRC_SELECT_REQUIRE ? REQ_ADDSRC_REQUIRE : 0); } /* ================================================== */ static int process_cmd_add_source(CMD_Request *msg, char *line) { CPS_NTP_Source data; CPS_Status status; IPAddr ip_addr; int result = 0, type; const char *opt_name, *word; msg->command = htons(REQ_ADD_SOURCE); word = line; line = CPS_SplitWord(line); if (!strcasecmp(word, "server")) { type = REQ_ADDSRC_SERVER; } else if (!strcasecmp(word, "peer")) { type = REQ_ADDSRC_PEER; } else if (!strcasecmp(word, "pool")) { type = REQ_ADDSRC_POOL; } else { LOG(LOGS_ERR, "Invalid syntax for add command"); return 0; } status = CPS_ParseNTPSourceAdd(line, &data); switch (status) { case CPS_Success: /* Verify that the address is resolvable (chronyc and chronyd are assumed to be running on the same host) */ if (strlen(data.name) >= sizeof (msg->data.ntp_source.name) || DNS_Name2IPAddress(data.name, &ip_addr, 1) != DNS_Success) { LOG(LOGS_ERR, "Invalid host/IP address"); break; } opt_name = NULL; if (opt_name) { LOG(LOGS_ERR, "%s can't be set in chronyc", opt_name); break; } msg->data.ntp_source.type = htonl(type); BRIEF_ASSERT(strlen(data.name) < sizeof (msg->data.ntp_source.name)); strncpy((char *)msg->data.ntp_source.name, data.name, sizeof (msg->data.ntp_source.name)); msg->data.ntp_source.port = htonl(data.port); msg->data.ntp_source.minpoll = htonl(data.params.minpoll); msg->data.ntp_source.maxpoll = htonl(data.params.maxpoll); msg->data.ntp_source.presend_minpoll = htonl(data.params.presend_minpoll); msg->data.ntp_source.min_stratum = htonl(data.params.min_stratum); msg->data.ntp_source.poll_target = htonl(data.params.poll_target); msg->data.ntp_source.version = htonl(data.params.version); msg->data.ntp_source.max_sources = htonl(data.params.max_sources); msg->data.ntp_source.min_samples = htonl(data.params.min_samples); msg->data.ntp_source.max_samples = htonl(data.params.max_samples); msg->data.ntp_source.authkey = htonl(data.params.authkey); msg->data.ntp_source.nts_port = htonl(data.params.nts_port); msg->data.ntp_source.max_delay = UTI_FloatHostToNetwork(data.params.max_delay); msg->data.ntp_source.max_delay_ratio = UTI_FloatHostToNetwork(data.params.max_delay_ratio); msg->data.ntp_source.max_delay_dev_ratio = UTI_FloatHostToNetwork(data.params.max_delay_dev_ratio); msg->data.ntp_source.min_delay = UTI_FloatHostToNetwork(data.params.min_delay); msg->data.ntp_source.asymmetry = UTI_FloatHostToNetwork(data.params.asymmetry); msg->data.ntp_source.offset = UTI_FloatHostToNetwork(data.params.offset); msg->data.ntp_source.flags = htonl( (data.params.connectivity == SRC_ONLINE ? REQ_ADDSRC_ONLINE : 0) | (data.params.auto_offline ? REQ_ADDSRC_AUTOOFFLINE : 0) | (data.params.iburst ? REQ_ADDSRC_IBURST : 0) | (data.params.interleaved ? REQ_ADDSRC_INTERLEAVED : 0) | (data.params.burst ? REQ_ADDSRC_BURST : 0) | (data.params.nts ? REQ_ADDSRC_NTS : 0) | (data.params.copy ? REQ_ADDSRC_COPY : 0) | (data.params.ext_fields & NTP_EF_FLAG_EXP_MONO_ROOT ? REQ_ADDSRC_EF_EXP_MONO_ROOT : 0) | (data.params.ext_fields & NTP_EF_FLAG_EXP_NET_CORRECTION ? REQ_ADDSRC_EF_EXP_NET_CORRECTION : 0) | (data.family == IPADDR_INET4 ? REQ_ADDSRC_IPV4 : 0) | (data.family == IPADDR_INET6 ? REQ_ADDSRC_IPV6 : 0) | convert_addsrc_sel_options(data.params.sel_options)); msg->data.ntp_source.filter_length = htonl(data.params.filter_length); msg->data.ntp_source.cert_set = htonl(data.params.cert_set); msg->data.ntp_source.max_delay_quant = UTI_FloatHostToNetwork(data.params.max_delay_quant); memset(msg->data.ntp_source.reserved, 0, sizeof (msg->data.ntp_source.reserved)); result = 1; break; case CPS_InvalidOption: LOG(LOGS_ERR, "Invalid %s add command", "option in"); break; case CPS_InvalidValue: LOG(LOGS_ERR, "Invalid %s add command", "value in"); break; default: LOG(LOGS_ERR, "Invalid %s add command", "syntax for"); break; } return result; } /* ================================================== */ static int process_cmd_delete(CMD_Request *msg, char *line) { char *hostname; int ok = 0; IPAddr address; msg->command = htons(REQ_DEL_SOURCE); hostname = line; CPS_SplitWord(line); if (!*hostname) { LOG(LOGS_ERR, "Invalid syntax for address"); ok = 0; } else { if (!parse_source_address(hostname, &address)) { LOG(LOGS_ERR, "Could not get address for hostname"); ok = 0; } else { UTI_IPHostToNetwork(&address, &msg->data.del_source.ip_addr); ok = 1; } } return ok; } /* ================================================== */ static void give_help(void) { int line, len; const char *s, cols[] = "System clock:\0\0" "tracking\0Display system time information\0" "makestep\0Correct clock by stepping immediately\0" "makestep \0Configure automatic clock stepping\0" "maxupdateskew \0Modify maximum valid skew to update frequency\0" "waitsync [ [ [ []]]]\0" "Wait until synchronised in specified limits\0" "\0\0" "Time sources:\0\0" "sources [-a] [-v]\0Display information about current sources\0" "sourcestats [-a] [-v]\0Display statistics about collected measurements\0" "selectdata [-a] [-v]\0Display information about source selection\0" "selectopts <+|-options>\0Modify selection options\0" "reselect\0Force reselecting synchronisation source\0" "reselectdist \0Modify reselection distance\0" "offset \0Modify offset correction\0" "\0\0" "NTP sources:\0\0" "activity\0Check how many NTP sources are online/offline\0" "authdata [-a] [-v]\0Display information about authentication\0" "ntpdata [
]\0Display information about last valid measurement\0" "add server [options]\0Add new NTP server\0" "add pool [options]\0Add new pool of NTP servers\0" "add peer [options]\0Add new NTP peer\0" "delete
\0Remove server or peer\0" "burst / [[/]
]\0Start rapid set of measurements\0" "maxdelay
\0Modify maximum valid sample delay\0" "maxdelayratio
\0Modify maximum valid delay/minimum ratio\0" "maxdelaydevratio
\0Modify maximum valid delay/deviation ratio\0" "minpoll
\0Modify minimum polling interval\0" "maxpoll
\0Modify maximum polling interval\0" "minstratum
\0Modify minimum stratum\0" "offline [[/]
]\0Set sources in subnet to offline status\0" "online [[/]
]\0Set sources in subnet to online status\0" "onoffline\0Set all sources to online or offline status\0" "\0according to network configuration\0" "polltarget
\0Modify poll target\0" "refresh\0Refresh IP addresses\0" "reload sources\0Re-read *.sources files\0" "sourcename
\0Display original name\0" "\0\0" "Manual time input:\0\0" "manual off|on|reset\0Disable/enable/reset settime command\0" "manual list\0Show previous settime entries\0" "manual delete \0Delete previous settime entry\0" "settime