wireless: add support for global up/down command
authorFelix Fietkau <nbd@openwrt.org>
Fri, 29 Nov 2013 14:54:02 +0000 (15:54 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 29 Nov 2013 14:54:06 +0000 (15:54 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ubus.c

diff --git a/ubus.c b/ubus.c
index d8c6a4fe411c334a6ddf6d92ac8ca368d3d641a3..e563e1f5f56069e6a9f762c94ad6886cd3784795 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -983,10 +983,16 @@ netifd_handle_wdev_up(struct ubus_context *ctx, struct ubus_object *obj,
        int ret;
 
        wdev = get_wdev(msg, &ret);
-       if (!wdev)
+       if (ret == UBUS_STATUS_NOT_FOUND)
                return ret;
 
-       wireless_device_set_up(wdev);
+       if (wdev) {
+               wireless_device_set_up(wdev);
+       } else {
+               vlist_for_each_element(&wireless_devices, wdev, node)
+                       wireless_device_set_up(wdev);
+       }
+
        return 0;
 }
 
@@ -999,10 +1005,16 @@ netifd_handle_wdev_down(struct ubus_context *ctx, struct ubus_object *obj,
        int ret;
 
        wdev = get_wdev(msg, &ret);
-       if (!wdev)
+       if (ret == UBUS_STATUS_NOT_FOUND)
                return ret;
 
-       wireless_device_set_down(wdev);
+       if (wdev) {
+               wireless_device_set_down(wdev);
+       } else {
+               vlist_for_each_element(&wireless_devices, wdev, node)
+                       wireless_device_set_down(wdev);
+       }
+
        return 0;
 }