aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2023-09-28 10:28:43 +0200
committerFelix Fietkau <nbd@nbd.name>2023-09-28 10:32:59 +0200
commit02ed2b0271c5e17584884146649d7fb64a9ac35d (patch)
tree6544747c12239b2cc3d0903c11dc66702418c28d
parent186747a169fe70fb53268cc1ef45952bd75fde4e (diff)
downloadupstream-02ed2b0271c5e17584884146649d7fb64a9ac35d.tar.gz
upstream-02ed2b0271c5e17584884146649d7fb64a9ac35d.tar.bz2
upstream-02ed2b0271c5e17584884146649d7fb64a9ac35d.zip
hostapd: fix wpa_supplicant mac address allocation on ap+sta
If the full interface is restarted while bringing up an AP, it can trigger a wpa_supplicant interface start before wpa_supplicant is notified of the allocated mac addresses. Fix this by moving the iface_update_supplicant_macaddr call to just after the point where mac addresses are allocated. Reported-by: Michael-cy Lee (李峻宇) <Michael-cy.Lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit abceef120d57bf066941882630a76788eb4985a9)
-rw-r--r--package/network/services/hostapd/files/hostapd.uc19
1 files changed, 10 insertions, 9 deletions
diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc
index 5cddb9c268..88f01caa93 100644
--- a/package/network/services/hostapd/files/hostapd.uc
+++ b/package/network/services/hostapd/files/hostapd.uc
@@ -122,6 +122,14 @@ function iface_config_macaddr_list(config)
return macaddr_list;
}
+function iface_update_supplicant_macaddr(phy, config)
+{
+ let macaddr_list = [];
+ for (let i = 0; i < length(config.bss); i++)
+ push(macaddr_list, config.bss[i].bssid);
+ ubus.call("wpa_supplicant", "phy_set_macaddr_list", { phy: phy, macaddr: macaddr_list });
+}
+
function iface_restart(phydev, config, old_config)
{
let phy = phydev.name;
@@ -142,6 +150,8 @@ function iface_restart(phydev, config, old_config)
bss.bssid = phydev.macaddr_next();
}
+ iface_update_supplicant_macaddr(phy, config);
+
let bss = config.bss[0];
let err = wdev_create(phy, bss.ifname, { mode: "ap" });
if (err)
@@ -498,14 +508,6 @@ function iface_reload_config(phydev, config, old_config)
return true;
}
-function iface_update_supplicant_macaddr(phy, config)
-{
- let macaddr_list = [];
- for (let i = 0; i < length(config.bss); i++)
- push(macaddr_list, config.bss[i].bssid);
- ubus.call("wpa_supplicant", "phy_set_macaddr_list", { phy: phy, macaddr: macaddr_list });
-}
-
function iface_set_config(phy, config)
{
let old_config = hostapd.data.config[phy];
@@ -536,7 +538,6 @@ function iface_set_config(phy, config)
hostapd.printf(`Restart interface for phy ${phy}`);
let ret = iface_restart(phydev, config, old_config);
- iface_update_supplicant_macaddr(phy, config);
return ret;
}