Miroslav Lichvar
4f10144b09
ntp: add corrected delay to debug message in process_receive()
2016-08-22 15:50:28 +02:00
Miroslav Lichvar
7a1ebc3467
ntp: add support for SO_TIMESTAMPNS socket option
...
Enable the SO_TIMESTAMPNS option to get kernel timestamps in nanosecond
resolution.
2016-08-19 13:55:20 +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
e306199588
ntp: add support for recvmmsg()
...
This is used to read multiple packets with one system call. It should
work on Linux and NetBSD.
2016-08-11 10:45:48 +02:00
Miroslav Lichvar
d18f9ca75a
ntp: rework receiving messages
...
Allocate buffers for received messages on heap instead of stack and
prepare the code for receiving multiple messages at the same time.
2016-08-11 10:45:48 +02:00
Miroslav Lichvar
82e76c39d9
ntp: align buffers for control messages
2016-08-11 10:45:47 +02:00
Miroslav Lichvar
0a10545314
sched: rework file handling API
...
Replace SCH_*InputFileHandler() functions with more general
SCH_*FileHandler(), where events are specified as a new parameter and
which will later support other file events, e.g. file ready for ouput
and exception.
The file handlers have two new parameters: file descriptor and event.
2016-06-23 11:33:54 +02:00
Miroslav Lichvar
72975ce1f0
ntp: improve error messages for socket options
2016-03-14 15:55:39 +01:00
Bryan Christianson
750d82f1d1
sys_macosx: drop root privileges
...
Run chronyd as a non-privileged user, using the privops helper to
perform adjtime(), settimeofday() and bind() functions on its behalf.
2015-11-24 09:29:22 +01:00
Miroslav Lichvar
55dbbab5eb
configure: check for struct in_pktinfo with ipi_spec_dst
...
On NetBSD there is a struct in_pktinfo, but it doesn't have the
ipi_spec_dst field and it breaks compilation.
2015-10-12 13:41:35 +02:00
Miroslav Lichvar
85f7a4054d
configure: include IPV6_PKTINFO in struct in6_pktinfo check
2015-10-12 13:40:02 +02:00
Miroslav Lichvar
7a3b1414cd
util: add function to get sockaddr family name
2015-07-28 13:11:00 +02:00
Miroslav Lichvar
fdf9640349
ntp: don't log error when socket() fails for client only socket
2015-04-14 15:59:55 +02:00
Miroslav Lichvar
61272e7ce8
update copyright years
2015-04-10 11:06:32 +02:00
Miroslav Lichvar
407e47b306
ntp: remove unnecessary check in read_from_socket()
2015-01-22 15:38:41 +01:00
Miroslav Lichvar
5214d42c07
ntp: count references to NTP server sockets
...
Server sockets are now explicitly opened and closed for normal NTP
server, NTP broadcast and NTP peering. This will allow closing the
NTP port when not needed.
2015-01-06 16:33:49 +01:00
Miroslav Lichvar
6d1dda0fad
ntp: rename NIO_Get*Socket functions
2015-01-05 14:17:21 +01:00
Miroslav Lichvar
8fbfe55e92
ntp: update packet processing to NTPv4 (RFC 5905)
2014-10-14 16:52:22 +02:00
Miroslav Lichvar
c36230e21b
ntp: print number of bytes sent in debug message
2014-10-13 15:10:15 +02:00
Miroslav Lichvar
15d8c08eaa
ntp: enable PKTINFO on client sockets
...
This will be useful to detect synchronization loops.
2014-10-08 15:13:02 +02:00
Miroslav Lichvar
2f738d5805
util: fix sockaddr function naming
2014-10-03 10:15:18 +02:00
Miroslav Lichvar
55a22656b8
util: use common functions to convert to/from sockaddr
2014-09-26 17:54:45 +02:00
Miroslav Lichvar
285fae856d
configure: unify macro naming for optional features
2014-09-22 13:14:16 +02:00
Miroslav Lichvar
e3c77f9b4b
ntp: return with status from functions sending packets
2014-08-20 16:54:26 +02:00
Miroslav Lichvar
9ce25bab04
ntp: add debug message for received packet
2014-08-15 16:51:10 +02:00
Miroslav Lichvar
cd5105b1db
ntp: use NTP instead of echo for presend
...
Switch to NTP for presend as the echo service (RFC 862) is rarely
enabled. When presend is active, send an NTP client packet to the
server/peer and ignore the reply.
This also fixes presend with separate client sockets. The destination
port can't be changed on connected sockets, so the echo packet was sent
to the NTP port instead of the echo port.
2014-08-15 16:49:45 +02:00
Miroslav Lichvar
ff4abc69c3
Check for truncated source address when receiving packets
2014-08-15 16:44:43 +02:00
Miroslav Lichvar
cb88cea3c4
ntp: move packet size asserts to ntp_core
2014-08-15 10:58:52 +02:00
Miroslav Lichvar
d18c071849
ntp: use one socket with random port when acquisitionport is 0
2014-08-15 10:58:44 +02:00
Miroslav Lichvar
97b15cb3ae
ntp: allow binding to address that doesn't exist yet
2014-08-15 10:58:43 +02:00
Miroslav Lichvar
f725921dfb
ntp: remove disabled code in prepare_socket()
2014-08-15 10:58:43 +02:00
Miroslav Lichvar
a4b4d0c0d8
ntp: bind socket only when port or address was specified
...
This removes an unnecessary system call when getting new connected
client socket.
2014-08-15 10:58:43 +02:00
Miroslav Lichvar
f59ade7f80
ntp: remove socket reconnecting
...
As new client socket is now created for each request, there is no need
to reconnect the socket. This is a partial revert of commit 43cca04c
.
2014-08-15 10:58:43 +02:00
Miroslav Lichvar
b7766478a6
ntp: close socket when duplicating fails
2014-08-06 15:25:58 +02:00
Miroslav Lichvar
88015081f2
ntp: shorten setsockopt error messages
2014-08-05 12:57:36 +02:00
Miroslav Lichvar
20cc1f6550
ntp: move debug message after sendmsg()
...
This should reduce the delay before sending the packet when debugging is
enabled.
2014-08-05 12:57:36 +02:00
Miroslav Lichvar
43cca04c33
ntp: reconnect client sockets
...
With separate client sockets, allow the initial connect() to fail (e.g.
when the network is not reachable yet) and try to connect later when
sending the packet.
Also, reconnect the socket when the local address has changed.
2014-08-05 12:57:36 +02:00
Miroslav Lichvar
75efa5174c
Convert disabled log messages to debug or remove them
2014-06-27 10:17:35 +02:00
Miroslav Lichvar
9c6d1c214f
ntp: don't set address for sendmsg() with connected sockets
2014-06-25 15:36:14 +02:00
Miroslav Lichvar
cb74f3e7ad
Update copyright years
2014-06-05 18:06:56 +02:00
Miroslav Lichvar
9913851413
ntp: cook SO_TIMESTAMP timestamp
...
This is a partial revert of 8aa9eb19c8
.
With the new generic driver cooking is cheap and it should be slighly
more accurate than reusing offset correction from the scheduler
timestamps.
2014-06-04 16:58:41 +02:00
Miroslav Lichvar
a646cf7923
logging: convert rate limited messages to debug messages
2014-06-04 12:26:27 +02:00
Miroslav Lichvar
05c5445fe2
conf: add bindacqaddress directive for client sockets
2014-04-03 15:47:32 +02:00
Miroslav Lichvar
f9d8b6f99e
ntp: set only necessary socket options on client sockets
2014-04-03 13:36:25 +02:00
Miroslav Lichvar
91e74c704b
ntp: accept packets from unknown sources only from server sockets
2014-03-26 11:18:18 +01:00
Miroslav Lichvar
b13836e9cc
ntp: don't create server sockets if port is configured to 0
2014-03-25 15:27:18 +01:00
Miroslav Lichvar
cf12d72f21
ntp: use separate connected sockets for each server
...
If acquisitionport is set to 0 (default), create and connect a new
socket for each server instead of using one socket per address family
for all servers.
2014-03-25 15:27:18 +01:00
Miroslav Lichvar
5c2bbaca3b
ntp: use separate client sockets
...
Use separate sockets for NTP server or peer and client packets. The port
number is configured by the acquisitionport directive. With the default
value of 0 the port is assigned randomly by the kernel. It can be equal
to the value configured by the port directive to use the server sockets
for all packets as before.
2014-03-25 15:25:23 +01:00
Miroslav Lichvar
9a657cd4a3
ntp: store socket in NTP instance
...
This is preparation for separate client sockets.
2014-03-25 15:22:59 +01:00
Miroslav Lichvar
308de81221
ntp: split local_ip_addr from NTP_Remote_Address struct
2014-03-25 11:34:35 +01:00