Commit Graph

13 Commits (master)

Author SHA1 Message Date
Miroslav Lichvar d663a483c4 Fix building with new kernel headers.
net_tstamp.h in recent kernel versions requires time.h for clockid_t.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2019-01-06 19:56:25 -08:00
Miroslav Lichvar 78a720f2b3 timemaster: Allow ptp4l-specific sections in [ptp4l.conf].
Remove > from beginning of lines specified in the *.conf sections in
order to allow a ptp4l-specific section (e.g. [unicast_master_table]) to
be included there.

After inserting the lines to the generated ptp4l.conf, switch back to
the [global] section.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2018-09-30 18:54:31 -07:00
Miroslav Lichvar e79e5040a0 timemaster: restart terminated processes.
If a ptp4l or phc2sys process is terminated (e.g. due to a crash) and
timemaster was running for at least one second (i.e. it's not an error
in ptp4l/phc2sys configuration), start the process again. Restart all
processes corresponding to the same time source at the same time to
ensure phc2sys is always connected to the currently running ptp4l.

Add a new option to disable the restarting.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2018-04-19 07:41:11 -07:00
Miroslav Lichvar e5ba2dae5f timemaster: add support for bonded interfaces.
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>
2018-04-19 07:41:11 -07:00
Miroslav Lichvar 117ed5c2d0 timemaster: check support for SW time stamping.
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>
2017-02-05 16:44:48 +01:00
Miroslav Lichvar e54158195b timemaster: tag ptp4l and phc2sys messages.
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>
2017-02-05 16:44:48 +01:00
Miroslav Lichvar 914ca86b37 timemaster: ignore failures of non-essential processes.
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>
2016-07-16 21:03:59 +02:00
Miroslav Lichvar 395544d117 timemaster: add option to specify first SHM segment.
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>
2016-07-16 21:03:59 +02:00
Miroslav Lichvar ac77099493 timemaster: allow arbitrary options in server/refclock directives.
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>
2016-07-16 21:03:59 +02:00
Miroslav Lichvar f44178476b timemaster: use wrapped memory allocation functions. 2015-08-29 10:33:35 +02:00
Miroslav Lichvar 0ee9b9000f timemaster: kill processes by PID instead of process group.
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>
2015-05-14 15:08:31 +02:00
Miroslav Lichvar e9ac26f909 timemaster: set mode in ntp config to create private SHM segments.
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.
2015-02-09 22:03:39 +01:00
Miroslav Lichvar 82f13c594a Add timemaster.
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>
2014-10-03 14:25:19 +02:00