From 5326c8af3fc57e236e496e00487076f34d6ea0a9 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 25 Jun 2021 00:31:03 +0300 Subject: [PATCH] tests: Fix multi_ap_wps_shared_apdev_csa to remove extra hostapd interface This test case adds a new AP device (wlan0_ap) with iw and removes it in the end. However, the hostapd interface for this netdev was only added, but not removed at the end of the test case. This could result in consecutive test cases getting confused with the extra interface, e.g., if running WPS configuration steps that get applied to all enabled interfaces. Signed-off-by: Jouni Malinen --- tests/hwsim/test_multi_ap.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_multi_ap.py b/tests/hwsim/test_multi_ap.py index ca8ea3a31..99db14ebf 100644 --- a/tests/hwsim/test_multi_ap.py +++ b/tests/hwsim/test_multi_ap.py @@ -100,6 +100,11 @@ def test_multi_ap_fronthaul_on_ap(dev, apdev): if "CTRL-EVENT-DISCONNECTED" not in ev: raise Exception("Unexpected connection result") +def remove_apdev(dev, ifname): + hglobal = hostapd.HostapdGlobal() + hglobal.remove(ifname) + dev.cmd_execute(['iw', ifname, 'del']) + def run_multi_ap_wps(dev, apdev, params, params_backhaul=None, add_apdev=False, run_csa=False, allow_csa_fail=False): """Helper for running Multi-AP WPS tests @@ -219,10 +224,10 @@ def run_multi_ap_wps(dev, apdev, params, params_backhaul=None, add_apdev=False, raise Exception("Received disconnection event instead of channel switch event") if add_apdev: - dev[0].cmd_execute(['iw', wpas_apdev['ifname'], 'del']) + remove_apdev(dev[0], wpas_apdev['ifname']) except: if wpas_apdev: - dev[0].cmd_execute(['iw', wpas_apdev['ifname'], 'del']) + remove_apdev(dev[0], wpas_apdev['ifname']) raise return hapd