wifi-scripts: fix mac address allocation with macaddr_base set
authorFelix Fietkau <nbd@nbd.name>
Tue, 11 Feb 2025 17:28:40 +0000 (18:28 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 11 Feb 2025 17:28:45 +0000 (18:28 +0100)
The 00 address_mask needs to be inverted, otherwise the mac address
allocation will modify the last byte instead of the first one.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/config/wifi-scripts/files/usr/share/hostap/common.uc

index fd28b664725dc2ff97304d0d342c6549e8a0fe5b..31b526b6aee78baab6f7e62926cc1a79171958ef 100644 (file)
@@ -213,9 +213,12 @@ const phy_proto = {
                if (!base_mask)
                        return null;
 
+               if (base_mask == "00:00:00:00:00:00")
+                       base_mask = "ff:ff:ff:ff:ff:ff";
+
                if (data.macaddr_base)
                        base_addr = data.macaddr_base;
-               else if (base_mask == "00:00:00:00:00:00" &&
+               else if (base_mask == "ff:ff:ff:ff:ff:ff" &&
                    (radio_idx > 0 || idx >= num_global)) {
                        let addrs = split(phy_sysfs_file(phy, "addresses"), "\n");
 
@@ -227,8 +230,6 @@ const phy_proto = {
                        } else {
                                if (idx < length(addrs))
                                        return addrs[idx];
-
-                               base_mask = "ff:ff:ff:ff:ff:ff";
                        }
                }