[openwrt/openwrt] hostapd: fix num_global_macaddr and mbssid config handling

LEDE Commits lede-commits at lists.infradead.org
Sat Sep 21 11:15:05 PDT 2024


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/b4e7682c548e6d2f508f26a48c3e41fe34a4fc76

commit b4e7682c548e6d2f508f26a48c3e41fe34a4fc76
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Sat Sep 21 20:13:51 2024 +0200

    hostapd: fix num_global_macaddr and mbssid config handling
    
    Store the config values in the correct field and apply them on restart too
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/network/services/hostapd/files/hostapd.uc | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc
index e30e3e9b02..6774fbf3ba 100644
--- a/package/network/services/hostapd/files/hostapd.uc
+++ b/package/network/services/hostapd/files/hostapd.uc
@@ -229,6 +229,16 @@ function iface_pending_init(phydev, config)
 	pending.next();
 }
 
+function iface_macaddr_init(phydev, config, macaddr_list)
+{
+	let macaddr_data = {
+		num_global: config.num_global_macaddr ?? 1,
+		mbssid: config.mbssid ?? 0,
+	};
+
+	return phydev.macaddr_init(macaddr_list, macaddr_data);
+}
+
 function iface_restart(phydev, config, old_config)
 {
 	let phy = phydev.name;
@@ -246,7 +256,7 @@ function iface_restart(phydev, config, old_config)
 		return;
 	}
 
-	phydev.macaddr_init(iface_config_macaddr_list(config));
+	iface_macaddr_init(phydev, config, iface_config_macaddr_list(config));
 	for (let i = 0; i < length(config.bss); i++) {
 		let bss = config.bss[i];
 		if (bss.default_macaddr)
@@ -500,11 +510,7 @@ function iface_reload_config(phydev, config, old_config)
 	}
 
 	// Step 6: assign BSSID for newly created interfaces
-	let macaddr_data = {
-		num_global: config.num_global_macaddr ?? 1,
-		mbssid: config.mbssid ?? 0,
-	};
-	macaddr_list = phydev.macaddr_init(macaddr_list, macaddr_data);
+	macaddr_list = iface_macaddr_init(phydev, config, macaddr_list);
 	for (let i = 0; i < length(config.bss); i++) {
 		if (bss_list[i])
 			continue;
@@ -675,7 +681,7 @@ function iface_load_config(filename)
 
 		if (val[0] == "#num_global_macaddr" ||
 		    val[0] == "mbssid")
-			config[val[0]] = int(val[1]);
+			config[substr(val[0], 1)] = int(val[1]);
 
 		push(config.radio.data, line);
 	}




More information about the lede-commits mailing list