Use the rtnl_get_ts_device() function to get the name of the slave
interface which will be timestamping PTP packets and use it instead of
the master interface to check the timestamping capabilities and PHC.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
When an interface doesn't support HW time stamping, before falling back
to SW time stamping, check if it's actually supported and exit with an
error message if not.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Use the new options of ptp4l and phc2sys to tag their log messages with
the PTP domain number and name(s) of interface(s) in the domain.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Assume only the chronyd or ntpd process is essential for synchronization
of the system clock and ignore SIGCHLD from other processes. This should
provide resiliency against possible bugs in ptp4l or phc2sys that can
terminate the processes.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
This allows using a sequence of SHM segments that starts with a number
larger than zero, which can be useful to avoid conflicts with time
sources that are not started by timemaster, e.g. gpsd using segments
number 0 and 1.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Instead of trying to support all options of the server and refclock
directives in both NTP implementations, add an "ntp_options" option
which specifies a string that is added directly to the lines in the
chronyd/ntpd configuration file.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Instead of killing the whole process group, which may contain other
processes than timemaster and its children (e.g. when it is started from
a shell script), save the PIDs and kill the processes individually.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
In ntp-4.2.8p1 the segment access was made configurable with the
refclock mode option. Set the mode to 1 to create all SHM segments
with owner-only access.
timemaster is a program that uses ptp4l and phc2sys in combination with
chronyd or ntpd to synchronize the system clock to NTP and PTP time
sources. The PTP time is provided by phc2sys and ptp4l via SHM reference
clocks to chronyd/ntpd, which can compare all time sources and use the
best sources to synchronize the system clock.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>