bridge: Fix multicast_to_unicast feature by hairpin+isolate
[project/netifd.git] / scripts / netifd-wireless.sh
index 3cb55a3..f981f1b 100644 (file)
@@ -248,12 +248,16 @@ wireless_vif_parse_encryption() {
        esac
 }
 
-_get_vif_vars() {
-       # internal use
-       json_get_var _w_type mode
+_wireless_set_brsnoop_isolation() {
+       local multicast_to_unicast="$1"
+       local isolate
 
-       # for drivers
-       json_get_var network_bridge bridge
+       json_get_var isolate isolate
+
+       [ $isolate -gt 0 -o -z "$network_bridge" ] && return
+
+       [ -z "$multicast_to_unicast" ] && multicast_to_unicast=1
+       [ $multicast_to_unicast -gt 0 ] && json_add_boolean isolate 1
 }
 
 for_each_interface() {
@@ -262,13 +266,17 @@ for_each_interface() {
        local _w_type
        local _w_found
 
+       local multicast_to_unicast
+
        json_get_keys _w_ifaces interfaces
        json_select interfaces
        for _w_iface in $_w_ifaces; do
                json_select "$_w_iface"
                if [ -n "$_w_types" ]; then
+                       json_get_var network_bridge bridge
                        json_select config
-                       _get_vif_vars
+                       _wireless_set_brsnoop_isolation "$multicast_to_unicast"
+                       json_get_var _w_type mode
                        json_select ..
                        _w_types=" $_w_types "
                        [[ "${_w_types%$_w_type*}" = "$_w_types" ]] && {
@@ -287,7 +295,7 @@ _wdev_common_device_config() {
 }
 
 _wdev_common_iface_config() {
-       config_add_string mode ssid encryption key
+       config_add_string mode ssid encryption 'key:wpakey'
 }
 
 init_wireless_driver() {