[openwrt/openwrt] wifi-scripts: fix race in wireless interface creation

LEDE Commits lede-commits at lists.infradead.org
Sat Dec 27 07:28:45 PST 2025


nick pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/571d716e694ebf5c4ca0255d1f86a24c9899f4cb

commit 571d716e694ebf5c4ca0255d1f86a24c9899f4cb
Author: Nick Hainke <vincent at systemli.org>
AuthorDate: Sat Dec 27 13:43:47 2025 +0100

    wifi-scripts: fix race in wireless interface creation
    
    When wdev interfaces and hostapd interfaces are mixed, race conditions
    can occur. Sometimes all interfaces are started correctly, sometimes only
    the wdev interface and some of the hostapd interfaces, and sometimes only
    the wdev interface.
    
    Fix this by creating the wdev interfaces first, before processing
    wpa_supplicant or hostapd interfaces.
    
    Link: https://github.com/openwrt/openwrt/pull/21303
    Signed-off-by: Nick Hainke <vincent at systemli.org>
    (cherry picked from commit 2015a40c387119d56c290734f571c41878938e88)
---
 .../wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh
index dcfdcd2cc8..6230f90287 100755
--- a/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh
+++ b/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh
@@ -288,12 +288,6 @@ function setup() {
 		wdev_data[v.config.ifname] = config;
 	}
 
-	if (fs.access('/usr/sbin/wpa_supplicant', 'x'))
-		supplicant.setup(supplicant_data, data);
-
-	if (fs.access('/usr/sbin/hostapd', 'x'))
-		hostapd.setup(data);
-
 	for (let ifname in active_ifnames) {
 		if (!wdev_data[ifname])
 			continue;
@@ -304,6 +298,12 @@ function setup() {
 		system(`ucode /usr/share/hostap/wdev.uc ${data.phy}${data.phy_suffix} set_config '${if_config}'`);
 	}
 
+	if (fs.access('/usr/sbin/wpa_supplicant', 'x'))
+		supplicant.setup(supplicant_data, data);
+
+	if (fs.access('/usr/sbin/hostapd', 'x'))
+		hostapd.setup(data);
+
 	if (length(supplicant_data) > 0)
 		supplicant.start(data);
 




More information about the lede-commits mailing list