Some profiles forbid multicast altogther.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 config.c            | 1 +
 configs/default.cfg | 1 +
 port.c              | 6 ++++++
 port_private.h      | 1 +
 unicast_service.c   | 2 ++
 5 files changed, 11 insertions(+)

diff --git a/config.c b/config.c
index 15cf5c5..dc9f9eb 100644
--- a/config.c
+++ b/config.c
@@ -218,6 +218,7 @@ struct config_item config_tab[] = {
        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),
+       PORT_ITEM_INT("inhibit_multicast_service", 0, 0, 1),
        GLOB_ITEM_INT("initial_delay", 0, 0, INT_MAX),
        GLOB_ITEM_INT("kernel_leap", 1, 0, 1),
        PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX),
diff --git a/configs/default.cfg b/configs/default.cfg
index 00ec61f..c5a8b57 100644
--- a/configs/default.cfg
+++ b/configs/default.cfg
@@ -39,6 +39,7 @@ logging_level         6
 path_trace_enabled     0
 follow_up_info         0
 hybrid_e2e             0
+inhibit_multicast_service      0
 net_sync_monitor       0
 tc_spanning_tree       0
 tx_timestamp_timeout   1
diff --git a/port.c b/port.c
index 8cc1641..9e3454b 100644
--- a/port.c
+++ b/port.c
@@ -1333,6 +1333,9 @@ int port_tx_announce(struct port *p, struct address *dst)
        struct ptp_message *msg;
        int err;
 
+       if (p->inhibit_multicast_service && !dst) {
+               return 0;
+       }
        if (!port_capable(p)) {
                return 0;
        }
@@ -1399,6 +1402,9 @@ int port_tx_sync(struct port *p, struct address *dst)
                return -1;
        }
 
+       if (p->inhibit_multicast_service && !dst) {
+               return 0;
+       }
        if (!port_capable(p)) {
                return 0;
        }
diff --git a/port_private.h b/port_private.h
index b876b86..4a122f4 100644
--- a/port_private.h
+++ b/port_private.h
@@ -137,6 +137,7 @@ struct port {
        struct unicast_master_table *unicast_master_table;
        /* unicast service mode */
        struct unicast_service *unicast_service;
+       int inhibit_multicast_service;
 };
 
 #define portnum(p) (p->portIdentity.portNumber)
diff --git a/unicast_service.c b/unicast_service.c
index 09e0eac..220a738 100644
--- a/unicast_service.c
+++ b/unicast_service.c
@@ -418,6 +418,8 @@ int unicast_service_initialize(struct port *p)
                free(p->unicast_service);
                return -1;
        }
+       p->inhibit_multicast_service =
+               config_get_int(cfg, p->name, "inhibit_multicast_service");
 
        return 0;
 }
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to