DPP: Handle wpas_dpp_connected() processing in eloop callback

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>
This commit is contained in:
Jouni Malinen 2023-11-04 11:58:14 +02:00
parent 8dd272fded
commit 0776c51ed7

View 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);