From a6739e191ea46fd0646411c6b390da9fc3d1d6f4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 12 Dec 2013 18:39:00 -0800 Subject: [PATCH] HS 2.0R2: Try to scan multiple times for OSU providers Scan operation is not that reliable, so try couple of times if no OSU provider matches are found during fetch_osu command. Signed-hostap: Jouni Malinen --- wpa_supplicant/hs20_supplicant.c | 14 ++++++++++++-- wpa_supplicant/hs20_supplicant.h | 1 + wpa_supplicant/interworking.c | 6 ++++++ wpa_supplicant/wpa_supplicant_i.h | 2 ++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/hs20_supplicant.c b/wpa_supplicant/hs20_supplicant.c index 2cacb420e..b873c7c15 100644 --- a/wpa_supplicant/hs20_supplicant.c +++ b/wpa_supplicant/hs20_supplicant.c @@ -385,6 +385,7 @@ void hs20_parse_rx_hs20_anqp_resp(struct wpa_supplicant *wpa_s, case HS20_STYPE_OSU_PROVIDERS_LIST: wpa_msg(wpa_s, MSG_INFO, "RX-HS20-ANQP " MACSTR " OSU Providers list", MAC2STR(sa)); + wpa_s->num_prov_found++; if (anqp) { wpabuf_free(anqp->hs20_osu_providers_list); anqp->hs20_osu_providers_list = @@ -821,11 +822,20 @@ int hs20_fetch_osu(struct wpa_supplicant *wpa_s) } wpa_msg(wpa_s, MSG_INFO, "Starting OSU provisioning information fetch"); + wpa_s->num_osu_scans = 0; + wpa_s->num_prov_found = 0; + hs20_start_osu_scan(wpa_s); + + return 0; +} + + +void hs20_start_osu_scan(struct wpa_supplicant *wpa_s) +{ + wpa_s->num_osu_scans++; wpa_s->scan_req = MANUAL_SCAN_REQ; wpa_s->scan_res_handler = hs20_osu_scan_res_handler; wpa_supplicant_req_scan(wpa_s, 0, 0); - - return 0; } diff --git a/wpa_supplicant/hs20_supplicant.h b/wpa_supplicant/hs20_supplicant.h index 978252892..88e506209 100644 --- a/wpa_supplicant/hs20_supplicant.h +++ b/wpa_supplicant/hs20_supplicant.h @@ -32,5 +32,6 @@ void hs20_osu_icon_fetch(struct wpa_supplicant *wpa_s); int hs20_fetch_osu(struct wpa_supplicant *wpa_s); void hs20_cancel_fetch_osu(struct wpa_supplicant *wpa_s); void hs20_icon_fetch_failed(struct wpa_supplicant *wpa_s); +void hs20_start_osu_scan(struct wpa_supplicant *wpa_s); #endif /* HS20_SUPPLICANT_H */ diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c index fcfa63970..abf5dee1f 100644 --- a/wpa_supplicant/interworking.c +++ b/wpa_supplicant/interworking.c @@ -2474,6 +2474,12 @@ 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->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); + return; + } wpa_printf(MSG_DEBUG, "Interworking: Next icon"); hs20_osu_icon_fetch(wpa_s); return; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 0b505ff77..13147340a 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -778,6 +778,8 @@ struct wpa_supplicant { struct osu_provider *osu_prov; size_t osu_prov_count; struct os_reltime osu_icon_fetch_start; + unsigned int num_osu_scans; + unsigned int num_prov_found; #endif /* CONFIG_INTERWORKING */ unsigned int drv_capa_known;