From: David Spinadel <david.spinadel@xxxxxxxxx> Check that AP supports interworking before sending ANQP query. While at it prevent sending GAS query to unknown BSSs. Signed-off-by: David Spinadel <david.spinadel@xxxxxxxxx> --- wpa_supplicant/hs20_supplicant.c | 6 ++++++ wpa_supplicant/interworking.c | 35 +++++++++++++++++++++++++++++++---- wpa_supplicant/interworking.h | 1 + 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/hs20_supplicant.c b/wpa_supplicant/hs20_supplicant.c index e88f147..4a504a9 100644 --- a/wpa_supplicant/hs20_supplicant.c +++ b/wpa_supplicant/hs20_supplicant.c @@ -238,6 +238,12 @@ int hs20_anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst, u32 stypes, return -1; } + if (!interworking_supported_bss(bss)) { + wpa_printf(MSG_WARNING, + "HS20: Cannot send query. AP does not support interworking"); + return -1; + } + wpa_bss_anqp_unshare_alloc(bss); freq = bss->freq; diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c index 697810e..1585490 100644 --- a/wpa_supplicant/interworking.c +++ b/wpa_supplicant/interworking.c @@ -2691,6 +2691,18 @@ void interworking_stop_fetch_anqp(struct wpa_supplicant *wpa_s) } +int interworking_supported_bss(const struct wpa_bss *bss) +{ + const u8 *ext_capab; + + if (!bss) + return 0; + + ext_capab = wpa_bss_get_ie(bss, WLAN_EID_EXT_CAPAB); + return ext_capab && ext_capab[1] >= 4 && (ext_capab[5] & 0x80); +} + + int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst, u16 info_ids[], size_t num_ids, u32 subtypes) { @@ -2709,6 +2721,12 @@ int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst, return -1; } + if (!interworking_supported_bss(bss)) { + wpa_printf(MSG_WARNING, + "ANQP: Cannot send query. AP does not support interworking"); + return -1; + } + wpa_bss_anqp_unshare_alloc(bss); freq = bss->freq; @@ -3084,12 +3102,21 @@ int gas_send_request(struct wpa_supplicant *wpa_s, const u8 *dst, size_t len; u8 query_resp_len_limit = 0; - freq = wpa_s->assoc_freq; bss = wpa_bss_get_bssid(wpa_s, dst); - if (bss) - freq = bss->freq; - if (freq <= 0) + if (!bss) { + wpa_msg(wpa_s, MSG_WARNING, + "GAS: Cannot send query to unknown BSS " + MACSTR, MAC2STR(dst)); return -1; + } + + if (!interworking_supported_bss(bss)) { + wpa_msg(wpa_s, MSG_WARNING, + "GAS: Cannot send query. AP does not support interworking"); + return -1; + } + + freq = bss->freq; wpa_msg(wpa_s, MSG_DEBUG, "GAS request to " MACSTR " (freq %d MHz)", MAC2STR(dst), freq); diff --git a/wpa_supplicant/interworking.h b/wpa_supplicant/interworking.h index 3743dc0..8090cf7 100644 --- a/wpa_supplicant/interworking.h +++ b/wpa_supplicant/interworking.h @@ -32,5 +32,6 @@ int interworking_home_sp_cred(struct wpa_supplicant *wpa_s, struct wpabuf *domain_names); int domain_name_list_contains(struct wpabuf *domain_names, const char *domain, int exact_match); +int interworking_supported_bss(const struct wpa_bss *bss); #endif /* INTERWORKING_H */ -- 1.9.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap