From cbc548489205b719897202cffdb3d692ea3ca60f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 21 Oct 2013 13:20:38 +0300 Subject: [PATCH] GAS: Do not start new scan operation during an ongoing GAS query These operations can have conflicting offchannel requirements, so wait with a new scan trigger until a pending GAS query has been completed. Signed-hostap: Jouni Malinen --- wpa_supplicant/gas_query.c | 6 ++++++ wpa_supplicant/gas_query.h | 1 + wpa_supplicant/scan.c | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/wpa_supplicant/gas_query.c b/wpa_supplicant/gas_query.c index 00f730e92..c5554bd90 100644 --- a/wpa_supplicant/gas_query.c +++ b/wpa_supplicant/gas_query.c @@ -598,3 +598,9 @@ void gas_query_cancel(struct gas_query *gas, const u8 *dst, u8 dialog_token) gas_query_done(gas, query, GAS_QUERY_CANCELLED); } + + +int gas_query_in_progress(struct gas_query *gas) +{ + return gas->current != NULL; +} diff --git a/wpa_supplicant/gas_query.h b/wpa_supplicant/gas_query.h index 5c3d161ad..6b6c77ce2 100644 --- a/wpa_supplicant/gas_query.h +++ b/wpa_supplicant/gas_query.h @@ -18,6 +18,7 @@ struct gas_query * gas_query_init(struct wpa_supplicant *wpa_s); void gas_query_deinit(struct gas_query *gas); int gas_query_rx(struct gas_query *gas, const u8 *da, const u8 *sa, const u8 *bssid, const u8 *data, size_t len, int freq); +int gas_query_in_progress(struct gas_query *gas); /** * enum gas_query_result - GAS query result diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index f1f858ef9..1a3fe24c9 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -21,6 +21,7 @@ #include "hs20_supplicant.h" #include "notify.h" #include "bss.h" +#include "gas_query.h" #include "scan.h" @@ -604,6 +605,14 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) } #endif /* CONFIG_P2P */ +#ifdef CONFIG_GAS + if (gas_query_in_progress(wpa_s->gas)) { + wpa_dbg(wpa_s, MSG_DEBUG, "Delay scan while GAS query is in progress"); + wpa_supplicant_req_scan(wpa_s, 1, 0); + return; + } +#endif /* CONFIG_GAS */ + if (wpa_s->conf->ap_scan == 2) max_ssids = 1; else {