diff mbox series

Handle EVENT_TX_WAIT_EXPIRE path for DPP push button

Message ID 20241125211152.17757-1-andrew.pope@morsemicro.com
State Accepted
Headers show
Series Handle EVENT_TX_WAIT_EXPIRE path for DPP push button | expand

Commit Message

Andrew Pope Nov. 25, 2024, 9:11 p.m. UTC
From: andrewrpope <andrew.pope@morsemicro.com>

The DPP push button state machine will get stuck if an off-channel
PB announcement is cancelled via EVENT_TX_WAIT_EXPIRE. This commit
handles a TX_WAIT_EXPIRE by calling wpas_dpp_pb_next, moving the
state machine forward.

Signed-off-by: Andrew Pope <andrew.pope@morsemicro.com>
---
 wpa_supplicant/dpp_supplicant.c | 10 ++++++++++
 wpa_supplicant/dpp_supplicant.h |  1 +
 wpa_supplicant/events.c         |  3 +++
 3 files changed, 14 insertions(+)

Comments

Jouni Malinen Dec. 22, 2024, 10:44 p.m. UTC | #1
On Tue, Nov 26, 2024 at 08:11:52AM +1100, andrew.pope@morsemicro.com wrote:
> The DPP push button state machine will get stuck if an off-channel
> PB announcement is cancelled via EVENT_TX_WAIT_EXPIRE. This commit
> handles a TX_WAIT_EXPIRE by calling wpas_dpp_pb_next, moving the
> state machine forward.

Thanks, applied with some cleanup.
diff mbox series

Patch

diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c
index 62059ccc8..f3994bfed 100644
--- a/wpa_supplicant/dpp_supplicant.c
+++ b/wpa_supplicant/dpp_supplicant.c
@@ -5509,6 +5509,16 @@  int wpas_dpp_ca_set(struct wpa_supplicant *wpa_s, const char *cmd)
 static int wpas_dpp_pb_announce(struct wpa_supplicant *wpa_s, int freq);
 static void wpas_dpp_pb_next(void *eloop_ctx, void *timeout_ctx);
 
+void wpas_dpp_push_button_tx_wait_expire(struct wpa_supplicant *wpa_s)
+{
+	if (!wpa_s->dpp_pb_announcement || wpa_s->dpp_pb_discovery_done)
+		return;
+
+	wpa_printf(MSG_DEBUG, "DPP: Failed to send push button announcement");
+	if (eloop_register_timeout(0, 0, wpas_dpp_pb_next, wpa_s, NULL) < 0)
+		wpas_dpp_push_button_stop(wpa_s);
+}
+
 
 static void wpas_dpp_pb_tx_status(struct wpa_supplicant *wpa_s,
 				  unsigned int freq, const u8 *dst,
diff --git a/wpa_supplicant/dpp_supplicant.h b/wpa_supplicant/dpp_supplicant.h
index e2bdd9d40..6066664da 100644
--- a/wpa_supplicant/dpp_supplicant.h
+++ b/wpa_supplicant/dpp_supplicant.h
@@ -46,5 +46,6 @@  int wpas_dpp_ca_set(struct wpa_supplicant *wpa_s, const char *cmd);
 int wpas_dpp_conf_set(struct wpa_supplicant *wpa_s, const char *cmd);
 int wpas_dpp_push_button(struct wpa_supplicant *wpa_s, const char *cmd);
 void wpas_dpp_push_button_stop(struct wpa_supplicant *wpa_s);
+void wpas_dpp_push_button_tx_wait_expire(struct wpa_supplicant *wpa_s);
 
 #endif /* DPP_SUPPLICANT_H */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a7c56f771..9f4f9445c 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -7082,6 +7082,9 @@  void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 #ifdef CONFIG_DPP
 		wpas_dpp_tx_wait_expire(wpa_s);
 #endif /* CONFIG_DPP */
+#ifdef CONFIG_DPP3
+		wpas_dpp_push_button_tx_wait_expire(wpa_s);
+#endif /* CONFIG_DPP3 */
 #ifdef CONFIG_NAN_USD
 		wpas_nan_usd_tx_wait_expire(wpa_s);
 #endif /* CONFIG_NAN_USD */