From c1e38fec758cefb7e8805eea851a196316ad8091 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 12 Jun 2015 21:28:14 +0300 Subject: [PATCH] tests: Make flush_scan_cache() more robust There seem to be cases where flush_scan_cache() was unable to clear all BSS entries due to a hidden SSID BSS (SSID length 0) showing up again from cfg80211 BSS table. Check for this and run the flush operation again if any entries remain. This fixes an issue where the following hwsim test case sequence resulted in the last test case failing due to the old BSS entry from the first test case being in place and showing unexpected flags information: ap_hs20_min_bandwidth_home_hidden_ssid_in_scan_res ap_hs20_remediation_required ap_mixed_security Signed-off-by: Jouni Malinen --- tests/hwsim/wpasupplicant.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index cbb73f26e..4f574e224 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -914,6 +914,13 @@ class WpaSupplicant: def flush_scan_cache(self, freq=2417): self.request("BSS_FLUSH 0") self.scan(freq=freq, only_new=True) + res = self.request("SCAN_RESULTS") + if len(res.splitlines()) > 1: + self.request("BSS_FLUSH 0") + self.scan(freq=2422, only_new=True) + res = self.request("SCAN_RESULTS") + if len(res.splitlines()) > 1: + logger.info("flush_scan_cache: Could not clear all BSS entries. These remain:\n" + res) def roam(self, bssid, fail_test=False): self.dump_monitor()