diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 682e1be70..16e0bd7cb 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -569,7 +569,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) } #ifdef CONFIG_P2P - if (wpas_p2p_in_progress(wpa_s)) { + if (wpas_p2p_in_progress(wpa_s) || wpas_wpa_is_in_progress(wpa_s)) { if (wpa_s->sta_scan_pending && wpas_p2p_in_progress(wpa_s) == 2 && wpa_s->global->p2p_cb_on_scan_complete) { diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 4b8d0d0f3..c9ad4caf8 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3843,3 +3843,42 @@ void wpas_request_connection(struct wpa_supplicant *wpa_s) if (wpa_supplicant_fast_associate(wpa_s) != 1) wpa_supplicant_req_scan(wpa_s, 0, 0); } + + +/** + * wpas_wpa_is_in_progress - Check whether a connection is in progress + * @wpa_s: Pointer to wpa_supplicant data + * + * This function is to check if the wpa state is in beginning of the connection + * during 4-way handshake or group key handshake with WPA on any shared + * interface. + */ +int wpas_wpa_is_in_progress(struct wpa_supplicant *wpa_s) +{ + const char *rn, *rn2; + struct wpa_supplicant *ifs; + + if (!wpa_s->driver->get_radio_name) + return 0; + + rn = wpa_s->driver->get_radio_name(wpa_s->drv_priv); + if (rn == NULL || rn[0] == '\0') + return 0; + + for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) { + if (ifs == wpa_s || !ifs->driver->get_radio_name) + continue; + + rn2 = ifs->driver->get_radio_name(ifs->drv_priv); + if (!rn2 || os_strcmp(rn, rn2) != 0) + continue; + if (ifs->wpa_state >= WPA_AUTHENTICATING && + ifs->wpa_state != WPA_COMPLETED) { + wpa_dbg(wpa_s, MSG_DEBUG, "Connection is in progress " + "on interface %s - defer scan", ifs->ifname); + return 1; + } + } + + return 0; +} diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index c53421de8..7559a756e 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -782,6 +782,7 @@ int disallowed_ssid(struct wpa_supplicant *wpa_s, const u8 *ssid, size_t ssid_len); void wpas_request_connection(struct wpa_supplicant *wpa_s); int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf); +int wpas_wpa_is_in_progress(struct wpa_supplicant *wpa_s); /** * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response