if (err)
hostapd.printf(`Failed to create ${bss.ifname} on phy ${phy}: ${err}`);
let config_inline = iface_gen_config(phy, config);
- if (hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`) < 0) {
+
+ let ubus = hostapd.data.ubus;
+ ubus.call("wpa_supplicant", "phy_set_state", { phy: phy, stop: true });
+ if (hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`) < 0)
hostapd.printf(`hostapd.add_iface failed for phy ${phy} ifname=${bss.ifname}`);
- return;
- }
+ ubus.call("wpa_supplicant", "phy_set_state", { phy: phy, stop: false });
}
function array_to_obj(arr, key, start)
{
let ifname = iface.config.iface;
+ if (!iface.running)
+ return;
+
delete wpas.data.iface_phy[ifname];
wpas.remove_iface(ifname);
wdev_remove(ifname);
return;
}
- if (old_if && old_if.running)
+ if (old_if)
iface_stop(old_if);
}
}
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: "",