The "unbridge" function in /lib/network/config.sh is not implemented, as
a result; when "wifi down" is executed, the wireless interfaces remain
attached to the bridge (broadcom-wl).  This patches is an attempt at an
implementation that works for me; but definitely needs a good review,
or even a different approach.  Is there a reason why "unbridge" is
not implemented?

Signed-off-by: Nathan Hintz <[email protected]>

Index: package/network/config/netifd/files/lib/network/config.sh
===================================================================
--- package/network/config/netifd/files/lib/network/config.sh   (revision 35569)
+++ package/network/config/netifd/files/lib/network/config.sh   (working copy)
@@ -12,7 +12,7 @@
                        json_load "$(ifstatus $interface)"
                        json_get_var ifdev device
                        json_get_var ifl3dev l3_device
-                       if [[ "$device" = "$ifdev" ]] || [[ "$device" = 
"$ifl3dev" ]]; then
+                       if [ "$device" = "$ifdev" -o "$device" = "$ifl3dev" ]; 
then
                                echo "$interface"
                                exit 0
                        else
@@ -23,7 +23,19 @@
 }
 
 unbridge() {
-       return
+       local device="$1"
+       local ifdev ifl3dev ifobj
+       for ifobj in `ubus list network.interface.\*`; do
+               interface="${ifobj##network.interface.}"
+               if [ -n "$interface" ]; then
+                       json_load "$(ifstatus $interface)"
+                       json_get_var ifdev device
+                       json_get_var ifl3dev l3_device
+                       if [ "$ifdev" != "${ifdev##br-}" -o "$ifl3dev" != 
"${ifl3dev##br-}" ]; then
+                               ubus call network.interface."$interface" 
remove_device "{ \"name\": \"$device\" }" >/dev/null 2>&1
+                       fi
+               fi
+       done
 }
 
 ubus_call() {

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to