diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 6dd578796..f8aa50d7f 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1049,9 +1049,10 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, wpa_supplicant_notify_scanning(wpa_s, 0); #ifdef CONFIG_P2P - if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && + if (wpa_s->global->p2p_cb_on_scan_complete && + !wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL && !wpa_s->sta_scan_pending) { - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation " "stopped scan processing"); @@ -2412,11 +2413,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, case EVENT_SCAN_RESULTS: wpa_supplicant_event_scan_results(wpa_s, data); #ifdef CONFIG_P2P - if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && + if (wpa_s->global->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL && wpa_s->wpa_state != WPA_AUTHENTICATING && wpa_s->wpa_state != WPA_ASSOCIATING) { - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation " "continued after scan result processing"); diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index be79eab2f..5d837c301 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -137,7 +137,7 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq, wpa_printf(MSG_DEBUG, "Delaying P2P scan to allow " "pending station mode scan to be " "completed on interface %s", ifs->ifname); - wpa_s->p2p_cb_on_scan_complete = 1; + wpa_s->global->p2p_cb_on_scan_complete = 1; wpa_supplicant_req_scan(ifs, 0, 0); return 1; } @@ -191,7 +191,7 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq, if (ret) { if (wpa_s->scanning || wpa_s->scan_res_handler == wpas_p2p_scan_res_handler) { - wpa_s->p2p_cb_on_scan_complete = 1; + wpa_s->global->p2p_cb_on_scan_complete = 1; ret = 1; } } else @@ -4166,7 +4166,7 @@ void wpas_p2p_stop_find(struct wpa_supplicant *wpa_s) wpa_s->p2p_long_listen = 0; eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL); - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) { wpa_drv_p2p_stop_find(wpa_s); @@ -4499,9 +4499,9 @@ void wpas_p2p_completed(struct wpa_supplicant *wpa_s) wpas_notify_p2p_group_started(wpa_s, ssid, network_id, 1); done: - if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && + if (wpa_s->global->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL) { - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation " "continued after successful connection"); diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 71e7d8d4d..c892f7d1f 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -473,7 +473,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) if (wpas_p2p_in_progress(wpa_s)) { if (wpa_s->sta_scan_pending && wpas_p2p_in_progress(wpa_s) == 2 && - wpa_s->p2p_cb_on_scan_complete) { + wpa_s->global->p2p_cb_on_scan_complete) { wpa_dbg(wpa_s, MSG_DEBUG, "Process pending station " "mode scan during P2P search"); } else { diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index fdd322e27..c212ed245 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -200,9 +200,9 @@ static void wpa_supplicant_timeout(void *eloop_ctx, void *timeout_ctx) wpa_supplicant_req_scan(wpa_s, 1, 0); #ifdef CONFIG_P2P - if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && + if (wpa_s->global->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL) { - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation " "continued after timed out authentication"); @@ -3442,9 +3442,9 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid) 1000 * (timeout % 1000)); #ifdef CONFIG_P2P - if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && + if (wpa_s->global->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL) { - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation " "continued after failed association"); diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 0bc288011..55f3d8810 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -239,6 +239,7 @@ struct wpa_global { WPA_CONC_PREF_STA, WPA_CONC_PREF_P2P } conc_pref; + unsigned int p2p_cb_on_scan_complete:1; #ifdef CONFIG_WIFI_DISPLAY int wifi_display; @@ -541,7 +542,6 @@ struct wpa_supplicant { */ char cross_connect_uplink[100]; - unsigned int p2p_cb_on_scan_complete:1; unsigned int sta_scan_pending:1; unsigned int p2p_auto_join:1; unsigned int p2p_auto_pd:1;