summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2026-01-30 18:02:35 +0000
committerFelix Fietkau2026-02-02 09:08:20 +0000
commit0a8bccf85d71531e0b8523d720aebc7f080b54bd (patch)
treea9cfc7e8215488314afc13629e04415c7a724ea4
parentb800595a38fc572340bba9bdb851843d38a88aa5 (diff)
downloadnbd-0a8bccf85d71531e0b8523d720aebc7f080b54bd.tar.gz
wifi-scripts: wireless.uc: add MLO support for procd service data
This allows services to dynamically configure MLO interfaces without using UCI. Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--package/network/config/wifi-scripts/files/lib/netifd/wireless.uc76
1 files changed, 52 insertions, 24 deletions
diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless.uc b/package/network/config/wifi-scripts/files/lib/netifd/wireless.uc
index cb505a9eb8..fef644e1f4 100644
--- a/package/network/config/wifi-scripts/files/lib/netifd/wireless.uc
+++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless.uc
@@ -50,6 +50,38 @@ function supplicant_update_mlo()
wpad_update_mlo("wpa_supplicant", "sta");
}
+function mlo_vif_create(config, radio_config, vif_idx, mlo_vifs)
+{
+ let mlo_config = { ...config };
+
+ if (config.wds)
+ mlo_config['4addr'] = config.wds;
+ mlo_config.radio_config = radio_config;
+
+ let ifname = config.ifname;
+ if (!ifname) {
+ let idx = vif_idx[config.mode] ?? 0;
+ vif_idx[config.mode] = idx + 1;
+ ifname = config.mode + "-mld" + idx;
+ }
+
+ mlo_vifs[ifname] = mlo_config;
+ return ifname;
+}
+
+function mlo_vif_macaddr(config, dev_names, dev_name)
+{
+ if (dev_name != dev_names[0])
+ delete config.macaddr;
+ if (!config.radio_macaddr)
+ return;
+
+ let idx = index(dev_names, dev_name);
+ let macaddr = idx >= 0 ? config.radio_macaddr[idx] : null;
+ if (macaddr)
+ config.macaddr = macaddr;
+}
+
function update_config(new_devices, mlo_vifs)
{
wireless.mlo = mlo_vifs;
@@ -150,32 +182,13 @@ function config_init(uci)
config.radios = radios;
if (mlo_vif && !mlo_created) {
- let mlo_config = { ...config };
-
- if (config.wds)
- mlo_config['4addr'] = config.wds;
- mlo_config.radio_config = radio_config;
- ifname = config.ifname;
- if (!ifname) {
- let idx = vif_idx[config.mode] ?? 0;
- vif_idx[config.mode] = idx + 1;
- ifname = config.mode + "-mld" + idx;
- }
-
- mlo_vifs[ifname] = mlo_config;
+ ifname = mlo_vif_create(config, radio_config, vif_idx, mlo_vifs);
mlo_created = true;
}
if (ifname)
config.ifname = ifname;
- if (dev_name != dev_names[0])
- delete config.macaddr;
- if (config.radio_macaddr) {
- let idx = index(dev_names, dev_name);
- let macaddr = idx >= 0 ? config.radio_macaddr[idx] : null;
- if (macaddr)
- config.macaddr = macaddr;
- }
+ mlo_vif_macaddr(config, dev_names, dev_name);
let vif = {
name, config,
@@ -296,13 +309,30 @@ function config_init(uci)
let config = vif.config;
if (!config)
continue;
+
+ let mlo_vif = parse_bool(config.mlo);
+ let radios = map(devs, (v) => radio_idx[v]);
+ radios = filter(radios, (v) => v != null);
+ let radio_config = map(devs, (v) => devices[v]?.config);
+ radio_config = filter(radio_config, (v) => v != null);
+ let ifname;
+
+ if (mlo_vif) {
+ ifname = mlo_vif_create(config, radio_config, vif_idx, mlo_vifs);
+ mlo_vifs[ifname].radios = radios;
+ }
+
for (let device in devs) {
let dev = devices[device];
if (!dev)
continue;
+ let vif_config = ifname ? { ...config, ifname, radios } : config;
+ if (ifname)
+ mlo_vif_macaddr(vif_config, devs, device);
+
let vif_data = {
- name, device, config,
+ name, device, config: vif_config,
vlan: [],
sta: []
};
@@ -310,8 +340,6 @@ function config_init(uci)
vif_data.vlans = vif.vlans;
if (vif.stations)
vif_data.sta = vif.stations;
- vifs[name] ??= [];
- push(vifs[name], vif_data);
push(dev.vif, vif_data);
}
}