]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Force clearing of p2p-send-action radio work on P2P_STOP_FIND
authorJouni Malinen <j@w1.fi>
Sun, 10 Dec 2023 17:02:34 +0000 (19:02 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 10 Dec 2023 17:40:49 +0000 (19:40 +0200)
Make sure there is no P2P radio work remaining if P2P_STOP_FIND is used
to stop a P2P exchange.

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

index de597cbb0531be871cdacf3b8f6e38309329cc18..3f9c2142e44458a4b0da1692212b0428548dd5a1 100644 (file)
@@ -7412,9 +7412,10 @@ int wpas_p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf,
 }
 
 
-static void wpas_p2p_clear_pending_action_tx(struct wpa_supplicant *wpa_s)
+static void wpas_p2p_clear_pending_action_tx(struct wpa_supplicant *wpa_s,
+                                            bool force)
 {
-       if (!offchannel_pending_action_tx(wpa_s))
+       if (!offchannel_pending_action_tx(wpa_s) && !force)
                return;
 
        if (wpa_s->p2p_send_action_work) {
@@ -7424,6 +7425,8 @@ static void wpas_p2p_clear_pending_action_tx(struct wpa_supplicant *wpa_s)
                offchannel_send_action_done(wpa_s);
        }
 
+       if (!offchannel_pending_action_tx(wpa_s))
+               return;
        wpa_printf(MSG_DEBUG, "P2P: Drop pending Action TX due to new "
                   "operation request");
        offchannel_clear_pending_action_tx(wpa_s);
@@ -7437,7 +7440,7 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout,
                  u8 seek_cnt, const char **seek_string, int freq,
                  bool include_6ghz)
 {
-       wpas_p2p_clear_pending_action_tx(wpa_s);
+       wpas_p2p_clear_pending_action_tx(wpa_s, false);
        wpa_s->global->p2p_long_listen = 0;
 
        if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL ||
@@ -7483,7 +7486,7 @@ static void wpas_p2p_scan_res_ignore_search(struct wpa_supplicant *wpa_s,
 
 static void wpas_p2p_stop_find_oper(struct wpa_supplicant *wpa_s)
 {
-       wpas_p2p_clear_pending_action_tx(wpa_s);
+       wpas_p2p_clear_pending_action_tx(wpa_s, true);
        wpa_s->global->p2p_long_listen = 0;
        eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL);
        eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL);
@@ -7528,7 +7531,7 @@ int wpas_p2p_listen(struct wpa_supplicant *wpa_s, unsigned int timeout)
        }
 
        wpa_supplicant_cancel_sched_scan(wpa_s);
-       wpas_p2p_clear_pending_action_tx(wpa_s);
+       wpas_p2p_clear_pending_action_tx(wpa_s, false);
 
        if (timeout == 0) {
                /*