HS 2.0: Allow CANCEL_FETCH_OSU to stop at scan completion

There is no need to start the GAS/ANQP fetch if the FETCH_OSU operation
has already been canceled.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-12-14 02:14:29 +02:00
parent ea27f66292
commit 568475b70b
3 changed files with 8 additions and 0 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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;