Some network operators consider that the PTP messages must never be forwarded 
through PTP-unaware network equipment. The use of the non-forwardable multicast 
address 01-80-C2-00-00-0E guarantees this property most of the time (exceptions 
exist for some older Ethernet equipment).

Signed-off-by: Anders Selhammer <anders.selham...@est.tech>
---
 config.c       | 1 +
 port.c         | 3 +++
 port_private.h | 1 +
 3 files changed, 5 insertions(+)

diff --git a/config.c b/config.c
index 2321310..ec8f220 100644
--- a/config.c
+++ b/config.c
@@ -261,6 +261,7 @@ struct config_item config_tab[] = {
        PORT_ITEM_INT("neighborPropDelayThresh", 20000000, 0, INT_MAX),
        PORT_ITEM_INT("net_sync_monitor", 0, 0, 1),
        PORT_ITEM_ENU("network_transport", TRANS_UDP_IPV4, nw_trans_enu),
+       PORT_ITEM_INT("non_forwardable", 0, 0, 1),
        GLOB_ITEM_INT("ntpshm_segment", 0, INT_MIN, INT_MAX),
        GLOB_ITEM_INT("offsetScaledLogVariance", 0xffff, 0, UINT16_MAX),
        PORT_ITEM_INT("path_trace_enabled", 0, 0, 1),
diff --git a/port.c b/port.c
index 142b970..ef58bbd 100644
--- a/port.c
+++ b/port.c
@@ -2664,6 +2664,8 @@ int port_prepare_and_send(struct port *p, struct 
ptp_message *msg,
        }
        if (msg_unicast(msg)) {
                cnt = transport_sendto(p->trp, &p->fda, event, msg);
+       } else if (p->non_forwardable) {
+               cnt = transport_peer(p->trp, &p->fda, event, msg);
        } else {
                cnt = transport_send(p->trp, &p->fda, event, msg);
        }
@@ -2986,6 +2988,7 @@ struct port *port_open(int phc_index,
        if (p->net_sync_monitor && !p->hybrid_e2e) {
                pr_warning("port %d: net_sync_monitor needs hybrid_e2e", 
number);
        }
+       p->non_forwardable = config_get_int(cfg, p->name, "non_forwardable");
 
        /* Set fault timeouts to a default value */
        for (i = 0; i < FT_CNT; i++) {
diff --git a/port_private.h b/port_private.h
index 593eb76..aea588e 100644
--- a/port_private.h
+++ b/port_private.h
@@ -89,6 +89,7 @@ struct port {
                UInteger16 sync;
        } seqnum;
        tmv_t peer_delay;
+       int non_forwardable;
        struct tsproc *tsproc;
        int log_sync_interval;
        struct nrate_estimator nrate;
-- 
1.8.3.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to