diff mbox

[10/18] wpa_supplicant: Fix PNO restart flow

Message ID 1473085991-5073-10-git-send-email-andrei.otcheretianski@intel.com
State Accepted
Headers show

Commit Message

Andrei Otcheretianski Sept. 5, 2016, 2:33 p.m. UTC
From: Avraham Stern <avraham.stern@intel.com>

PNO is sometimes restarted due to changes in scan parameters
(e.g., selected network changed or MAC randomization being
 enabled/disabled).
Restart is done by stopping PNO and immediately starting it again.
This may result in the SCHED_SCAN_STOPPED event being received after
the request for new PNO, which will make wpa_supplicant believe PNO
is not active although it is actually is. As a result, the next
request to start PNO will fail because PNO is active and should be
stopped first.

Fix this by deferring the request to start PNO until the
SCHED_SCAN_STOPPED event is received.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
---
 wpa_supplicant/scan.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Jouni Malinen Oct. 2, 2016, 7:32 p.m. UTC | #1
On Mon, Sep 05, 2016 at 05:33:03PM +0300, andrei.otcheretianski@intel.com wrote:
> PNO is sometimes restarted due to changes in scan parameters
> (e.g., selected network changed or MAC randomization being
>  enabled/disabled).
> Restart is done by stopping PNO and immediately starting it again.
> This may result in the SCHED_SCAN_STOPPED event being received after
> the request for new PNO, which will make wpa_supplicant believe PNO
> is not active although it is actually is. As a result, the next
> request to start PNO will fail because PNO is active and should be
> stopped first.
> 
> Fix this by deferring the request to start PNO until the
> SCHED_SCAN_STOPPED event is received.

Thanks, applied.
diff mbox

Patch

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 47629de..6dfd2e8 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -2420,6 +2420,13 @@  int wpas_start_pno(struct wpa_supplicant *wpa_s)
 		}
 	}
 
+	if (wpa_s->sched_scan_stop_req) {
+		wpa_printf(MSG_DEBUG,
+			   "Schedule PNO after previous sched scan has stopped");
+		wpa_s->pno_sched_pending = 1;
+		return 0;
+	}
+
 	os_memset(&params, 0, sizeof(params));
 
 	num_ssid = num_match_ssid = 0;