From 6527a76566259945db62af3621e0478cb699b916 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 5 Nov 2022 17:25:15 +0200 Subject: [PATCH] DPP: Stop listen mode for chirp-initiated Authentication exchange Stop listen mode if there is not sufficient time remaining to complete the Authentication exchange within the current remain-on-channel operation. This speeds up the operation and avoids some timeouts that could prevent the provisioning step from completing. This addresses an issue that was found in the following test case sequence: dpp_controller_relay_discover dpp_chirp_ap_5g Similar mechanism was already used for Reconfig Announcement frames, so reuse that for this case with Presence Announcement frames. Signed-off-by: Jouni Malinen --- wpa_supplicant/dpp_supplicant.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c index d01d6b7a7..10b1301a8 100644 --- a/wpa_supplicant/dpp_supplicant.c +++ b/wpa_supplicant/dpp_supplicant.c @@ -2272,6 +2272,7 @@ wpas_dpp_rx_presence_announcement(struct wpa_supplicant *wpa_s, const u8 *src, u16 r_bootstrap_len; struct dpp_bootstrap_info *peer_bi; struct dpp_authentication *auth; + unsigned int wait_time, max_wait_time; if (!wpa_s->dpp) return; @@ -2303,6 +2304,9 @@ wpas_dpp_rx_presence_announcement(struct wpa_supplicant *wpa_s, const u8 *src, return; } + wpa_printf(MSG_DEBUG, "DPP: Start Authentication exchange with " MACSTR + " based on the received Presence Announcement", + MAC2STR(src)); auth = dpp_auth_init(wpa_s->dpp, wpa_s, peer_bi, NULL, DPP_CAPAB_CONFIGURATOR, freq, NULL, 0); if (!auth) @@ -2319,6 +2323,13 @@ wpas_dpp_rx_presence_announcement(struct wpa_supplicant *wpa_s, const u8 *src, * MAC address information from the bootstrapping information. */ os_memcpy(auth->peer_mac_addr, src, ETH_ALEN); + wait_time = wpa_s->max_remain_on_chan; + max_wait_time = wpa_s->dpp_resp_wait_time ? + wpa_s->dpp_resp_wait_time : 2000; + if (wait_time > max_wait_time) + wait_time = max_wait_time; + wpas_dpp_stop_listen_for_tx(wpa_s, freq, wait_time); + wpa_s->dpp_auth = auth; if (wpas_dpp_auth_init_next(wpa_s) < 0) { dpp_auth_deinit(wpa_s->dpp_auth);