[PATCH] Toggle to flush BSS entries when interface is disabled

Jong Wook Kim jongwook at google.com
Mon Mar 5 17:01:23 PST 2018


Currently, bss entries are cleared out whenever the interface goes down.
This is the right thing to do most of the time, but this flush is unnecessary
when we are intentionally bringing the interface down and up as it takes
~3 seconds to re-scan all channels and fill up the bss entries again.

For Connected MAC Randomization, we have to bring the interface down,
change MAC address, bring the interface back up, and then start associating
(and we are observing ~3 scan delay here due to re-scanning).
Thus, we would like to have an option to not flush the cache when the
interface is disabled.

Do let me know if there would be a better way to avoid this delay. Thanks.

Signed-off-by: Jong Wook Kim <jongwook at google.com>
---
 wpa_supplicant/config.c      | 1 +
 wpa_supplicant/config.h      | 8 ++++++++
 wpa_supplicant/config_file.c | 3 +++
 wpa_supplicant/events.c      | 4 +++-
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index a22434cb..87161481 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -4642,6 +4642,7 @@ static const struct global_parse_data global_fields[] = {
  { INT(gas_rand_addr_lifetime), 0 },
  { INT_RANGE(gas_rand_mac_addr, 0, 2), 0 },
  { INT_RANGE(dpp_config_processing, 0, 2), 0 },
+ { INT_RANGE(bss_no_flush_when_down, 0, 1), 0 },
 };

 #undef FUNC
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 07b67e6b..c63ef1d6 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -1418,6 +1418,14 @@ struct wpa_config {
  * profile automatically
  */
  int dpp_config_processing;
+
+ /**
+ * bss_no_flush_when_down - Whether to flush BSS entries when the
interface is disabled
+ *
+ * 0 = Flush BSS entries when the interface becomes disabled (Default)
+ * 1 = Do not flush BSS entries when the interface becomes disabled
+ */
+ int bss_no_flush_when_down;
 };


diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 1fd432d1..d219c3da 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -1490,6 +1490,9 @@ static void wpa_config_write_global(FILE *f,
struct wpa_config *config)
  if (config->dpp_config_processing)
  fprintf(f, "dpp_config_processing=%d\n",
  config->dpp_config_processing);
+ if (config->bss_no_flush_when_down)
+ fprintf(f, "bss_no_flush_when_down=%d\n",
+ config->bss_no_flush_when_down);

 }

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 63cf7737..708c6fc3 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -4390,7 +4390,9 @@ void wpa_supplicant_event(void *ctx, enum
wpa_event_type event,
  wpa_s, WLAN_REASON_DEAUTH_LEAVING, 1);
  }
  wpa_supplicant_mark_disassoc(wpa_s);
- wpa_bss_flush(wpa_s);
+ if (wpa_s->conf->bss_no_flush_when_down == 0)
+ wpa_bss_flush(wpa_s);
+
  radio_remove_works(wpa_s, NULL, 0);

  wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
-- 
2.16.2.395.g2e18187dfd-goog
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Toggle-to-flush-BSS-entries-when-interface-is-disabl.patch
Type: text/x-patch
Size: 3001 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/hostap/attachments/20180305/d5285b95/attachment.bin>


More information about the Hostap mailing list