]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix multi_ap_wps_shared_apdev_csa to remove extra hostapd interface
authorJouni Malinen <jouni@codeaurora.org>
Thu, 24 Jun 2021 21:31:03 +0000 (00:31 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 24 Jun 2021 21:31:03 +0000 (00:31 +0300)
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>
tests/hwsim/test_multi_ap.py

index ca8ea3a31f9097d4461b5788c2cf18b91de06f77..99db14ebfae92e9744511ff8860367f41e0350c7 100644 (file)
@@ -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