aboutsummaryrefslogtreecommitdiff
path: root/package/network/services/hostapd/files/wpa_supplicant.uc
diff options
context:
space:
mode:
Diffstat (limited to 'package/network/services/hostapd/files/wpa_supplicant.uc')
-rw-r--r--package/network/services/hostapd/files/wpa_supplicant.uc27
1 files changed, 26 insertions, 1 deletions
diff --git a/package/network/services/hostapd/files/wpa_supplicant.uc b/package/network/services/hostapd/files/wpa_supplicant.uc
index 412f87b4b1..6308fd54e2 100644
--- a/package/network/services/hostapd/files/wpa_supplicant.uc
+++ b/package/network/services/hostapd/files/wpa_supplicant.uc
@@ -11,6 +11,9 @@ function iface_stop(iface)
{
let ifname = iface.config.iface;
+ if (!iface.running)
+ return;
+
delete wpas.data.iface_phy[ifname];
wpas.remove_iface(ifname);
wdev_remove(ifname);
@@ -40,7 +43,7 @@ function iface_cb(new_if, old_if)
return;
}
- if (old_if && old_if.running)
+ if (old_if)
iface_stop(old_if);
}
@@ -76,6 +79,28 @@ function start_pending(phy_name)
}
let main_obj = {
+ phy_set_state: {
+ args: {
+ phy: "",
+ stop: true,
+ },
+ call: function(req) {
+ if (!req.args.phy || req.args.stop == null)
+ return libubus.STATUS_INVALID_ARGUMENT;
+
+ let phy = wpas.data.config[req.args.phy];
+ if (!phy)
+ return libubus.STATUS_NOT_FOUND;
+
+ if (req.args.stop) {
+ for (let ifname in phy.data)
+ iface_stop(phy.data[ifname]);
+ } else {
+ start_pending(req.args.phy);
+ }
+ return 0;
+ }
+ },
config_set: {
args: {
phy: "",