mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
ntp: update NTP-over-PTP support
Following the latest version of the draft, accept NTP messages in both PTPv2 and PTPv2.1 messages, accept sync messages in addition to delay request messages, and check the minorSdoId field in PTPv2.1 messages. Transmitted messages are still PTPv2 delay requests. Don't switch to the organization-specific TLV yet. Wait for the NTP TLV subtype and Network Correction extension field to be assigned by IANA to avoid an additional break in compatibility.
This commit is contained in:
6
ntp_io.c
6
ntp_io.c
@@ -513,7 +513,9 @@ NIO_UnwrapMessage(SCK_Message *message, int sock_fd, double *net_correction)
|
||||
|
||||
msg = message->data;
|
||||
|
||||
if (msg->header.type != PTP_TYPE_DELAY_REQ || msg->header.version != PTP_VERSION ||
|
||||
if ((msg->header.type != PTP_TYPE_DELAY_REQ && msg->header.type != PTP_TYPE_SYNC) ||
|
||||
(msg->header.version != PTP_VERSION_2 &&
|
||||
(msg->header.version != PTP_VERSION_2_1 || msg->header.min_sdoid != 0)) ||
|
||||
ntohs(msg->header.length) != message->length ||
|
||||
msg->header.domain != PTP_DOMAIN_NTP ||
|
||||
ntohs(msg->header.flags) != PTP_FLAG_UNICAST ||
|
||||
@@ -561,7 +563,7 @@ wrap_message(SCK_Message *message, int sock_fd)
|
||||
|
||||
memset(ptp_message, 0, PTP_NTP_PREFIX_LENGTH);
|
||||
ptp_message->header.type = PTP_TYPE_DELAY_REQ;
|
||||
ptp_message->header.version = PTP_VERSION;
|
||||
ptp_message->header.version = PTP_VERSION_2;
|
||||
ptp_message->header.length = htons(PTP_NTP_PREFIX_LENGTH + message->length);
|
||||
ptp_message->header.domain = PTP_DOMAIN_NTP;
|
||||
ptp_message->header.flags = htons(PTP_FLAG_UNICAST);
|
||||
|
||||
Reference in New Issue
Block a user