From 1488a64acb77f721fc10d90b0453d95b488460e1 Mon Sep 17 00:00:00 2001 From: Linus Lüssing Date: Sun, 23 Aug 2015 17:19:27 +0200 Subject: bridge: Allow setting multicast_to_unicast option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this patch the multicast_to_unicast feature can be disabled for all wireless interfaces via an according option on the uci bridge interface. This patch also exports the setting information to wireless handler scripts. The hostapd script will need that information to determine whether to enable or disable ap-isolation, for instance. Signed-off-by: Linus Lüssing --- system-linux.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'system-linux.c') diff --git a/system-linux.c b/system-linux.c index 9c4bea6..944245c 100644 --- a/system-linux.c +++ b/system-linux.c @@ -567,14 +567,19 @@ static char *system_get_bridge(const char *name, char *buf, int buflen) } static void -system_bridge_set_wireless(struct device *dev) +system_bridge_set_wireless(struct device *bridge, struct device *dev) { + bool mcast_to_ucast = true; bool hairpin = true; - if (dev->wireless_isolate) + if (bridge->settings.flags & DEV_OPT_MULTICAST_TO_UNICAST && + !bridge->settings.multicast_to_unicast) + mcast_to_ucast = false; + + if (!mcast_to_ucast || dev->wireless_isolate) hairpin = false; - system_bridge_set_multicast_to_unicast(dev, "1"); + system_bridge_set_multicast_to_unicast(dev, mcast_to_ucast ? "1" : "0"); system_bridge_set_hairpin_mode(dev, hairpin ? "1" : "0"); } @@ -588,7 +593,7 @@ int system_bridge_addif(struct device *bridge, struct device *dev) ret = system_bridge_if(bridge->ifname, dev, SIOCBRADDIF, NULL); if (dev->wireless) - system_bridge_set_wireless(dev); + system_bridge_set_wireless(bridge, dev); return ret; } -- cgit v1.2.3