DPP: Stop pending GAS client operation on DPP_STOP_LISTEN

This makes the operation more complete in stopping all ongoing DPP
related functionality.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2017-11-30 00:07:50 +02:00 committed by Jouni Malinen
parent f981ce7298
commit 1866dfb52c
4 changed files with 25 additions and 0 deletions

View file

@ -1314,6 +1314,8 @@ static void wpas_dpp_gas_resp_cb(void *ctx, const u8 *addr, u8 dialog_token,
const u8 *pos; const u8 *pos;
struct dpp_authentication *auth = wpa_s->dpp_auth; struct dpp_authentication *auth = wpa_s->dpp_auth;
wpa_s->dpp_gas_dialog_token = -1;
if (!auth || !auth->auth_success) { if (!auth || !auth->auth_success) {
wpa_printf(MSG_DEBUG, "DPP: No matching exchange in progress"); wpa_printf(MSG_DEBUG, "DPP: No matching exchange in progress");
return; return;
@ -1422,6 +1424,7 @@ static void wpas_dpp_start_gas_client(struct wpa_supplicant *wpa_s)
} else { } else {
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"DPP: GAS query started with dialog token %u", res); "DPP: GAS query started with dialog token %u", res);
wpa_s->dpp_gas_dialog_token = res;
} }
} }
@ -2450,6 +2453,8 @@ void wpas_dpp_stop(struct wpa_supplicant *wpa_s)
wpa_s->dpp_auth = NULL; wpa_s->dpp_auth = NULL;
dpp_pkex_free(wpa_s->dpp_pkex); dpp_pkex_free(wpa_s->dpp_pkex);
wpa_s->dpp_pkex = NULL; wpa_s->dpp_pkex = NULL;
if (wpa_s->dpp_gas_client && wpa_s->dpp_gas_dialog_token >= 0)
gas_query_stop(wpa_s->gas, wpa_s->dpp_gas_dialog_token);
} }

View file

@ -121,6 +121,8 @@ static const char * gas_result_txt(enum gas_query_result result)
return "PEER_ERROR"; return "PEER_ERROR";
case GAS_QUERY_INTERNAL_ERROR: case GAS_QUERY_INTERNAL_ERROR:
return "INTERNAL_ERROR"; return "INTERNAL_ERROR";
case GAS_QUERY_STOPPED:
return "STOPPED";
case GAS_QUERY_DELETED_AT_DEINIT: case GAS_QUERY_DELETED_AT_DEINIT:
return "DELETED_AT_DEINIT"; return "DELETED_AT_DEINIT";
} }
@ -852,3 +854,18 @@ int gas_query_req(struct gas_query *gas, const u8 *dst, int freq,
return dialog_token; return dialog_token;
} }
int gas_query_stop(struct gas_query *gas, u8 dialog_token)
{
struct gas_query_pending *query;
dl_list_for_each(query, &gas->pending, struct gas_query_pending, list) {
if (query->dialog_token == dialog_token) {
gas_query_done(gas, query, GAS_QUERY_STOPPED);
return 0;
}
}
return -1;
}

View file

@ -29,6 +29,7 @@ enum gas_query_result {
GAS_QUERY_TIMEOUT, GAS_QUERY_TIMEOUT,
GAS_QUERY_PEER_ERROR, GAS_QUERY_PEER_ERROR,
GAS_QUERY_INTERNAL_ERROR, GAS_QUERY_INTERNAL_ERROR,
GAS_QUERY_STOPPED,
GAS_QUERY_DELETED_AT_DEINIT GAS_QUERY_DELETED_AT_DEINIT
}; };
@ -39,6 +40,7 @@ int gas_query_req(struct gas_query *gas, const u8 *dst, int freq,
const struct wpabuf *adv_proto, const struct wpabuf *adv_proto,
const struct wpabuf *resp, u16 status_code), const struct wpabuf *resp, u16 status_code),
void *ctx); void *ctx);
int gas_query_stop(struct gas_query *gas, u8 dialog_token);
#else /* CONFIG_GAS */ #else /* CONFIG_GAS */

View file

@ -1192,6 +1192,7 @@ struct wpa_supplicant {
int dpp_auth_ok_on_ack; int dpp_auth_ok_on_ack;
int dpp_in_response_listen; int dpp_in_response_listen;
int dpp_gas_client; int dpp_gas_client;
int dpp_gas_dialog_token;
u8 dpp_intro_bssid[ETH_ALEN]; u8 dpp_intro_bssid[ETH_ALEN];
void *dpp_intro_network; void *dpp_intro_network;
struct dpp_pkex *dpp_pkex; struct dpp_pkex *dpp_pkex;