From bd1ee3efb46ae013d81b1aec51668e7595274e69 Mon Sep 17 00:00:00 2001 From: Linus Lüssing Date: Sat, 5 Mar 2016 23:53:52 +0100 Subject: bridge: multicast: Export some parameters RFCs suggest to be tunable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RFCs suggest some parameters of IGMP and MLD to be configurable by the administrator. With this patch the following parameters are configurable: * robustness (default: 2) * query_interval (default: 12500 [125s]) * query_response_interval (default: 1000 [10s]) * last_member_interval (default: 100 [1s]) Depending on the size and nature of the network topology administrators might want to increase or decrease these parameters. netifd will take care of configuring any other parameters which are dependant on the ones above and set them according to the formulas provided in the RFCs. These parameters of the bridge are membership_interval, querier_interval, startup_query_interval, startup_query_count and last_member_count. RFCs allow setting three more parameters to be configurable: startup_query_interval, startup_query_count and last_member_count. However this patch does not export them, as they can be indirectly tuned via the given, exported four parameters, too. Signed-off-by: Linus Lüssing --- bridge.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'bridge.c') diff --git a/bridge.c b/bridge.c index 4a0cbe9..1c163cd 100644 --- a/bridge.c +++ b/bridge.c @@ -34,6 +34,10 @@ enum { BRIDGE_ATTR_BRIDGE_EMPTY, BRIDGE_ATTR_MULTICAST_QUERIER, BRIDGE_ATTR_HASH_MAX, + BRIDGE_ATTR_ROBUSTNESS, + BRIDGE_ATTR_QUERY_INTERVAL, + BRIDGE_ATTR_QUERY_RESPONSE_INTERVAL, + BRIDGE_ATTR_LAST_MEMBER_INTERVAL, __BRIDGE_ATTR_MAX }; @@ -49,6 +53,10 @@ static const struct blobmsg_policy bridge_attrs[__BRIDGE_ATTR_MAX] = { [BRIDGE_ATTR_BRIDGE_EMPTY] = { "bridge_empty", BLOBMSG_TYPE_BOOL }, [BRIDGE_ATTR_MULTICAST_QUERIER] = { "multicast_querier", BLOBMSG_TYPE_BOOL }, [BRIDGE_ATTR_HASH_MAX] = { "hash_max", BLOBMSG_TYPE_INT32 }, + [BRIDGE_ATTR_ROBUSTNESS] = { "robustness", BLOBMSG_TYPE_INT32 }, + [BRIDGE_ATTR_QUERY_INTERVAL] = { "query_interval", BLOBMSG_TYPE_INT32 }, + [BRIDGE_ATTR_QUERY_RESPONSE_INTERVAL] = { "query_response_interval", BLOBMSG_TYPE_INT32 }, + [BRIDGE_ATTR_LAST_MEMBER_INTERVAL] = { "last_member_interval", BLOBMSG_TYPE_INT32 }, }; static const struct uci_blob_param_info bridge_attr_info[__BRIDGE_ATTR_MAX] = { @@ -553,6 +561,10 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb) cfg->forward_delay = 2; cfg->igmp_snoop = true; cfg->multicast_querier = true; + cfg->robustness = 2; + cfg->query_interval = 12500; + cfg->query_response_interval = 1000; + cfg->last_member_interval = 100; cfg->hash_max = 512; cfg->bridge_empty = false; cfg->priority = 0x7FFF; @@ -575,6 +587,26 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb) if ((cur = tb[BRIDGE_ATTR_HASH_MAX])) cfg->hash_max = blobmsg_get_u32(cur); + if ((cur = tb[BRIDGE_ATTR_ROBUSTNESS])) { + cfg->robustness = blobmsg_get_u32(cur); + cfg->flags |= BRIDGE_OPT_ROBUSTNESS; + } + + if ((cur = tb[BRIDGE_ATTR_QUERY_INTERVAL])) { + cfg->query_interval = blobmsg_get_u32(cur); + cfg->flags |= BRIDGE_OPT_QUERY_INTERVAL; + } + + if ((cur = tb[BRIDGE_ATTR_QUERY_RESPONSE_INTERVAL])) { + cfg->query_response_interval = blobmsg_get_u32(cur); + cfg->flags |= BRIDGE_OPT_QUERY_RESPONSE_INTERVAL; + } + + if ((cur = tb[BRIDGE_ATTR_LAST_MEMBER_INTERVAL])) { + cfg->last_member_interval = blobmsg_get_u32(cur); + cfg->flags |= BRIDGE_OPT_LAST_MEMBER_INTERVAL; + } + if ((cur = tb[BRIDGE_ATTR_AGEING_TIME])) { cfg->ageing_time = blobmsg_get_u32(cur); cfg->flags |= BRIDGE_OPT_AGEING_TIME; -- cgit v1.2.3