]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Clear vendor elements at the end of wpas_ap_vendor_elems
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 4 Oct 2022 21:21:12 +0000 (00:21 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 4 Oct 2022 21:22:52 +0000 (00:22 +0300)
This is needed to avoid surprises in the following test cases. This was
found with a failure in the following test sequence:
wpas_ap_vendor_elems p2p_ext_discovery_go

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_wpas_ap.py

index a3079b1584ff4ef9f510236f7c96de2a0624f6ab..68db25206ca33ecf6a2596c4de50580685263517 100644 (file)
@@ -983,16 +983,20 @@ def test_wpas_ap_vendor_elems(dev):
     dev[0].select_network(id)
     wait_ap_ready(dev[0])
 
-    beacon_elems = "dd0411223301"
-    dev[0].set("ap_vendor_elements", beacon_elems)
-    dev[0].set("ap_assocresp_elements", "dd0411223302")
-    if "OK" not in dev[0].request("UPDATE_BEACON"):
-        raise Exception("UPDATE_BEACON failed")
+    try:
+        beacon_elems = "dd0411223301"
+        dev[0].set("ap_vendor_elements", beacon_elems)
+        dev[0].set("ap_assocresp_elements", "dd0411223302")
+        if "OK" not in dev[0].request("UPDATE_BEACON"):
+            raise Exception("UPDATE_BEACON failed")
 
-    dev[1].connect("wpas-ap-open", key_mgmt="NONE", scan_freq="2412")
-    bss = dev[1].get_bss(dev[0].own_addr())
-    if beacon_elems not in bss['ie']:
-        raise Exception("Vendor element not visible in scan results")
+        dev[1].connect("wpas-ap-open", key_mgmt="NONE", scan_freq="2412")
+        bss = dev[1].get_bss(dev[0].own_addr())
+        if beacon_elems not in bss['ie']:
+            raise Exception("Vendor element not visible in scan results")
+    finally:
+        dev[0].set("ap_vendor_elements", "")
+        dev[0].set("ap_assocresp_elements", "")
 
 def test_wpas_ap_lifetime_in_memory(dev, apdev, params):
     """wpa_supplicant AP mode and PSK/PTK lifetime in memory"""