[openwrt/openwrt] hostapd: reload bss if a relevant ifindex changes
LEDE Commits
lede-commits at lists.infradead.org
Sun Oct 6 11:09:31 PDT 2024
nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/12c1a56ec047d9b70cfb4f3c376c05b523b5537f
commit 12c1a56ec047d9b70cfb4f3c376c05b523b5537f
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Sun Oct 6 18:52:48 2024 +0200
hostapd: reload bss if a relevant ifindex changes
This can happen if the bridge or a stacked vlan device gets recreated.
Ensure that hostapd sees the change and handles it gracefully.
Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
package/network/services/hostapd/files/hostapd.uc | 25 ++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc
index 6774fbf3ba..6bcb32131d 100644
--- a/package/network/services/hostapd/files/hostapd.uc
+++ b/package/network/services/hostapd/files/hostapd.uc
@@ -22,6 +22,14 @@ hostapd.data.file_fields = {
eap_sim_db: true,
};
+hostapd.data.iface_fields = {
+ ft_iface: true,
+ upnp_iface: true,
+ snoop_iface: true,
+ bridge: true,
+ iapp_interface: true,
+};
+
function iface_remove(cfg)
{
if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname)
@@ -324,9 +332,24 @@ function bss_remove_file_fields(config)
return new_cfg;
}
+function bss_ifindex_list(config)
+{
+ config = filter(config, (line) => !!hostapd.data.iface_fields[split(line, "=")[0]]);
+
+ return join(",", map(config, (line) => {
+ try {
+ let file = "/sys/class/net/" + split(line, "=")[1] + "/ifindex";
+ let val = trim(readfile(file));
+ return val;
+ } catch (e) {
+ return "";
+ }
+ }));
+}
+
function bss_config_hash(config)
{
- return hostapd.sha1(remove_file_fields(config) + "");
+ return hostapd.sha1(remove_file_fields(config) + bss_ifindex_list(config));
}
function bss_find_existing(config, prev_config, prev_hash)
More information about the lede-commits
mailing list