[openwrt/openwrt] wifi-scripts: fix mac address allocation with macaddr_base set

LEDE Commits lede-commits at lists.infradead.org
Tue Feb 11 09:30:38 PST 2025


nbd pushed a commit to openwrt/openwrt.git, branch openwrt-24.10:
https://git.openwrt.org/7955545469688cbb228b8c5f3bdc519d12c2e8d5

commit 7955545469688cbb228b8c5f3bdc519d12c2e8d5
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Tue Feb 11 18:28:40 2025 +0100

    wifi-scripts: fix mac address allocation with macaddr_base set
    
    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 at nbd.name>
    (cherry picked from commit 1ee44825ad0d00527c8850446affc820d74c6e8b)
---
 .../network/config/wifi-scripts/files/usr/share/hostap/common.uc   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc b/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc
index fd28b66472..31b526b6ae 100644
--- a/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc
+++ b/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc
@@ -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";
 			}
 		}
 




More information about the lede-commits mailing list