mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-06 22:55:06 -05:00
ntp: add support for NTP over PTP
Allow NTP messages to be exchanged as a payload of PTP messages to enable full hardware timestamping on NICs that can timestamp PTP packets only. Implemented is the protocol described in this draft (version 00): https://datatracker.ietf.org/doc/draft-mlichvar-ntp-over-ptp/ This is an experimental feature. It can be changed or removed in future. The used PTP domain is 123 and the NTP TLV type is 0x2023 from the "do not propagate" experimental range. The ptpport directive enables NTP-over-PTP as a server and as a client for all sources that have the port option set to the PTP port. The port should be the PTP event port (319) to trigger timestamping in the hardware. The implementation is contained to ntp_io. It is transparent to ntp_core.
This commit is contained in:
13
conf.c
13
conf.c
@@ -273,6 +273,9 @@ static int no_system_cert = 0;
|
||||
/* Array of CNF_HwTsInterface */
|
||||
static ARR_Instance hwts_interfaces;
|
||||
|
||||
/* PTP event port (disabled by default) */
|
||||
static int ptp_port = 0;
|
||||
|
||||
typedef struct {
|
||||
NTP_Source_Type type;
|
||||
int pool;
|
||||
@@ -686,6 +689,8 @@ CNF_ParseLine(const char *filename, int number, char *line)
|
||||
parse_source(p, command, 1);
|
||||
} else if (!strcasecmp(command, "port")) {
|
||||
parse_int(p, &ntp_port);
|
||||
} else if (!strcasecmp(command, "ptpport")) {
|
||||
parse_int(p, &ptp_port);
|
||||
} else if (!strcasecmp(command, "ratelimit")) {
|
||||
parse_ratelimit(p, &ntp_ratelimit_enabled, &ntp_ratelimit_interval,
|
||||
&ntp_ratelimit_burst, &ntp_ratelimit_leak);
|
||||
@@ -2561,6 +2566,14 @@ CNF_GetHwTsInterface(unsigned int index, CNF_HwTsInterface **iface)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
int
|
||||
CNF_GetPtpPort(void)
|
||||
{
|
||||
return ptp_port;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
char *
|
||||
CNF_GetNtsDumpDir(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user