]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Use different mechanism for failing random MAC address change
authorJouni Malinen <j@w1.fi>
Sun, 18 Dec 2022 10:31:36 +0000 (12:31 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 18 Dec 2022 10:33:02 +0000 (12:33 +0200)
gas_failures was using an invalid preassoc_mac_addr value 1111 to
trigger a failure. That won't work once wpa_supplicant starts validating
the range of the configuration parameter. Use a different mechanism to
force a failure in the actual random MAC address change functionality.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_gas.py

index 5a364975a69023bfab23bdeb3d2acd7ecc93ab96..cad2bf3ea46ea9bce6c4490ccedb390db8203cad 100644 (file)
@@ -17,7 +17,7 @@ import struct
 import hostapd
 from wpasupplicant import WpaSupplicant
 from tshark import run_tshark
-from utils import alloc_fail, wait_fail_trigger, skip_with_fips, HwsimSkip
+from utils import *
 from hwsim import HWSimRadio
 
 def hs20_ap_params():
@@ -1605,10 +1605,11 @@ def test_gas_failures(dev, apdev):
     wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
     wpas.interface_add("wlan5")
     wpas.scan_for_bss(bssid2, freq="2412")
-    wpas.request("SET preassoc_mac_addr 1111")
-    wpas.request("ANQP_GET " + bssid2 + " 258")
-    ev = wpas.wait_event(["Failed to assign random MAC address for GAS"],
-                         timeout=5)
+    wpas.request("SET preassoc_mac_addr 1")
+    with fail_test(wpas, 1, "random_mac_addr"):
+        wpas.request("ANQP_GET " + bssid2 + " 258")
+        ev = wpas.wait_event(["Failed to assign random MAC address for GAS"],
+                             timeout=5)
     wpas.request("SET preassoc_mac_addr 0")
     if ev is None:
         raise Exception("No random MAC address error seen")