Skip to content

Commit 571d716

Browse files
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: openwrt/openwrt#21303 Signed-off-by: Nick Hainke <[email protected]> (cherry picked from commit 2015a40)
1 parent 380e5ea commit 571d716

File tree

1 file changed

+6
-6
lines changed
  • package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless

1 file changed

+6
-6
lines changed

package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,6 @@ function setup() {
288288
wdev_data[v.config.ifname] = config;
289289
}
290290

291-
if (fs.access('/usr/sbin/wpa_supplicant', 'x'))
292-
supplicant.setup(supplicant_data, data);
293-
294-
if (fs.access('/usr/sbin/hostapd', 'x'))
295-
hostapd.setup(data);
296-
297291
for (let ifname in active_ifnames) {
298292
if (!wdev_data[ifname])
299293
continue;
@@ -304,6 +298,12 @@ function setup() {
304298
system(`ucode /usr/share/hostap/wdev.uc ${data.phy}${data.phy_suffix} set_config '${if_config}'`);
305299
}
306300

301+
if (fs.access('/usr/sbin/wpa_supplicant', 'x'))
302+
supplicant.setup(supplicant_data, data);
303+
304+
if (fs.access('/usr/sbin/hostapd', 'x'))
305+
hostapd.setup(data);
306+
307307
if (length(supplicant_data) > 0)
308308
supplicant.start(data);
309309

0 commit comments

Comments
 (0)