From patchwork Mon Sep 5 14:33:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 665860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sSXKw5W65z9ryZ for ; Tue, 6 Sep 2016 00:34:12 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bguyB-0007h0-4i; Mon, 05 Sep 2016 14:33:55 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bguxy-0007VF-MP for hostap@lists.infradead.org; Mon, 05 Sep 2016 14:33:44 +0000 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP; 05 Sep 2016 07:33:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,286,1470726000"; d="scan'208";a="4899656" Received: from unknown (HELO TEMPHOSTNAME.ger.corp.intel.com) ([10.12.217.205]) by orsmga005.jf.intel.com with ESMTP; 05 Sep 2016 07:33:26 -0700 From: andrei.otcheretianski@intel.com To: hostap@lists.infradead.org Subject: [PATCH 10/18] wpa_supplicant: Fix PNO restart flow Date: Mon, 5 Sep 2016 17:33:03 +0300 Message-Id: <1473085991-5073-10-git-send-email-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473085991-5073-1-git-send-email-andrei.otcheretianski@intel.com> References: <1473085991-5073-1-git-send-email-andrei.otcheretianski@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160905_073342_994411_8E71D619 X-CRM114-Status: UNSURE ( 8.17 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-3.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [192.55.52.120 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [192.55.52.120 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Avraham Stern MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Avraham Stern 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 --- wpa_supplicant/scan.c | 7 +++++++ 1 file changed, 7 insertions(+) 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(¶ms, 0, sizeof(params)); num_ssid = num_match_ssid = 0;