]> git.ipfire.org Git - thirdparty/chrony.git/commit - main.c
socket: add support for systemd sockets
authorLuke Valenta <lvalenta@cloudflare.com>
Thu, 26 Oct 2023 16:48:56 +0000 (12:48 -0400)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 13 Nov 2023 16:05:26 +0000 (17:05 +0100)
commite6a0476eb721d31b41632ed3a26e0368eb1206a5
tree95bbb8ccb82b3694dd921a736cfd0759024a6fa9
parentc063b9e78aaeba673d83e98861acc71dd0233a20
socket: add support for systemd sockets

Before opening new IPv4/IPv6 server sockets, chronyd will check for
matching reusable sockets passed from the service manager (for example,
passed via systemd socket activation:
https://www.freedesktop.org/software/systemd/man/latest/sd_listen_fds.html)
and use those instead.

Aside from IPV6_V6ONLY (which cannot be set on already-bound sockets),
the daemon sets the same socket options on reusable sockets as it would
on sockets it opens itself.

Unit tests test the correct parsing of the LISTEN_FDS environment
variable.

Add 011-systemd system test to test socket activation for DGRAM and
STREAM sockets (both IPv4 and IPv6).  The tests use the
systemd-socket-activate test tool, which has some limitations requiring
workarounds discussed in inline comments.
doc/chronyd.adoc
main.c
socket.c
socket.h
test/system/011-systemd [new file with mode: 0755]
test/system/test.common
test/unit/socket.c [new file with mode: 0644]