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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
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)}`);
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');
};
};
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,
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');
};