]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Stop pending GAS client operation on DPP_STOP_LISTEN
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 29 Nov 2017 22:07:50 +0000 (00:07 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 29 Nov 2017 22:08:40 +0000 (00:08 +0200)
This makes the operation more complete in stopping all ongoing DPP
related functionality.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/dpp_supplicant.c
wpa_supplicant/gas_query.c
wpa_supplicant/gas_query.h
wpa_supplicant/wpa_supplicant_i.h

index 8661672cda9d57ea5da55ec7983f093ad67ce29f..11ac450db32296e2b61e04fbd3c5bd0cbb59bdfd 100644 (file)
@@ -1314,6 +1314,8 @@ static void wpas_dpp_gas_resp_cb(void *ctx, const u8 *addr, u8 dialog_token,
        const u8 *pos;
        struct dpp_authentication *auth = wpa_s->dpp_auth;
 
+       wpa_s->dpp_gas_dialog_token = -1;
+
        if (!auth || !auth->auth_success) {
                wpa_printf(MSG_DEBUG, "DPP: No matching exchange in progress");
                return;
@@ -1422,6 +1424,7 @@ static void wpas_dpp_start_gas_client(struct wpa_supplicant *wpa_s)
        } else {
                wpa_printf(MSG_DEBUG,
                           "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;
        dpp_pkex_free(wpa_s->dpp_pkex);
        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);
 }
 
 
index 91cf19a20f20496197291b315adfdd62a3c95f7f..e4c3b1b96444f6717c07ae10622eecb99685e402 100644 (file)
@@ -121,6 +121,8 @@ static const char * gas_result_txt(enum gas_query_result result)
                return "PEER_ERROR";
        case GAS_QUERY_INTERNAL_ERROR:
                return "INTERNAL_ERROR";
+       case GAS_QUERY_STOPPED:
+               return "STOPPED";
        case GAS_QUERY_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;
 }
+
+
+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;
+}
index ef82097e2424b51f2ea3cfed381ea37e4035536c..05a3ae608abddf34defc9ca2515130da94ec87a9 100644 (file)
@@ -29,6 +29,7 @@ enum gas_query_result {
        GAS_QUERY_TIMEOUT,
        GAS_QUERY_PEER_ERROR,
        GAS_QUERY_INTERNAL_ERROR,
+       GAS_QUERY_STOPPED,
        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 *resp, u16 status_code),
                  void *ctx);
+int gas_query_stop(struct gas_query *gas, u8 dialog_token);
 
 #else /* CONFIG_GAS */
 
index 383ef9d7597a8aaedfd95f6dfa15778045fbb412..b1331a585c153b2261d3c82599244608cbcf562a 100644 (file)
@@ -1192,6 +1192,7 @@ struct wpa_supplicant {
        int dpp_auth_ok_on_ack;
        int dpp_in_response_listen;
        int dpp_gas_client;
+       int dpp_gas_dialog_token;
        u8 dpp_intro_bssid[ETH_ALEN];
        void *dpp_intro_network;
        struct dpp_pkex *dpp_pkex;