added dynamic radio assignment (#9)

fixed band steering

Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
2026-07-12 13:40:07 +01:00
parent 4ced23b93d
commit e4ffbbd5f9
6 changed files with 248 additions and 22 deletions
+7 -2
View File
@@ -228,11 +228,13 @@ static struct json_object *build_radio_table_stats(const uf_model_t *m)
for (int i = 0; i < m->radio_map_len; i++) {
const uf_radio_map_t *rm = &m->radio_map[i];
const char *device = wlan_device_for_band(m, rm->band);
if (!device) device = rm->device;
/* Map "radio0" → "wlan0" by OpenWrt convention */
char wlan_iface[32];
int ridx = 0;
sscanf(rm->device, "radio%d", &ridx);
sscanf(device, "radio%d", &ridx);
snprintf(wlan_iface, sizeof(wlan_iface), "wlan%d", ridx);
/* Radio name in the static table */
@@ -388,7 +390,10 @@ static struct json_object *build_vap_table(const uf_model_t *m)
for (int j = 0; j < m->radio_map_len; j++) {
if (strcmp(m->radio_map[j].band, radio) == 0) {
int idx = 0;
sscanf(m->radio_map[j].device, "radio%d", &idx);
const char *device = wlan_device_for_band(
m, m->radio_map[j].band);
if (!device) device = m->radio_map[j].device;
sscanf(device, "radio%d", &idx);
if (!ifname || !ifname[0])
snprintf(wlan_iface, sizeof(wlan_iface), "phy%d-ap0", idx);
radio_stats_t rs;