return -1;
}
-function get_config_bss(config, idx)
+function get_config_bss(name, config, idx)
{
if (!config.bss[idx]) {
hostapd.printf(`Invalid bss index ${idx}`);
- return null;
+ return;
}
let ifname = config.bss[idx].ifname;
- if (!ifname)
+ if (!ifname) {
hostapd.printf(`Could not find bss ${config.bss[idx].ifname}`);
+ return;
+ }
+
+ let if_bss = hostapd.bss[name];
+ if (!if_bss) {
+ hostapd.printf(`Could not find interface ${name} bss list`);
+ return;
+ }
- return hostapd.bss[ifname];
+ return if_bss[ifname];
}
function iface_reload_config(name, phydev, config, old_config)
return false;
}
- let first_bss = hostapd.bss[iface_name];
+ let first_bss = get_config_bss(name, old_config, 0);
if (!first_bss) {
hostapd.printf(`Could not find bss of previous interface ${iface_name}`);
return false;
let cur_config = config.bss[i];
let prev_config = old_config.bss[prev];
- let prev_bss = get_config_bss(old_config, prev);
+ let prev_bss = get_config_bss(name, old_config, prev);
if (!prev_bss)
return false;
config.bss[0].bssid = old_config.bss[0].bssid;
}
- let prev_bss = get_config_bss(old_config, 0);
+ let prev_bss = get_config_bss(name, old_config, 0);
if (!prev_bss)
return false;
if (!prev_bss_hash[i])
continue;
- let prev_bss = get_config_bss(old_config, i);
+ let prev_bss = get_config_bss(name, old_config, i);
if (!prev_bss)
return false;
if (old_ifname == new_ifname)
continue;
- if (hostapd.bss[new_ifname]) {
+ if (hostapd.bss[name][new_ifname]) {
new_ifname = "tmp_" + substr(hostapd.sha1(new_ifname), 0, 8);
push(rename_list, i);
}
}
static void
-hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, uc_value_t *bss)
+hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *bss)
{
uc_value_t *list;
int i;
- list = ucv_array_new(vm);
+ list = ucv_object_new(vm);
for (i = 0; iface->bss && i < iface->num_bss; i++) {
struct hostapd_data *hapd = iface->bss[i];
+ uc_value_t *uval = hostapd_ucode_bss_get_uval(hapd);
- ucv_array_set(list, i, ucv_string_new(hapd->conf->iface));
- ucv_object_add(bss, hapd->conf->iface, hostapd_ucode_bss_get_uval(hapd));
+ ucv_object_add(list, hapd->conf->iface, uval);
}
- ucv_object_add(if_bss, iface->phy, list);
+ ucv_object_add(bss, iface->phy, list);
}
static void
hostapd_ucode_update_interfaces(void)
{
uc_value_t *ifs = ucv_object_new(vm);
- uc_value_t *if_bss = ucv_array_new(vm);
- uc_value_t *bss = ucv_object_new(vm);
+ uc_value_t *if_bss = ucv_object_new(vm);
int i;
for (i = 0; i < interfaces->count; i++) {
struct hostapd_iface *iface = interfaces->iface[i];
ucv_object_add(ifs, iface->phy, hostapd_ucode_iface_get_uval(iface));
- hostapd_ucode_update_bss_list(iface, if_bss, bss);
+ hostapd_ucode_update_bss_list(iface, if_bss);
}
ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
- ucv_object_add(ucv_prototype_get(global), "interface_bss", if_bss);
- ucv_object_add(ucv_prototype_get(global), "bss", bss);
+ ucv_object_add(ucv_prototype_get(global), "bss", if_bss);
ucv_gc(vm);
}