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 <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2021-06-25 00:31:03 +03:00 committed by Jouni Malinen
parent 84f8947735
commit 5326c8af3f

View file

@ -100,6 +100,11 @@ def test_multi_ap_fronthaul_on_ap(dev, apdev):
if "CTRL-EVENT-DISCONNECTED" not in ev: if "CTRL-EVENT-DISCONNECTED" not in ev:
raise Exception("Unexpected connection result") 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, def run_multi_ap_wps(dev, apdev, params, params_backhaul=None, add_apdev=False,
run_csa=False, allow_csa_fail=False): run_csa=False, allow_csa_fail=False):
"""Helper for running Multi-AP WPS tests """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") raise Exception("Received disconnection event instead of channel switch event")
if add_apdev: if add_apdev:
dev[0].cmd_execute(['iw', wpas_apdev['ifname'], 'del']) remove_apdev(dev[0], wpas_apdev['ifname'])
except: except:
if wpas_apdev: if wpas_apdev:
dev[0].cmd_execute(['iw', wpas_apdev['ifname'], 'del']) remove_apdev(dev[0], wpas_apdev['ifname'])
raise raise
return hapd return hapd