From 99fd08425371b3112413c4baa4bc9542fbc02d0d Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Wed, 14 Feb 2018 09:29:55 -0800 Subject: [PATCH] Introduce an option to ignore the transport specific field. Up until now the transportSpecific field has been treated according to 802.1AS, namely as a field that must match exactly on receive. However, 1588 mandates ignoring this field for some transports, and there is equipment in the wild that does in fact set the reserved bits. This patch adds an option to ignore the field on receive completely. Signed-off-by: Richard Cochran Reported-by: Petr Kulhavy --- config.c | 1 + port.c | 5 ++++- ptp4l.8 | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/config.c b/config.c index 56d1556..86ea354 100644 --- a/config.c +++ b/config.c @@ -192,6 +192,7 @@ struct config_item config_tab[] = { PORT_ITEM_INT("freq_est_interval", 1, 0, INT_MAX), GLOB_ITEM_INT("gmCapable", 1, 0, 1), PORT_ITEM_INT("hybrid_e2e", 0, 0, 1), + PORT_ITEM_INT("ignore_transport_specific", 0, 0, 1), PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX), GLOB_ITEM_INT("initial_delay", 0, 0, INT_MAX), GLOB_ITEM_INT("kernel_leap", 1, 0, 1), diff --git a/port.c b/port.c index 6cc5dd0..c69363c 100644 --- a/port.c +++ b/port.c @@ -125,6 +125,7 @@ struct port { int follow_up_info; int freq_est_interval; int hybrid_e2e; + int match_transport_specific; int min_neighbor_prop_delay; int path_trace_enabled; int rx_timestamp_offset; @@ -641,7 +642,8 @@ static int port_ignore(struct port *p, struct ptp_message *m) if (path_trace_ignore(p, m)) { return 1; } - if (msg_transport_specific(m) != p->transportSpecific) { + if (p->match_transport_specific && + msg_transport_specific(m) != p->transportSpecific) { return 1; } if (pid_eq(&m->header.sourcePortIdentity, &p->portIdentity)) { @@ -1489,6 +1491,7 @@ static int port_initialize(struct port *p) p->syncReceiptTimeout = config_get_int(cfg, p->name, "syncReceiptTimeout"); p->transportSpecific = config_get_int(cfg, p->name, "transportSpecific"); p->transportSpecific <<= 4; + p->match_transport_specific = !config_get_int(cfg, p->name, "ignore_transport_specific"); p->logSyncInterval = config_get_int(cfg, p->name, "logSyncInterval"); p->logMinPdelayReqInterval = config_get_int(cfg, p->name, "logMinPdelayReqInterval"); p->neighborPropDelayThresh = config_get_int(cfg, p->name, "neighborPropDelayThresh"); diff --git a/ptp4l.8 b/ptp4l.8 index 4cf0b0c..9a7701d 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -176,6 +176,14 @@ The default is 0 or disabled. The transport specific field. Must be in the range 0 to 255. The default is 0. .TP +.B ignore_transport_specific +By default, incoming messages are dropped if their transportSpecific +field does not match the configured value. However, many of +transports specified in the 1588 standard mandate ignoring this field. +Moreover, some equipment is known to set the reserved bits. +Configuring this option as 1 causes this field to be ignored +completely on receive. The default is 0. +.TP .B path_trace_enabled Enable the mechanism used to trace the route of the Announce messages. The default is 0 (disabled).