Always send timevals in cmdmon protocol in 64-bit format
This is to avoid incompatibility between 64/32-bit client/server.
While at it, convert all time values in the protocol to timeval
to avoid Y2K38 problem.
Miroslav Lichvar [Wed, 26 Aug 2009 15:58:57 +0000 (17:58 +0200)]
Don't lose remaining adjtime in initiate_slew
initiate_slew is called also from set_frequency which doesn't read
the remaining adjtime. This wasn't a problem before commit 8c0f3f4
as offset_register was 0.0 and initiate_slew immediately returned.
Miroslav Lichvar [Wed, 19 Aug 2009 13:39:06 +0000 (15:39 +0200)]
Add SOCK refclock driver
This adds a support for receiving samples over unix domain socket.
It's a better alternative to the SHM refclock, the resolution is not
limited to microseconds and it doesn't require polling.
Timo Teras [Fri, 7 Aug 2009 14:26:15 +0000 (16:26 +0200)]
Set reply source IP from query destination IP
Currently, on multihomed host, when chrony is not bound to a specific
IP address, a query is sent to an interface and the default source IP
hint for the back route differs, the reply will have a source IP
different than where the query was destinied to. This will cause
problems because connection tracking firewalls will drop the replies
and most likely the client program will get confused too.
This patch uses the IP_PKTINFO mechanism to get the IP address where
received packets where targetted to and use that IP address as source
hint when sending a reply.
Miroslav Lichvar [Fri, 17 Jul 2009 10:38:37 +0000 (12:38 +0200)]
Add editline support
GNU readline recently changed license to GPLv3+ which makes it
incompatible with chrony (GPLv2). This patch adds support for editline
library (BSD license).
John Hasler [Tue, 10 Feb 2009 16:59:57 +0000 (17:59 +0100)]
Add mlockall and SCHED_FIFO support
The attached patch adds support for mlockall() as well as the SCHED_FIFO
real-time scheduler. It should result in reduced (and more consistent)
latency. Usage is documented in all the documents.
Miroslav Lichvar [Wed, 31 Dec 2008 08:59:20 +0000 (09:59 +0100)]
Leap second support
Leap second status is accepted and forwarded to clients if majority
of selectable sources agree. The actual insertion/deletion is supported
only on Linux now.
Attached is a patch adding a linux capabilities support to chronyd. It
adds -u option which can be used to specify the user which chronyd
should switch to.
I tried running chronyd in valgrind and the result was that there are four
places where memory is not initialized. A patch fixing the errors is in the
attachment.
John Hasler [Tue, 29 Apr 2008 17:40:15 +0000 (12:40 -0500)]
Fix fault where chronyd enters an endless loop on x86_64
John writes:
Here is a patch that should prevent the endless loop. I've changed
UTI_NormaliseTimeval() to use divide/remainder instead of a loop. It also
replaces some similar loops with calls to UTI_NormaliseTimeval() and fixes
an unrelated bug in UTI_DiffTimevals().
Thomas Zajic [Tue, 29 Jul 2008 22:35:42 +0000 (23:35 +0100)]
Fix IP addressing in chronyc
Thomas wrote:
I found a bug in the chrony client (chronyc) that affects its ability to talk
to remote hosts over the control port (323/udp).
For example, running "chronyc -h 192.168.1.3 sources -v" would just sit there
and hang, and eventually timeout. I found out with tcpdump that chronyc
actually tries to connect to 255.168.1.3 instead of 192.168.1.3.
Goswin Brederlow [Sat, 29 Mar 2008 20:49:59 +0000 (20:49 +0000)]
Fix for chronyc "sources" command on 64 bit machines
(Taken from
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=348412
)
Attached is a patchlet to make the "sources" command of chrony output properly
signed numbers. The chronyd code (see e.g. ntp.h) properly uses int32_t and
friends to get the right number of bits per datatype while client.c just uses
short, int, long. But long will be 64 bit or 32 bit depending on the cpu.
Bill Unruh [Tue, 26 Jun 2007 22:46:33 +0000 (23:46 +0100)]
Fix handling of stratum zero.
Further to the discussion with John Hasler, here are new diffs which
handles the incoming stratum 0 claim of a remote server by redefining the
incoming stratum as one bigger than the Max if it is zero, as per the NTP
version 4 documentation.
If the incoming stratum is zero it sets it to NTP_MAX_STRATUM+1 . If our
current stratum is larger than the NTP_MAX_STRATUM, the outgoing stratum is
also set to zero as per the suggestions in the NTP docs.
Introduces the new NTP_INVALID_STRATUM of 0 for doing these tests or
setting the outgoing stratum.
It is unclear whether chrony wants to follow NTP in setting the outgoing
stratum to zero if it is unknown or invalid, rather than a number larger
than the max stratum. Setting it to zero seems silly, since zero is already
used to define the stratum of a hardware clock (GPS, atomic, etc). This
seems ripe for confusion. But the fact that the ntp docs state to do this,
and that ntp servers (eg ntp.ubc.ca) are already doing this (using 0 to
mean invalid) means that chrony has to handle it on the incoming packets
from the servers.
Bill Unruh [Tue, 26 Jun 2007 22:42:11 +0000 (23:42 +0100)]
Fix problems with rtc_linux.
2) Changes to rtc_linux.c which a) do a double read of /dev/rtc when the
PPM interupt is turned on after the wait time expires. The current read
does not block to the second, as it should, thus two reads are needed.
Also, changes so that at startup the system properly ignores the last
system time from the initial burst mode for setting the system time since
it can be way off. At present this last system time is included in the
regression, which throws it off until finally that sample is dropped.
Stefan Lucke [Tue, 26 Jun 2007 22:02:33 +0000 (23:02 +0100)]
Fix sign v zero extension error in handling IP address
I switch to the git version of chrony. Accidently this version did not
talk to by lokal server at 192.168.192.4. Instead it continuosly tried
255.255.192.4 :-( .
Tracked that down to "char", "unsigned char" issue in nameserv.c:
kevin lyda [Fri, 14 Apr 2006 16:48:43 +0000 (17:48 +0100)]
Quash a load of compile warnings
Kevin Lyda writes:
I enclose the following patch which removes all but three of the warnings. i
don't have any non-linux systems handy to test a fix to the round() function.
but having it return a double should be fine.
It doesn't actually fix anything, it just shuts up -Wall, so it's certainly an
optional type of patch.
Eric Lammerts [Thu, 13 Apr 2006 15:15:26 +0000 (11:15 -0400)]
Fix bogus "system time" report for 64 bit systems
Eric Lammerts writes:
This is known as Debian bug #195620, which is almost three years old!
The problem is that a uint32_t which comes out of ntohl() (but
actually represents a signed value) is directly promoted to long.
Therefore no sign extension takes place.
Patch below solves the problem. There are other places where this
needs to be fixed, but I'll leave that to a less lazy person.
Bernhard Weiss [Sat, 24 Sep 2005 16:17:56 +0000 (18:17 +0200)]
Fix linux_io.h for MIPS
Bernard Weiss writes:
I managed to compile the chrony 1.21 package for the MIPS architecture.
For the package to compile I had to add the following lines to io_linux.h:
[patch]
These values are taken from the ioctl.h file of linux 2.4.30 for the MIPS arch
(__ASM_MIPS_IOCTL_H).
I tried to compile chrony-1.21 on FreeBSD 4.8-RELEASE & 5.4-RELEASE.
I modify two files, configure, sysinc.h.
configure:
add label "FreeBSD-i386" to "BSD/386" line
sysincl.h:
1. FreeBSD obsoletes alloca.h
2. FreeBSD use stdlib.h instead of malloc.h, to use malloc(), free()
Paul Elliott [Mon, 5 Dec 2005 07:16:26 +0000 (01:16 -0600)]
Flush chronyc output buffers.
The following is a patch to chronyc that causes it
to flush the buffers to stderr and stdout after
executing each command. This is needed if
you are controling chronyc from a program (i.e. chronyc's
input and output descriptors are pipes which are being
written/read by another program) and
you do not want to block waiting for chronyc response
which is trapped in a buffer!
John Hasler sent in a patch to do this (which still wouldn't make it compile
for me). This reminded me that I had tackled this myself when my distro moved
to gcc-4 a while back. It turned out I had never even checked in the file from
the working copy I was using (!). Anyway, here it is now.