HS 2.0: Add optional no-scan parameter to FETCH_OSU
authorJouni Malinen <j@w1.fi>
Tue, 12 Jul 2016 20:13:09 +0000 (23:13 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 12 Jul 2016 20:13:09 +0000 (23:13 +0300)
This is mainly for testing purposes to allow multiple FETCH_OSU ANQP
operations to be ran without having to wait for full scan between each
query.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/hs20_supplicant.c
wpa_supplicant/hs20_supplicant.h

index 2d53174..b7468e5 100644 (file)
@@ -9053,7 +9053,10 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
                if (del_hs20_icon(wpa_s, buf + 14) < 0)
                        reply_len = -1;
        } else if (os_strcmp(buf, "FETCH_OSU") == 0) {
-               if (hs20_fetch_osu(wpa_s) < 0)
+               if (hs20_fetch_osu(wpa_s, 0) < 0)
+                       reply_len = -1;
+       } else if (os_strcmp(buf, "FETCH_OSU no-scan") == 0) {
+               if (hs20_fetch_osu(wpa_s, 1) < 0)
                        reply_len = -1;
        } else if (os_strcmp(buf, "CANCEL_FETCH_OSU") == 0) {
                hs20_cancel_fetch_osu(wpa_s);
index a82d84b..a6fff4e 100644 (file)
@@ -1076,7 +1076,7 @@ static void hs20_osu_scan_res_handler(struct wpa_supplicant *wpa_s,
 }
 
 
-int hs20_fetch_osu(struct wpa_supplicant *wpa_s)
+int hs20_fetch_osu(struct wpa_supplicant *wpa_s, int skip_scan)
 {
        if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
                wpa_printf(MSG_DEBUG, "HS 2.0: Cannot start fetch_osu - "
@@ -1107,7 +1107,16 @@ 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);
+       if (skip_scan) {
+               wpa_s->network_select = 0;
+               wpa_s->fetch_all_anqp = 1;
+               wpa_s->fetch_osu_info = 1;
+               wpa_s->fetch_osu_icon_in_progress = 0;
+
+               interworking_start_fetch_anqp(wpa_s);
+       } else {
+               hs20_start_osu_scan(wpa_s);
+       }
 
        return 0;
 }
index 69f8e9e..0dd559f 100644 (file)
@@ -31,7 +31,7 @@ void hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s, u8 code,
 void hs20_free_osu_prov(struct wpa_supplicant *wpa_s);
 void hs20_next_osu_icon(struct wpa_supplicant *wpa_s);
 void hs20_osu_icon_fetch(struct wpa_supplicant *wpa_s);
-int hs20_fetch_osu(struct wpa_supplicant *wpa_s);
+int hs20_fetch_osu(struct wpa_supplicant *wpa_s, int skip_scan);
 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);