diff --git a/tests/hwsim/test_wpas_ap.py b/tests/hwsim/test_wpas_ap.py index a3079b158..68db25206 100644 --- a/tests/hwsim/test_wpas_ap.py +++ b/tests/hwsim/test_wpas_ap.py @@ -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"""