Commit graph

207 commits

Author SHA1 Message Date
Miroslav Lichvar
b4235abd36 update copyright years 2017-01-12 16:34:28 +01:00
Miroslav Lichvar
a7802e9a76 fix some coverity warnings 2017-01-12 16:34:27 +01:00
Miroslav Lichvar
5fee3ed5e9 client: print refid also as string in ntpdata output 2017-01-06 13:12:19 +01:00
Miroslav Lichvar
88c31b3785 client: improve ntpdata output 2016-12-14 16:19:35 +01:00
Miroslav Lichvar
967f3e4f77 client: don't require address in ntpdata command
If no address is specified, use the SOURCE_DATA command to get addresses
of NTP sources, and request NTP_DATA for all of them.
2016-12-14 16:19:35 +01:00
Lonnie Abelbeck
3156e5a293 client: add tab-completion with libedit/readline 2016-12-08 15:32:51 +01:00
Miroslav Lichvar
65fd30a547 cmdmon: allow all parameters to be set for new sources
Add missing fields to the REQ_NTP_Source structure and add new versions
of the ADD_SERVER/ADD_PEER commands.
2016-12-06 16:56:38 +01:00
Miroslav Lichvar
979b53866d client: print addresses with refids in ntpdata report 2016-12-06 16:56:38 +01:00
Miroslav Lichvar
46061d8eec client: fix truncation of long hostnames 2016-12-06 16:56:38 +01:00
Miroslav Lichvar
946ee8f611 client: fix format specifier for poll in ntpdata report 2016-12-06 16:56:38 +01:00
Miroslav Lichvar
7f757f09ce client: fix add command
The default version changed to 0 (autoselect).
2016-12-06 16:56:38 +01:00
Miroslav Lichvar
27ea58d5fd client: zero pad reference ID 2016-12-02 14:53:03 +01:00
Miroslav Lichvar
64f9205189 client: add ntpdata command 2016-11-25 17:33:43 +01:00
Miroslav Lichvar
7255f9ef74 client: fix format specifiers in sourcestats report 2016-11-25 17:33:43 +01:00
Miroslav Lichvar
cdb0b6124f client: add new format specifiers to print_report() 2016-11-25 17:33:43 +01:00
Miroslav Lichvar
5fb1107cc7 client: print reference ID in hexadecimal
This is an incompatible change in the output of the tracking command,
which may break some scripts, but it's necessary to avoid confusion with
IPv4 addresses when synchronised to an IPv6 server or reference clock.
2016-11-25 17:33:43 +01:00
Miroslav Lichvar
74f581e7ab client: randomize sequence number in requests
Don't rely on random source port of a connected socket alone as a
protection against spoofed packets in chronyc. Generate a fully random
32-bit sequence number for each request and modify the code to not send
a new request until the timeout expires or a valid response is received.
For a monitoring protocol this should be more than good enough.
2016-11-15 14:55:25 +01:00
Miroslav Lichvar
07aa54b183 client: fix attempt number in requests to be in network order 2016-11-15 14:55:25 +01:00
Miroslav Lichvar
90b25f5b83 ntp: add support for interleaved symmetric mode
Add xleave option to the peer directive to enable an interleaved mode
compatible with ntpd. This allows peers to exchange transmit timestamps
captured after the actual transmission and significantly improve
the accuracy of the measurements.
2016-11-10 15:26:56 +01:00
Miroslav Lichvar
d2e5b41369 client: flush stdout after printing prompt
Apparently fgets() doesn't flush stdout in some libc implementations.
2016-09-07 11:16:01 +02:00
Miroslav Lichvar
4b6b6e5cba client: remove out of date comment 2016-09-07 11:16:01 +02:00
Miroslav Lichvar
27b4c396d0 client: fix printing of negative poll in sources report again
This was broken in commit 3f51805e62.
2016-09-07 11:16:01 +02:00
Miroslav Lichvar
41eb5b79cb client: check address in waitsync command 2016-09-07 11:16:01 +02:00
Miroslav Lichvar
d0dfa1de9e adopt struct timespec
Replace struct timeval with struct timespec as the main data type for
timestamps. This will allow the NTP code to work with timestamps in
nanosecond resolution.
2016-08-19 12:53:09 +02:00
Miroslav Lichvar
3dec266dd5 client: indicate truncated addresses/hostnames
Add symbol > to the end of the resolved hostname or address when it's
truncated.
2016-07-20 09:34:11 +02:00
Miroslav Lichvar
862938cc79 client: truncate long hostnames in clients output 2016-07-20 09:34:11 +02:00
Miroslav Lichvar
ee396702f2 client: print intervals in seconds up to 1200 seconds
This covers random variations in the default maximum polling interval.
2016-07-20 09:34:11 +02:00
Miroslav Lichvar
6cd558398a ntp: add offset option
Add offset option to the server/pool/peer directive. It specifies a
correction which will be applied to offsets measured with the NTP
source. It's particularly useful to compensate for a known asymmetry in
network delay or timestamping errors.
2016-06-28 15:40:58 +02:00
Miroslav Lichvar
632cd1a177 client: rework error printing for unsupported source options 2016-06-28 13:26:09 +02:00
Miroslav Lichvar
f8bd9ab378 cmdparse: remove CPS_Status
Remove command and option specific error codes. Return zero on any
failure.
2016-06-27 14:52:55 +02:00
Miroslav Lichvar
1ec0813663 client: fix compiler warnings on NetBSD 2016-06-07 09:36:55 +02:00
Miroslav Lichvar
942b52a3ca client: initialize variables in new local command 2016-04-11 08:28:45 +02:00
Miroslav Lichvar
53b15bd5c7 cmdmon: extend local command to match local directive 2016-04-08 16:21:19 +02:00
Miroslav Lichvar
eb329e9f52 client: ignore -v option in csv mode 2016-03-22 16:34:35 +01:00
Miroslav Lichvar
ea3950d57e client: add CSV output mode
Add a new option (-c) to chronyc to enable printing of reports in a
column-separated values (CSV) format. IP addresses will not be resolved
to hostnames, time will be printed as number of seconds since the epoch
and values in seconds will not be converted to other units.
2016-03-17 16:01:58 +01:00
Miroslav Lichvar
3f51805e62 client: rework printing of reports
Add a new printf-like function to allow printing of all fields at once
and rework all commands which print a report to use it. Add functions
for printing of headers and information fields, and formatting of IP
addresses and reference IDs.
2016-03-17 15:50:39 +01:00
Miroslav Lichvar
4acca9b727 client: add reselectdist to help text 2016-03-11 17:29:10 +01:00
Miroslav Lichvar
008615370a update copyright years 2016-02-02 12:02:16 +01:00
Miroslav Lichvar
cf636a969e client: fix format specifiers in client report
This was missing in commit 861ac013bc.
2016-02-01 10:30:31 +01:00
Miroslav Lichvar
705e32acdc cmdmon: define new types for CLIENT_ACCESSES_BY_INDEX command
There was an incompatible change in the client access report. To avoid
bumping the protocol version drop support for the original request/reply
types and define new CLIENT_ACCESSES_BY_INDEX2 types as a newer version
of the command.
2016-01-29 17:55:58 +01:00
Miroslav Lichvar
861ac013bc cmdmon: use 32-bit fields in client access report
The clientlog record still uses 16-bit integers to count dropped
packets, but this will avoid an incompatible change in the command
reply if there will be a need to count more than 2^16 drops.
2016-01-29 17:55:58 +01:00
Miroslav Lichvar
e0ae2b4bb5 client: generate key 1 by default in keygen command 2016-01-29 17:55:58 +01:00
Miroslav Lichvar
070f2706b7 client: add serverstats command 2016-01-22 14:40:29 +01:00
Miroslav Lichvar
a592d82ad9 client: improve waitsync help text 2016-01-14 14:45:52 +01:00
Miroslav Lichvar
7fcf69ce5f client: add keygen command
Add a new command that will generate a random key from /dev/urandom with
given ID, hash function and length.
2016-01-14 14:45:52 +01:00
Miroslav Lichvar
c6554bfd30 nameserv: return at most 16 addresses from DNS_Name2IPAddress()
This is the same limit as in the asynchronous resolver. Use common macro
for all buffers storing IP addresses.
2016-01-13 11:25:26 +01:00
Miroslav Lichvar
e98f76e084 sources: add require option
Require that at least one of the sources specified with this option is
selectable (i.e. recently reachable and not a falseticker) before
updating the clock. Together with the trust option this may be useful to
allow a trusted, but not very precise, reference clock or a trusted
authenticated NTP source to be safely combined with unauthenticated NTP
sources in order to improve the accuracy of the clock. They can be
selected and used for synchronization only if they agree with the
trusted and required source.
2016-01-08 14:30:17 +01:00
Miroslav Lichvar
936f5cb0f1 sources: add trust option
Assume time from a source that is specified with the trust option is
always true.  It can't be rejected as falseticker in the source
selection if sources that are specified without this option don't agree
with it.
2016-01-07 16:20:27 +01:00
Miroslav Lichvar
fa15fb3d53 sources: turn select options into flags
This will allow adding new options for source selection which can be
combined with others.
2015-12-18 16:29:47 +01:00
Miroslav Lichvar
302abf8480 client: print invalid intervals as dash
Instead of printing some large arbitrary values use dash in the LastRx
column of the sources output and the Last/Int columns in the clients
output when no sample or hit is recorded.
2015-12-03 11:43:06 +01:00