bridge: allow enabling or disabling the multicast querier independently of IGMP snooping
authorMatthias Schiffer <mschiffer@universe-factory.net>
Tue, 27 Jan 2015 02:49:52 +0000 (03:49 +0100)
committerJohn Crispin <blogic@openwrt.org>
Mon, 23 Mar 2015 06:50:21 +0000 (07:50 +0100)
In larger networks, especially big batman-adv meshes, it may be desirable to
enable IGMP snooping on every bridge without enabling the multicast querier
to specifically put the querier on a well-connected node.

This patch adds a new UCI option 'multicast_querier' for bridges which allows
this. The default is still the value of the 'igmp_snooping' option to maintain
backwards compatiblity.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
bridge.c
system-linux.c
system.h

index 7076fd7f4bcb1b3e93ca7cfa54039c03dcb2b7ae..c5e17a4b5c61237295445ffbf02ba5de02b996a4 100644 (file)
--- a/bridge.c
+++ b/bridge.c
@@ -32,6 +32,7 @@ enum {
        BRIDGE_ATTR_HELLO_TIME,
        BRIDGE_ATTR_MAX_AGE,
        BRIDGE_ATTR_BRIDGE_EMPTY,
+       BRIDGE_ATTR_MULTICAST_QUERIER,
        __BRIDGE_ATTR_MAX
 };
 
@@ -45,6 +46,7 @@ static const struct blobmsg_policy bridge_attrs[__BRIDGE_ATTR_MAX] = {
        [BRIDGE_ATTR_MAX_AGE] = { "max_age", BLOBMSG_TYPE_INT32 },
        [BRIDGE_ATTR_IGMP_SNOOP] = { "igmp_snooping", BLOBMSG_TYPE_BOOL },
        [BRIDGE_ATTR_BRIDGE_EMPTY] = { "bridge_empty", BLOBMSG_TYPE_BOOL },
+       [BRIDGE_ATTR_MULTICAST_QUERIER] = { "multicast_querier", BLOBMSG_TYPE_BOOL },
 };
 
 static const struct uci_blob_param_info bridge_attr_info[__BRIDGE_ATTR_MAX] = {
@@ -548,6 +550,7 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb)
        cfg->stp = false;
        cfg->forward_delay = 2;
        cfg->igmp_snoop = true;
+       cfg->multicast_querier = true;
        cfg->bridge_empty = false;
        cfg->priority = 0x7FFF;
 
@@ -561,7 +564,10 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb)
                cfg->priority = blobmsg_get_u32(cur);
 
        if ((cur = tb[BRIDGE_ATTR_IGMP_SNOOP]))
-               cfg->igmp_snoop = blobmsg_get_bool(cur);
+               cfg->multicast_querier = cfg->igmp_snoop = blobmsg_get_bool(cur);
+
+       if ((cur = tb[BRIDGE_ATTR_MULTICAST_QUERIER]))
+               cfg->multicast_querier = blobmsg_get_bool(cur);
 
        if ((cur = tb[BRIDGE_ATTR_AGEING_TIME])) {
                cfg->ageing_time = blobmsg_get_u32(cur);
index 7a443adeb183736588d1fe2b25998650c0f63e42..2b52cea73bd368f83622c854759af85f6f1966dd 100644 (file)
@@ -799,7 +799,7 @@ int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg)
                bridge->ifname, cfg->igmp_snoop ? "1" : "0");
 
        system_set_dev_sysctl("/sys/devices/virtual/net/%s/bridge/multicast_querier",
-               bridge->ifname, cfg->igmp_snoop ? "1" : "0");
+               bridge->ifname, cfg->multicast_querier ? "1" : "0");
 
        args[0] = BRCTL_SET_BRIDGE_PRIORITY;
        args[1] = cfg->priority;
index 9a2326bb3bf67915ed083fcddd699873e856297d..94e0dd9f964ffc0f22c4ca63a8d588756a3b3643 100644 (file)
--- a/system.h
+++ b/system.h
@@ -50,6 +50,7 @@ struct bridge_config {
        enum bridge_opt flags;
        bool stp;
        bool igmp_snoop;
+       bool multicast_querier;
        unsigned short priority;
        int forward_delay;
        bool bridge_empty;