]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Clear pending_listen_freq if listen failed
author朱海 <zhuhai.mail@163.com>
Wed, 31 Jan 2024 12:58:47 +0000 (20:58 +0800)
committerJouni Malinen <j@w1.fi>
Sun, 9 Feb 2025 11:23:33 +0000 (13:23 +0200)
p2p_listen() use p2p->pending_listen_freq to check if there is a a
pending p2p_listen request. However, this value is not cleared when
failing to start listen operation, making extended listen not work
anymore.

P2P: Failed to request the driver to remain on channel (2412 MHz) for Listen state
p2p-dev-wlan0: Radio work 'p2p-listen'@0xa800d510 done in 0.005055 seconds
p2p-dev-wlan0: radio_work_free('p2p-listen'@0xa800d510: num_active_works --> 0
P2P: Previous Extended Listen operation had not been completed - try again
P2P: State LISTEN_ONLY -> IDLE
P2P: Extended Listen timeout
P2P: Going to listen(only) state
P2P: p2p_listen command pending already

Clear p2p->pending_listen_freq if the radio work to start the listen
operation fails.

Signed-off-by: zhuhai <zhuhai.mail@163.com>
src/p2p/p2p.c
src/p2p/p2p.h
wpa_supplicant/p2p_supplicant.c

index cbc602dd837d237b2a16ee530d9cb15d964758ad..b598a7856e962409b00a993b8bdfa546a01c964c 100644 (file)
@@ -4124,6 +4124,20 @@ int p2p_listen_end(struct p2p_data *p2p, unsigned int freq)
 }
 
 
+void p2p_listen_failed(struct p2p_data *p2p, unsigned int freq)
+{
+       if (freq != p2p->pending_listen_freq) {
+               p2p_dbg(p2p,
+                       "Unexpected listen failed callback for freq=%u (pending_listen_freq=%u)",
+                       freq, p2p->pending_listen_freq);
+               return;
+       }
+
+       p2p_dbg(p2p, "Listen failed on freq=%u", freq);
+       p2p->pending_listen_freq = 0;
+}
+
+
 static void p2p_timeout_connect(struct p2p_data *p2p)
 {
        p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
index 38d6675659643150791d5283f4b2788b7c6a58e1..e7658311ea61bf6fbdf71b9b03d155f040b602f0 100644 (file)
@@ -1998,6 +1998,8 @@ void p2p_listen_cb(struct p2p_data *p2p, unsigned int freq,
  */
 int p2p_listen_end(struct p2p_data *p2p, unsigned int freq);
 
+void p2p_listen_failed(struct p2p_data *p2p, unsigned int freq);
+
 void p2p_deauth_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code,
                      const u8 *ie, size_t ie_len);
 
index 1f5c8602f601be23602d2a4d4cb69e6ebdaa7e84..4c64c18024741bc239f401dd448ecd40f51e1a3b 100644 (file)
@@ -3205,6 +3205,7 @@ static void wpas_start_listen_cb(struct wpa_radio_work *work, int deinit)
        if (wpa_drv_probe_req_report(wpa_s, 1) < 0) {
                wpa_printf(MSG_DEBUG, "P2P: Failed to request the driver to "
                           "report received Probe Request frames");
+               p2p_listen_failed(wpa_s->global->p2p, lwork->freq);
                wpas_p2p_listen_work_done(wpa_s);
                return;
        }
@@ -3225,6 +3226,7 @@ static void wpas_start_listen_cb(struct wpa_radio_work *work, int deinit)
                wpa_printf(MSG_DEBUG, "P2P: Failed to request the driver "
                           "to remain on channel (%u MHz) for Listen "
                           "state", lwork->freq);
+               p2p_listen_failed(wpa_s->global->p2p, lwork->freq);
                wpas_p2p_listen_work_done(wpa_s);
                wpa_s->pending_listen_freq = 0;
                return;