diff options
author | Linus Lüssing <linus.luessing@c0d3.blue> | 2015-08-23 17:19:27 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-08-25 08:46:30 +0200 |
commit | 1488a64acb77f721fc10d90b0453d95b488460e1 (patch) | |
tree | d3a3849cfc1d0cbfc467dba7b3ee7fff7e56282e /system-linux.c | |
parent | 827145f01d849c663f18e356157fd71f1a7cc45d (diff) |
bridge: Allow setting multicast_to_unicast option
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 <linus.luessing@c0d3.blue>
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 13 |
1 files changed, 9 insertions, 4 deletions
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; } |