[PATCH] Handle EVENT_TX_WAIT_EXPIRE path for DPP push button
andrew.pope at morsemicro.com
andrew.pope at morsemicro.com
Mon Nov 25 13:11:52 PST 2024
From: andrewrpope <andrew.pope at 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 at morsemicro.com>
---
wpa_supplicant/dpp_supplicant.c | 10 ++++++++++
wpa_supplicant/dpp_supplicant.h | 1 +
wpa_supplicant/events.c | 3 +++
3 files changed, 14 insertions(+)
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 */
--
2.34.1
More information about the Hostap
mailing list