From c57c1ed6b30a0cb1a7d01764d30707f383c86013 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 13 Jan 2014 20:26:22 +0200 Subject: [PATCH] tests: Clear data from ongoing scan on reset() It was possible for the previous test case to leave unexpected BSS or P2P peer table entries if a scan was in progress when the FLUSH command was used. This could result in test failures, e.g., when running discovery_dev_type_go followed by discovery_group_client where a P2P peer was discovered on another channel at the end of the former test case from a scan that was running durign the FLUSH operation that was supposed to remove all P2P peers. This could result in discovery_group_client failing due to dev[2] trying to send the discoverability frame on incorrect channel (the one learned in the previous test case) since discover_peer() skipped a new device discovery. Fix this by running FLUSH operation again if a pending scan operation is detected during the first FLUSH operation. Signed-hostap: Jouni Malinen --- tests/hwsim/wpasupplicant.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 5a9a70f95..f35d40725 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -120,6 +120,10 @@ class WpaSupplicant: except subprocess.CalledProcessError, e: logger.info("ifconfig failed: " + str(e.returncode)) logger.info(e.output) + if iter > 0: + # The ongoing scan could have discovered BSSes or P2P peers + logger.info("Run FLUSH again since scan was in progress") + self.request("FLUSH") if not self.ping(): logger.info("No PING response from " + self.ifname + " after reset")