From patchwork Fri Oct 27 21:22:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wang X-Patchwork-Id: 831591 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="luwaL6GH"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="f1SUrYCQ"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yPD1Y6w75z9t2R for ; Sat, 28 Oct 2017 19:09:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=dtLlVN7aw8jT9ounGMbwwkJPqsMAceB2C98d0iUDoho=; b=luwaL6GHecRndz ANKfm7EEDihru2kwc2DaK6VJf38dPDmXfzWfTSz08hNj1ifcAyBfU45Kljv1fg+aOIImRjlCSa/dZ iggT1IOVuun1oKRnGoiNIiH9ye1xJHVfMspzn06YglK0HEg2kFsaFi4IbXHryd8zlMilKX++27SW8 W6kSWltja0RveIppK/qG8YTRFGNQsdT/AUG7TSVGNa1crsCUGmAheKSwjVMRcm7LwzMB1wpnWLoOV yV2TgsSH2Jmft5eU94i36QOJ9DgvjQh/UnPyBPlxBy44+3D9p4zywxA2dtrhoI3hoalBW334Cw5Cn MKTYlsRDKgM/J45PWGgQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e8MBk-0001p3-LC; Sat, 28 Oct 2017 08:09:52 +0000 Received: from mail-qt0-x231.google.com ([2607:f8b0:400d:c0d::231]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e8C5j-0002m7-Qx for hostap@lists.infradead.org; Fri, 27 Oct 2017 21:23:01 +0000 Received: by mail-qt0-x231.google.com with SMTP id 31so10064294qtz.9 for ; Fri, 27 Oct 2017 14:22:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=8PQ59LhF2Qk921c2Xjpeq6+j8grCMaPLGdTdBP/CclA=; b=f1SUrYCQOc8p2nVpUg5+u1KtjyuAD35ddLRgBYAqb6eDxKi8B05bqtt87OYWLxEIXC Rypw/6+kbcBp2E9nAKyMwTURbh2YZhwNpaI6RuC1bsWZ0cw2FH87ZoJ2lfuRytI+pLaO y+FFlz1JKf5s+ruxcLHX9b9Uvds+4eETrixFJdNjCidLpSelaxS1KjQdbGt/+MYu2xoe 4XYjT5l6a25p9PhCdl12kvHexXX+Ap16Iwd8ZwIxpX2WyqR47o9lg47W1m6Us/cv7JQN jgeCDhQPMNauIlbPhDzuXcQR/7OYmLeHutKTHt/2AF+j+ckr3XmED3QYErZaFgyd2/wn Hmuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=8PQ59LhF2Qk921c2Xjpeq6+j8grCMaPLGdTdBP/CclA=; b=GbAzsxJmTD+Y5oie40IfM5ILCkkK1gisCp9KzKHIoDAbYbBrZDN52EGX9wRiWQqBaD 2F/7qggMCigB38XFUcvzGRdOW16NpMs4vxsroNN+0cGXPCJFvVotElnVc+P3cVsgSgtu j0tBb2vyCM2wONNKEpEbX/4ntR7uriiKJrt0zfmAFdCgwpllmXTbUngRb07L/d1lr4tC YnWLLCDBEwxR5igAyKwU5UFOmqUwcbR7cQnnCpbd/jXQgGjOX1k6qCfcTp6DalDgWc6t 6x/tEwGXILDPM7/DW1KhIftPi5z/NDoU1v12bOdjsfk8oLNfJiEfxNTmFlJPBh5OeEPq fXnw== X-Gm-Message-State: AMCzsaW4N1h2NThSEhLC9i97kJNsCGGkdsg7HTRG6b6aqZ5Y9Vk7Z0zf wQayz1wy0r4uhbjIyV1gHRvM5g5rwDb94/7HMCmTmXWbSXM= X-Google-Smtp-Source: ABhQp+Rc95YUMfGg7sXtCRM0+uDhlFGdvtTZM1CPXPhpdtesEIz8L7Oyk4JLy0gop++47nrJXTq1W/XKwQ7GZF/G/4w= X-Received: by 10.200.37.89 with SMTP id 25mr3144063qtn.268.1509139358083; Fri, 27 Oct 2017 14:22:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.189.131 with HTTP; Fri, 27 Oct 2017 14:22:37 -0700 (PDT) From: Matthew Wang Date: Fri, 27 Oct 2017 14:22:37 -0700 Message-ID: Subject: [PATCH] Add config to disable scan restrictions to previously seen frequencies To: hostap@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171027_142259_986928_C5A288A1 X-CRM114-Status: GOOD ( 10.24 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400d:c0d:0:0:0:231 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 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.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Mailman-Approved-At: Sat, 28 Oct 2017 01:09:15 -0700 X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ChromeOS-kernel-wifi Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Current behavior of wpa_supplicant, when an AP deauths us is to blacklist the AP, followed by restricting the next scan to only frequencies where APs from the recently disconnected AP's BSS have been seen. This can be problematic, since it assumes that our knowledge of the channels/frequencies where APs from this BSS are running is fresh. If the APs have moved to better/less-populated channels since our last scan, we'll miss them on the next scan. This change adds a config to disable the scan restriction to previously seen frequencies. Sample situation from field reports - AP 1 from BSS 'foo' we're connected to, deauths us to move to a better channel. Our last scan showed BSS 'foo' has APs at frequencies f1, f2, f3, and f4. If AP1 jumped channels, it is likely that the other APs at f2, f3 jumped channels as well. We will not find these APs and will connect to a worse AP than we should have. Please see the diff below. Thanks! Matthew * used in this ESS based on previous scans to speed up @@ -5790,6 +5791,7 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid) */ os_free(wpa_s->next_scan_freqs); wpa_s->next_scan_freqs = freqs; +#endif /* CONFIG_SCAN_KNOWN_CHANNELS_ONLY */ } } diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk index a8d6a7f94..5ef0d319b 100644 --- a/wpa_supplicant/Android.mk +++ b/wpa_supplicant/Android.mk @@ -32,6 +32,10 @@ ifeq ($(BOARD_WPA_SUPPLICANT_PRIVATE_LIB),) L_CFLAGS += -DANDROID_LIB_STUB endif +ifdef CONFIG_SCAN_KNOWN_CHANNELS_ONLY +L_CFLAGS += -DCONFIG_SCAN_KNOWN_CHANNELS_ONLY +endif + # Disable roaming in wpa_supplicant ifdef CONFIG_NO_ROAMING L_CFLAGS += -DCONFIG_NO_ROAMING diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index f3e86c1de..3460eab77 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -364,6 +364,10 @@ CFLAGS += -DCONFIG_INTERWORKING NEED_GAS=y endif +ifdef CONFIG_SCAN_KNOWN_CHANNELS_ONLY +CFLAGS += -DCONFIG_SCAN_KNOWN_CHANNELS_ONLY +endif + ifdef CONFIG_NO_ROAMING CFLAGS += -DCONFIG_NO_ROAMING endif diff --git a/wpa_supplicant/android.config b/wpa_supplicant/android.config index 02505bb99..aa9186eb9 100644 --- a/wpa_supplicant/android.config +++ b/wpa_supplicant/android.config @@ -442,6 +442,10 @@ CONFIG_INTERWORKING=y # Hotspot 2.0 CONFIG_HS20=y +# Scan only the known channels used in the current ESS based on the previous +# scans. +CONFIG_SCAN_KNOWN_CHANNELS_ONLY=y + # Disable roaming in wpa_supplicant CONFIG_NO_ROAMING=y diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig index edd280277..c02572f66 100644 --- a/wpa_supplicant/defconfig +++ b/wpa_supplicant/defconfig @@ -470,6 +470,10 @@ CONFIG_PEERKEY=y # Enable interface matching in wpa_supplicant #CONFIG_MATCH_IFACE=y +# Scan only the known channels used in the current ESS based on the previous +# scans. +CONFIG_SCAN_KNOWN_CHANNELS_ONLY=y + # Disable roaming in wpa_supplicant #CONFIG_NO_ROAMING=y diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 555d0ec41..9d174ffbb 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -5783,6 +5783,7 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid) wpa_dbg(wpa_s, MSG_DEBUG, "Another BSS in this ESS " "has been seen; try it next"); wpa_blacklist_add(wpa_s, bssid); +#ifdef CONFIG_SCAN_KNOWN_CHANNELS_ONLY /* * On the next scan, go through only the known channels