[OpenWrt-Devel] [PATCH openwrt 1/3] hostapd: Always isolate if brport->multicast_to_unicast is enabled

Linus Lüssing linus.luessing at c0d3.blue
Thu Jun 18 11:23:01 EDT 2015


For the multicast-to-unicast feature of a bridge to function correctly,
it is necessary that all STAs are always isolated on the AP level. The
bridge will take care of reflecting packets back to the AP interface
if necessary and/or no STA isolation wanted by using the hairpin feature
of the bridge.

Signed-off-by: Linus Lüssing <linus.luessing at c0d3.blue>
---
 package/network/services/hostapd/files/netifd.sh |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh
index 23d2e7e..74b2d02 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -1,3 +1,6 @@
+. /lib/network/config.sh
+. /lib/config/uci.sh
+
 wpa_supplicant_add_rate() {
 	local var="$1"
 	local val="$(($2 / 1000))"
@@ -176,6 +179,9 @@ hostapd_set_bss_options() {
 	local bss_conf
 	local wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wpa_key_mgmt
 
+	local bridge_section=""
+	local mcast_to_ucast="1"
+
 	json_get_vars \
 		wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey \
 		maxassoc max_inactivity disassoc_low_ack isolate auth_cache \
@@ -193,9 +199,18 @@ hostapd_set_bss_options() {
 	set_default wmm 1
 	set_default uapsd 1
 
+	if [ -n "$network_bridge" ]; then
+		bridge_section="$(find_config $network_bridge)"
+	fi
+	if [ -n "$bridge_section" ]; then
+		mcast_to_ucast="$(uci_get_state network $bridge_section mcast_to_ucast 1)"
+	fi
+
 	append bss_conf "ctrl_interface=/var/run/hostapd"
 	if [ "$isolate" -gt 0 ]; then
 		append bss_conf "ap_isolate=$isolate" "$N"
+	elif [ -n "$bridge_section" -a $mcast_to_ucast -gt 0 ]; then
+		append bss_conf "ap_isolate=1" "$N"
 	fi
 	if [ "$maxassoc" -gt 0 ]; then
 		append bss_conf "max_num_sta=$maxassoc" "$N"
-- 
1.7.10.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list