From b1ce06206fa584a2dcc6fd997e07d89f85cc814e Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Thu, 5 Apr 2018 12:09:08 -0700 Subject: [PATCH] port: Introduce an option to disable mutlicast service. Some profiles forbid multicast altogther. Signed-off-by: Richard Cochran --- 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 57d5f4f..7914ba4 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 fea60db..e85f9fa 100644 --- a/port.c +++ b/port.c @@ -1329,6 +1329,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; } @@ -1395,6 +1398,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 df6cb72..19d1d7b 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 d084711..ad0e06a 100644 --- a/unicast_service.c +++ b/unicast_service.c @@ -417,6 +417,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; }