wifi-scripts: ucode: fix start failed
Some checks are pending
Build all core packages / Build all core packages for selected target (push) Waiting to run

When using wpad-openssl/wpad-basic-openssl, wpa_supplicant/hostapd may not be ready because of openssl.
This cause supplicant.setup and hostapd.setup to be failed.
Therefore, wait for wpa_supplicant/hostapd to be ready before supplicant.setup and hostapd.setup.

Run-tested: mediatek/filogic GL-MT3000
fixes: #20361

Signed-off-by: Andy Chiang <AndyChiang_git@outlook.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Andy Chiang 2025-10-26 07:29:30 +07:00 committed by Felix Fietkau
parent cc3e211264
commit 00e881451a
3 changed files with 11 additions and 4 deletions

View file

@ -288,8 +288,11 @@ function setup() {
wdev_data[v.config.ifname] = config;
}
supplicant.setup(supplicant_data, data);
hostapd.setup(data);
if (fs.access('/usr/sbin/wpa_supplicant', 'x'))
supplicant.setup(supplicant_data, data);
if (fs.access('/usr/sbin/hostapd', 'x'))
hostapd.setup(data);
system(`ucode /usr/share/hostap/wdev.uc ${data.phy}${data.phy_suffix} set_config '${printf("%J", wdev_data)}' ${join(' ', active_ifnames)}`);

View file

@ -571,10 +571,12 @@ export function setup(data) {
config: has_ap ? file_name : "",
prev_config: file_name + '.prev'
};
if (!global.ubus.list('hostapd'))
system('ubus wait_for hostapd');
let ret = global.ubus.call('hostapd', 'config_set', msg);
if (ret)
netifd.add_process('/usr/sbin/hostapd', ret.pid, true, true);
else if (fs.access('/usr/sbin/hostapd', 'x'))
else
netifd.setup_failed('HOSTAPD_START_FAILED');
};

View file

@ -270,6 +270,8 @@ export function generate(config_list, data, interface) {
};
export function setup(config, data) {
if (!global.ubus.list('wpa_supplicant'))
system('ubus wait_for wpa_supplicant');
let ret = global.ubus.call('wpa_supplicant', 'config_set', {
phy: data.phy,
radio: data.config.radio,
@ -281,7 +283,7 @@ export function setup(config, data) {
if (ret)
netifd.add_process('/usr/sbin/wpa_supplicant', ret.pid, true, true);
else if (fs.access('/usr/sbin/wpa_supplicant', 'x'))
else
netifd.setup_failed('SUPPLICANT_START_FAILED');
};