Add config to disable scan restrictions to previously seen frequencies

Message ID CAAooHFc+Fk85r6R_kpC6gAZRU-qE4qs5aRfFM-LDa993pZEN=Q@mail.gmail.com
State New
Headers show
Series
  • Add config to disable scan restrictions to previously seen frequencies
Related show

Commit Message

Matthew Wang Oct. 27, 2017, 9:22 p.m.
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 */
                }
        }

Patch

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