diff --git a/wpa_supplicant/hs20_supplicant.c b/wpa_supplicant/hs20_supplicant.c index d91a93627..9eb506462 100644 --- a/wpa_supplicant/hs20_supplicant.c +++ b/wpa_supplicant/hs20_supplicant.c @@ -831,6 +831,10 @@ static void hs20_osu_scan_res_handler(struct wpa_supplicant *wpa_s, struct wpa_scan_results *scan_res) { wpa_printf(MSG_DEBUG, "OSU provisioning fetch scan completed"); + if (!wpa_s->fetch_osu_waiting_scan) { + wpa_printf(MSG_DEBUG, "OSU fetch have been canceled"); + return; + } wpa_s->network_select = 0; wpa_s->fetch_all_anqp = 1; wpa_s->fetch_osu_info = 1; @@ -879,6 +883,7 @@ int hs20_fetch_osu(struct wpa_supplicant *wpa_s) void hs20_start_osu_scan(struct wpa_supplicant *wpa_s) { + wpa_s->fetch_osu_waiting_scan = 1; wpa_s->num_osu_scans++; wpa_s->scan_req = MANUAL_SCAN_REQ; wpa_s->scan_res_handler = hs20_osu_scan_res_handler; @@ -890,6 +895,7 @@ void hs20_cancel_fetch_osu(struct wpa_supplicant *wpa_s) { wpa_printf(MSG_DEBUG, "Cancel OSU fetch"); interworking_stop_fetch_anqp(wpa_s); + wpa_s->fetch_osu_waiting_scan = 0; wpa_s->network_select = 0; wpa_s->fetch_osu_info = 0; wpa_s->fetch_osu_icon_in_progress = 0; diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c index 8c4ea3468..116df0528 100644 --- a/wpa_supplicant/interworking.c +++ b/wpa_supplicant/interworking.c @@ -2530,6 +2530,7 @@ static void interworking_next_anqp_fetch(struct wpa_supplicant *wpa_s) if (found == 0) { if (wpa_s->fetch_osu_info) { if (wpa_s->num_prov_found == 0 && + wpa_s->fetch_osu_waiting_scan && wpa_s->num_osu_scans < 3) { wpa_printf(MSG_DEBUG, "HS 2.0: No OSU providers seen - try to scan again"); hs20_start_osu_scan(wpa_s); diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 8370e5419..e0c7cd6cf 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -852,6 +852,7 @@ struct wpa_supplicant { unsigned int auto_network_select:1; unsigned int fetch_all_anqp:1; unsigned int fetch_osu_info:1; + unsigned int fetch_osu_waiting_scan:1; unsigned int fetch_osu_icon_in_progress:1; struct wpa_bss *interworking_gas_bss; unsigned int osu_icon_id;