From patchwork Tue Aug 13 12:56:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?6LW15YW1?= X-Patchwork-Id: 266791 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id C77E12C00EE for ; Tue, 13 Aug 2013 23:00:07 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 4B13C9D3CD; Tue, 13 Aug 2013 09:00:03 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UnCQgliooGMj; Tue, 13 Aug 2013 09:00:03 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 53F689D3D1; Tue, 13 Aug 2013 08:59:56 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 237FD9D3CD for ; Tue, 13 Aug 2013 08:59:55 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b6+0hJwSBMQp for ; Tue, 13 Aug 2013 08:59:44 -0400 (EDT) Received: from mx1.mxmail.xiaomi.com (mx1.mxmail.xiaomi.com [58.68.235.87]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 703749D3C9 for ; Tue, 13 Aug 2013 08:59:44 -0400 (EDT) Received: from mail.xiaomi.com (unknown [114.255.3.134]) by mx1.mxmail.xiaomi.com (Postfix) with ESMTP id 8FE5880F19; Tue, 13 Aug 2013 20:59:39 +0800 (CST) Received: from EX-MBOX1.xiaomi.net ([fe80::8df8:5e01:8df:6197]) by EX-CAS1.xiaomi.net ([::1]) with mapi id 14.03.0123.003; Tue, 13 Aug 2013 20:56:14 +0800 From: =?utf-8?B?6LW15YW1?= To: "dimitrysh@google.com" , "j@w1.fi" Subject: [PATCH] STA: Fix AP connection drop issue when starting P2P scanning Thread-Topic: [PATCH] STA: Fix AP connection drop issue when starting P2P scanning Thread-Index: Ac6YJDsxjk5mIg3WQGGAUjcGBjJ9Ew== Date: Tue, 13 Aug 2013 12:56:14 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.237.130.66] MIME-Version: 1.0 Cc: "hostap@lists.shmoo.com" X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com On Android, there is an issue of STA dropping from AP when P2P scanning. Following is the reproduce steps: 1. Close WiFi 2. Open WiFi and wait for connecting to a saved AP 3. When AP connected, go into WiFi direct screen immediately 4. Wait for P2P scan for a while, the connection with AP will drop The reproduce rate is almost 100%. The root cause is wpas_p2p_scan() possibly triggers an AP scan if sta_scan_pending is set. At this time, scan_req is 0 and ap_scan is 2. So wpa_supplicant_assoc_try() will be invoked from wpa_supplicant_scan(). It disassoc current AP. Signed-off-by: zhaobing --- wpa_supplicant/scan.c |    3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 1.7.9.5 Best regards, Zhao Bing (赵兵) 861060606666-5023 13693622077 MiTalk: 39682852 北京市海淀区清河中街68号 华润五彩城 The Rainbow City of China Resources ,NO.68,Qinghe Middle Street,Haidian District,Beijing,China diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index e662713..eb8e7d7 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -668,7 +668,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)                 }        } -        if (scan_req != MANUAL_SCAN_REQ && wpa_s->conf->ap_scan == 2) { +       if (scan_req != MANUAL_SCAN_REQ && wpa_s->conf->ap_scan == 2 && +          wpa_s->current_ssid == NULL) {                 wpa_s->connect_without_scan = NULL;                 wpa_s->prev_scan_wildcard = 0;                 wpa_supplicant_assoc_try(wpa_s, ssid);