]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
wifi-scripts: allow configuring per-radio macaddr in shared/mlo wifi-iface
authorFelix Fietkau <nbd@nbd.name>
Thu, 28 Aug 2025 08:42:43 +0000 (10:42 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 28 Aug 2025 08:42:44 +0000 (10:42 +0200)
When a wifi-iface section is used either for multiple vifs or MLD links,
make it possible to configure the per-radio/link macaddr.
When MLO is enabled, the main macaddr is used for the MLD interface.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/config/wifi-scripts/files/lib/netifd/wireless.uc

index 2103c9c3691a90e7f578b07a929407611b47bf4f..1180b7234750f0a150658f98b4fa9ddae9db47ca 100644 (file)
@@ -128,6 +128,17 @@ function config_init(uci)
                                        config.mode = "link";
                        config.radios = radios;
 
+                       if (dev_name != dev_names[0])
+                               delete config.macaddr;
+                       if (dev_name != wdev.mlo_name && config.radio_macaddr) {
+                               let idx = index(dev_names, dev_name);
+                               if (mlo_vif)
+                                       idx--;
+                               let macaddr = idx >= 0 ? config.radio_macaddr[idx] : null;
+                               if (macaddr)
+                                       config.macaddr = macaddr;
+                       }
+
                        let vif = {
                                name, config,
                                device: dev_name,
@@ -310,6 +321,7 @@ const default_config_attr = {
                ...network_config_attr,
                device: TYPE_STRING,
                mode: TYPE_STRING,
+               radio_macaddr: TYPE_ARRAY,
        },
        station: {
                iface: TYPE_STRING,