hostap: Add checks for mode switching
Don't allow automatic switching between modes, use disconnect/ap disable to explicitly allow switch. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit is contained in:
parent
967bedeedc
commit
f4b1c6c5d4
|
@ -546,6 +546,13 @@ int supplicant_connect(const struct device *dev, struct wifi_connect_req_params
|
|||
goto out;
|
||||
}
|
||||
|
||||
/* Allow connect in STA mode only even if we are connected already */
|
||||
if (wpa_s->current_ssid && wpa_s->current_ssid->mode != WPAS_MODE_INFRA) {
|
||||
ret = -EBUSY;
|
||||
wpa_printf(MSG_ERROR, "Interface %s is not in STA mode", dev->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = wpas_add_and_config_network(wpa_s, params, false);
|
||||
if (ret) {
|
||||
wpa_printf(MSG_ERROR, "Failed to add and configure network for STA mode: %d", ret);
|
||||
|
@ -841,6 +848,12 @@ int supplicant_ap_enable(const struct device *dev,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (wpa_s->wpa_state != WPA_DISCONNECTED) {
|
||||
ret = -EBUSY;
|
||||
wpa_printf(MSG_ERROR, "Interface %s is not in disconnected state", dev->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* No need to check for existing network to join for SoftAP*/
|
||||
wpa_s->conf->ap_scan = 2;
|
||||
|
||||
|
|
Loading…
Reference in a new issue