Commit graph

1172 commits

Author SHA1 Message Date
Bryan Christianson
794a1e6cfe contrib: add Mac OS X support files
launchd plist files for chronyd and logrotation.
shell script for logrotation
README file with detailed installation instructions
2015-08-20 14:35:26 +02:00
Bryan Christianson
7c4db99d44 sys_macosx: make drift removal interval dynamic
Adjust the drift removal interval based on the observed offset_sd.
A newly calculated interval goes into effect after the current drift
removal has completed. When offset_sd is high, the interval is increased
resulting in fewer wakeups to adjust the drift offset. At lower values
of offset_sd the drift removal adjustment interval is pinned to 0.5
seconds. The predicted error applied at the start of an adjustment is
based on the remaining time of the drift removal that is currently in
effect. Default drift removal adjustment interval is 4.0 seconds (was
1.0). If not synchronised set interval to  maximum of default interval
and current interval. Clamp elapsed drift removal time to
[0, current_drift_removal_interval] to cover clock stepping.
2015-08-18 10:43:20 +02:00
Miroslav Lichvar
30b6213910 util: set uid/gid of created directory even when zero
Call chown() in create_dir() even when the specified uid/gid is zero.
This is needed on BSD systems, where directories are created with gid
of the parent directory.
2015-08-13 17:15:50 +02:00
Miroslav Lichvar
b6a27df5b9 sys: include predicted drift in adjtime() offset
In drivers with periodic drift removal include in the adjustment also a
prediction of the error gained in half of the interval to move the mean
offset of the clock closer to zero. E.g. offset of a stable clock
drifting by 10 ppm should now be closer to 0 +/- 5 microseconds instead
of 5 +/- 5 microseconds.
2015-08-12 16:09:24 +02:00
Miroslav Lichvar
18d514d552 sys: define NETBSD macro on NetBSD 2015-08-12 14:45:23 +02:00
Miroslav Lichvar
f1ed08abf0 conf: create directory for Unix domain command socket
Try to create the directory where will be the Unix domain command socket
bound to allow starting with empty /var/run. Check the permissions and
owner/group in case the directory already existed. It MUST NOT be
accessible by others as permissions on Unix domain sockets are ignored
on some systems (e.g. Solaris).
2015-08-12 14:45:23 +02:00
Miroslav Lichvar
6d42dd8603 conf: create directories before dropping root
Create logdir and dumpdir before dropping root. Set their uid/gid to the
user chronyd will switch to. This allows chronyd to create the
directories in a directory where the user won't have write permissions
(e.g. /var/lib).
2015-08-12 14:45:20 +02:00
Miroslav Lichvar
e7100e106d main: always call getpwnam()
Don't hardcode root as the user with zero uid/gid.
2015-08-12 14:34:28 +02:00
Miroslav Lichvar
6402350c83 sys: move getpwnam() call to main.c
Pass uid/gid instead of user name to the root dropping function.
2015-08-10 16:06:39 +02:00
Miroslav Lichvar
236576c124 util: add mode, uid, gid parameters to UTI_CreateDirAndParents() 2015-08-10 14:56:17 +02:00
Miroslav Lichvar
9a83cab2f8 util: don't try to create current directory
This prevents error messages when running chronyd -d/-q/-Q with default
logdir in a directory chronyd is not allowed do access after dropping
the root privileges.
2015-08-05 18:07:39 +02:00
Miroslav Lichvar
92706b158e move mkdirpp code to util.c 2015-08-05 18:07:39 +02:00
Miroslav Lichvar
ad34b26955 client: check if memory allocation fails 2015-08-05 18:07:39 +02:00
Miroslav Lichvar
12c434fdc0 client: add logging function to allow linking with memory.o 2015-08-05 18:07:39 +02:00
Miroslav Lichvar
9ceaef6479 doc: update FAQ 2015-08-05 11:26:26 +02:00
Bryan Christianson
abb56bded2 sys: add drift removal to Mac OS X driver
The darwin kernel implementation of adjtime() does not require the
adjustment to be aligned to a tickadj boundary, and we can apply
adjustments to the nearest microsecond. Rounding is accounted for by
adding any rounding errors back into the offset.
2015-08-03 17:28:19 +02:00
Miroslav Lichvar
0bcd10560a cmdmon: listen on Unix domain socket
In addition to the IPv4/IPv6 command sockets, create also a Unix domain
socket to process cmdmon requests. For now, there is no difference for
authorized commands, packets from all sockets need to be authenticated.

The default path of the socket is /var/run/chrony/chronyd.sock. It can
be configured with the bindcmdaddress directive with an address starting
with /.
2015-07-28 15:29:30 +02:00
Miroslav Lichvar
46b7148f3b clientlog: refactor CLG_Log*Access functions a bit 2015-07-28 14:46:03 +02:00
Miroslav Lichvar
37732130e1 clientlog: allow unspecified address in CLG_Log*Access functions 2015-07-28 14:32:54 +02:00
Miroslav Lichvar
7a3b1414cd util: add function to get sockaddr family name 2015-07-28 13:11:00 +02:00
Miroslav Lichvar
a4a21c1dca client: handle signals
Add a signal handler and rework the code to go through close_io() even
when terminated by a signal. This will allow chronyc to remove Unix
domain sockets on exit.
2015-07-28 11:57:57 +02:00
Miroslav Lichvar
206e597b04 util: use sigaction() to set signal handler 2015-07-28 11:57:57 +02:00
Miroslav Lichvar
ceef8ad2d8 main: move signal handler setting to util.c 2015-07-28 11:57:57 +02:00
Miroslav Lichvar
2d581a6a86 cmdmon: add debug messages for receiving/sending packets 2015-07-28 11:57:57 +02:00
Miroslav Lichvar
82f7fa3887 util: remove INLINE_UTILITIES support 2015-07-28 11:57:57 +02:00
Miroslav Lichvar
f88a01e8c7 remove getdate.c from repository
Building from repository now requires installed bison, but released
tarballs will still include a generated getdate.c.
2015-07-28 11:57:57 +02:00
Miroslav Lichvar
ca8e03b785 include config.h in all compiled files
After running configure script (new config.h written), all objects
should be recompiled.
2015-07-28 11:57:57 +02:00
Miroslav Lichvar
15932c9d7b sys: add new log message for kernel status reset after leap second
When a leap second is applied by the kernel, it doesn't actually clear
the STA_INS|STA_DEL bits from the status word, but the state returned
by ntp_adjtime()/adjtimex() is TIME_WAIT until the application clears
the bits.

Add "System clock status reset after leap second" log message for this
case.
2015-07-27 12:35:21 +02:00
Bryan Christianson
0fc0f906e1 util: fix rounding of negative numbers in UTI_DoubleToTimeval() 2015-07-23 14:53:00 +02:00
Miroslav Lichvar
7f58852ec0 util: fix UTI_Log2ToDouble() for maximum/minimum exponent 2015-07-23 12:04:27 +02:00
Miroslav Lichvar
85a9a53e69 configure: replace echo -n with printf
POSIX doesn't require echo to support -n.
2015-07-23 11:27:16 +02:00
Miroslav Lichvar
aa0c0fc401 make_release: don't package chrony.txt 2015-07-22 18:14:40 +02:00
Miroslav Lichvar
0e694e08fc makefile: install chrony.txt in install-doc only
Don't install chrony.txt in make install to avoid dependency on makeinfo
since chrony.texi is prepared by configure to set the default paths in
the documentation.
2015-07-22 17:42:42 +02:00
Miroslav Lichvar
c2ddcc9f36 makefile: don't install COPYING and README 2015-07-22 17:38:00 +02:00
Miroslav Lichvar
7a7cf6a5ce doc: update NEWS 2015-06-23 16:02:17 +02:00
Miroslav Lichvar
c2f83bd8a4 sys: fix clock stepping by integer number of seconds on Linux
The kernel requires in the ADJ_SETOFFSET | ADJ_NANO mode that the
timex.time.tv_usec value is smaller than 10^9 nanosecond, which wasn't
the case with a negative integer offset (e.g. inserted leap second).
2015-06-23 15:08:42 +02:00
Miroslav Lichvar
1f0e6296c6 doc: update NEWS 2015-06-22 12:54:52 +02:00
Miroslav Lichvar
ab1f01bacd ntp: use specific reference ID when smoothing served time
Set refid in server/broadcast packets to 127.127.1.255 when a time
smoothing offset is applied to the timestamps. This allows the clients
and administrators to detect that the server is not serving its best
estimate of the true time.
2015-06-22 12:54:50 +02:00
Miroslav Lichvar
b9b896d8e7 ntp: remove unnecessary casting 2015-06-22 12:54:33 +02:00
Miroslav Lichvar
6be54f366c reference: move definition of special refids to ntp.h 2015-06-22 12:54:22 +02:00
Miroslav Lichvar
802cdb3230 test: require latest clknetsim 2015-06-19 14:20:58 +02:00
Miroslav Lichvar
7e27880cb6 doc: update leapsecmode and smoothtime descriptions 2015-06-19 14:20:58 +02:00
Miroslav Lichvar
d3ad85aa43 doc: add Mac OS X to supported platforms 2015-06-18 16:35:26 +02:00
Miroslav Lichvar
59192fc695 update copyright years 2015-06-18 15:30:22 +02:00
Miroslav Lichvar
9095b80c5b doc: refer to authhash command in password command description 2015-06-17 18:31:16 +02:00
Miroslav Lichvar
ed5b78bf09 doc: convert FAQ to AsciiDoc and update it
It's now in a separate file again.
2015-06-17 18:05:14 +02:00
Bryan Christianson
d6aafa3f64 sys: MacOS X driver ported from NetBSD 2015-06-15 14:40:54 +02:00
Miroslav Lichvar
8de04a808d ntp: add debug message to print number of resolved addresses 2015-06-15 13:03:11 +02:00
Miroslav Lichvar
2a299233b3 update NEWS 2015-06-10 14:44:54 +02:00
Miroslav Lichvar
64f83c8861 cmdmon: reply with STT_INVALID on invalid option in handle_manual() 2015-06-09 17:05:45 +02:00