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 <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-06-12 21:28:14 +03:00 committed by Jouni Malinen
parent ee19ba74cd
commit c1e38fec75

View file

@ -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()