]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Handle wpas_dpp_connected() processing in eloop callback
authorJouni Malinen <j@w1.fi>
Sat, 4 Nov 2023 09:58:14 +0000 (11:58 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 4 Nov 2023 09:58:14 +0000 (11:58 +0200)
wpas_dpp_connected() is called from wpa_supplicant_set_state(), i.e.,
from the middle of processing of the post 4-way handshake steps. Sending
a DPP Public Action frame at that point can delay other operations, so
allow those steps to be completed first before sending out the DPP
connection status result.

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

index 627e4bda975eed256721091031cd5097a95dd9bc..b1a1e0ee03321b58103bddac763bc8df27f03c47 100644 (file)
@@ -431,8 +431,9 @@ void wpas_dpp_send_conn_status_result(struct wpa_supplicant *wpa_s,
 }
 
 
-void wpas_dpp_connected(struct wpa_supplicant *wpa_s)
+static void wpas_dpp_connected_timeout(void *eloop_ctx, void *timeout_ctx)
 {
+       struct wpa_supplicant *wpa_s = eloop_ctx;
        struct dpp_authentication *auth = wpa_s->dpp_auth;
 
        if ((auth && auth->conn_status_requested) ||
@@ -440,6 +441,22 @@ void wpas_dpp_connected(struct wpa_supplicant *wpa_s)
                wpas_dpp_send_conn_status_result(wpa_s, DPP_STATUS_OK);
 }
 
+
+void wpas_dpp_connected(struct wpa_supplicant *wpa_s)
+{
+       struct dpp_authentication *auth = wpa_s->dpp_auth;
+
+       if ((auth && auth->conn_status_requested) ||
+           dpp_tcp_conn_status_requested(wpa_s->dpp)) {
+               /* Report connection result from an eloop timeout to avoid delay
+                * to completing all connection completion steps since this
+                * function is called in a middle of the post 4-way handshake
+                * processing. */
+               eloop_register_timeout(0, 0, wpas_dpp_connected_timeout,
+                                      wpa_s, NULL);
+       }
+}
+
 #endif /* CONFIG_DPP2 */
 
 
@@ -4758,6 +4775,7 @@ void wpas_dpp_deinit(struct wpa_supplicant *wpa_s)
        eloop_cancel_timeout(wpas_dpp_reconfig_reply_wait_timeout,
                             wpa_s, NULL);
        eloop_cancel_timeout(wpas_dpp_build_csr, wpa_s, NULL);
+       eloop_cancel_timeout(wpas_dpp_connected_timeout, wpa_s, NULL);
        dpp_pfs_free(wpa_s->dpp_pfs);
        wpa_s->dpp_pfs = NULL;
        wpas_dpp_chirp_stop(wpa_s);