[PATCH] Clear pending_listen_freq if listen failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



p2p_listen use p2p->pending_listen_freq to check if having a pending p2p_listen request.
but this value is not cleared when listen started failed, 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

Signed-off-by: zhuhai <zhuhai.mail@xxxxxxx>
---
 src/p2p/p2p.c                   | 10 ++++++++++
 src/p2p/p2p.h                   |  2 ++
 wpa_supplicant/p2p_supplicant.c |  2 ++
 3 files changed, 14 insertions(+)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index bb1938dc3..e05196833 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -3964,6 +3964,16 @@ int p2p_listen_end(struct p2p_data *p2p, unsigned int freq)
 	return 0;
 }
 
+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)
 {
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 27bdac3bf..c1631a237 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -1687,6 +1687,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);
 
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 0904d60ef..a39380d31 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -2714,6 +2714,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;
 	}
@@ -2734,6 +2735,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;
-- 
2.40.1



_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux