finally:
stop_sigma_dut(sigma)
+@reset_ignore_old_scan_res
def test_sigma_dut_open(dev, apdev):
"""sigma_dut controlled open network association"""
- try:
- run_sigma_dut_open(dev, apdev)
- finally:
- dev[0].set("ignore_old_scan_res", "0")
-
-def run_sigma_dut_open(dev, apdev):
ifname = dev[0].ifname
sigma = start_sigma_dut(ifname)
finally:
stop_sigma_dut(sigma)
+@reset_ignore_old_scan_res
def test_sigma_dut_psk_pmf(dev, apdev):
"""sigma_dut controlled PSK+PMF association"""
- try:
- run_sigma_dut_psk_pmf(dev, apdev)
- finally:
- dev[0].set("ignore_old_scan_res", "0")
-
-def run_sigma_dut_psk_pmf(dev, apdev):
ifname = dev[0].ifname
sigma = start_sigma_dut(ifname)
finally:
stop_sigma_dut(sigma)
+@reset_ignore_old_scan_res
def test_sigma_dut_psk_pmf_bip_cmac_128(dev, apdev):
"""sigma_dut controlled PSK+PMF association with BIP-CMAC-128"""
- try:
- run_sigma_dut_psk_pmf_cipher(dev, apdev, "BIP-CMAC-128", "AES-128-CMAC")
- finally:
- dev[0].set("ignore_old_scan_res", "0")
+ run_sigma_dut_psk_pmf_cipher(dev, apdev, "BIP-CMAC-128", "AES-128-CMAC")
+@reset_ignore_old_scan_res
def test_sigma_dut_psk_pmf_bip_cmac_256(dev, apdev):
"""sigma_dut controlled PSK+PMF association with BIP-CMAC-256"""
- try:
- run_sigma_dut_psk_pmf_cipher(dev, apdev, "BIP-CMAC-256", "BIP-CMAC-256")
- finally:
- dev[0].set("ignore_old_scan_res", "0")
+ run_sigma_dut_psk_pmf_cipher(dev, apdev, "BIP-CMAC-256", "BIP-CMAC-256")
+@reset_ignore_old_scan_res
def test_sigma_dut_psk_pmf_bip_gmac_128(dev, apdev):
"""sigma_dut controlled PSK+PMF association with BIP-GMAC-128"""
- try:
- run_sigma_dut_psk_pmf_cipher(dev, apdev, "BIP-GMAC-128", "BIP-GMAC-128")
- finally:
- dev[0].set("ignore_old_scan_res", "0")
+ run_sigma_dut_psk_pmf_cipher(dev, apdev, "BIP-GMAC-128", "BIP-GMAC-128")
+@reset_ignore_old_scan_res
def test_sigma_dut_psk_pmf_bip_gmac_256(dev, apdev):
"""sigma_dut controlled PSK+PMF association with BIP-GMAC-256"""
- try:
- run_sigma_dut_psk_pmf_cipher(dev, apdev, "BIP-GMAC-256", "BIP-GMAC-256")
- finally:
- dev[0].set("ignore_old_scan_res", "0")
+ run_sigma_dut_psk_pmf_cipher(dev, apdev, "BIP-GMAC-256", "BIP-GMAC-256")
+@reset_ignore_old_scan_res
def test_sigma_dut_psk_pmf_bip_gmac_256_mismatch(dev, apdev):
"""sigma_dut controlled PSK+PMF association with BIP-GMAC-256 mismatch"""
- try:
- run_sigma_dut_psk_pmf_cipher(dev, apdev, "BIP-GMAC-256", "AES-128-CMAC",
- failure=True)
- finally:
- dev[0].set("ignore_old_scan_res", "0")
+ run_sigma_dut_psk_pmf_cipher(dev, apdev, "BIP-GMAC-256", "AES-128-CMAC",
+ failure=True)
def run_sigma_dut_psk_pmf_cipher(dev, apdev, sigma_cipher, hostapd_cipher,
failure=False):
finally:
stop_sigma_dut(sigma)
+@reset_ignore_old_scan_res
def test_sigma_dut_sta_override_rsne(dev, apdev):
"""sigma_dut and RSNE override on STA"""
- try:
- run_sigma_dut_sta_override_rsne(dev, apdev)
- finally:
- dev[0].set("ignore_old_scan_res", "0")
-
-def run_sigma_dut_sta_override_rsne(dev, apdev):
ifname = dev[0].ifname
sigma = start_sigma_dut(ifname)
finally:
stop_sigma_dut(sigma)
+@reset_ignore_old_scan_res
def test_sigma_dut_owe(dev, apdev):
"""sigma_dut controlled OWE station"""
- try:
- run_sigma_dut_owe(dev, apdev)
- finally:
- dev[0].set("ignore_old_scan_res", "0")
-
-def run_sigma_dut_owe(dev, apdev):
if "OWE" not in dev[0].get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
finally:
stop_sigma_dut(sigma)
+@reset_ignore_old_scan_res
def test_sigma_dut_owe_ptk_workaround(dev, apdev):
"""sigma_dut controlled OWE station with PTK workaround"""
if "OWE" not in dev[0].get_capability("key_mgmt"):
sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma)
- dev[0].set("ignore_old_scan_res", "0")
def test_sigma_dut_ap_owe(dev, apdev, params):
"""sigma_dut controlled AP with OWE"""
dev[0].set("dpp_config_processing", "0")
stop_sigma_dut(sigma)
+@reset_ignore_old_scan_res
def test_sigma_dut_preconfigured_profile(dev, apdev):
"""sigma_dut controlled connection using preconfigured profile"""
- try:
- run_sigma_dut_preconfigured_profile(dev, apdev)
- finally:
- dev[0].set("ignore_old_scan_res", "0")
-
-def run_sigma_dut_preconfigured_profile(dev, apdev):
ifname = dev[0].ifname
sigma = start_sigma_dut(ifname)
finally:
stop_sigma_dut(sigma)
+@reset_ignore_old_scan_res
def test_sigma_dut_wps_pbc(dev, apdev):
"""sigma_dut and WPS PBC Enrollee"""
- try:
- run_sigma_dut_wps_pbc(dev, apdev)
- finally:
- dev[0].set("ignore_old_scan_res", "0")
-
-def run_sigma_dut_wps_pbc(dev, apdev):
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
{"ssid": "wps", "eap_server": "1", "wps_state": "2",
finally:
stop_sigma_dut(sigma)
+@reset_ignore_old_scan_res
def test_sigma_dut_venue_url(dev, apdev):
"""sigma_dut controlled Venue URL fetch"""
- try:
- run_sigma_dut_venue_url(dev, apdev)
- finally:
- dev[0].set("ignore_old_scan_res", "0")
-
-def run_sigma_dut_venue_url(dev, apdev):
ifname = dev[0].ifname
sigma = start_sigma_dut(ifname)
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
+@reset_ignore_old_scan_res
def test_sigma_dut_beacon_prot(dev, apdev):
"""sigma_dut controlled STA and beacon protection"""
ssid = "test-pmf-required"
sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma)
- dev[0].set("ignore_old_scan_res", "0")
def test_sigma_dut_ap_beacon_prot(dev, apdev, params):
"""sigma_dut controlled AP and beacon protection"""
def sysctl_write(val):
subprocess.call(['sysctl', '-w', val], stdout=open('/dev/null', 'w'))
+def var_arg_call(fn, dev, apdev, params):
+ if fn.__code__.co_argcount > 2:
+ return fn(dev, apdev, params)
+ elif fn.__code__.co_argcount > 1:
+ return fn(dev, apdev)
+ return fn(dev)
+
+def cloned_wrapper(wrapper, fn):
+ # we need the name set right for selecting / printing etc.
+ wrapper.__name__ = fn.__name__
+ wrapper.__doc__ = fn.__doc__
+ # reparent to the right module for module filtering
+ wrapper.__module__ = fn.__module__
+ return wrapper
+
def disable_ipv6(fn):
def wrapper(dev, apdev, params):
require_under_vm()
try:
sysctl_write('net.ipv6.conf.all.disable_ipv6=1')
sysctl_write('net.ipv6.conf.default.disable_ipv6=1')
- if fn.__code__.co_argcount > 2:
- return fn(dev, apdev, params)
- elif fn.__code__.co_argcount > 1:
- return fn(dev, apdev)
- return fn(dev)
+ var_arg_call(fn, dev, apdev, params)
finally:
sysctl_write('net.ipv6.conf.all.disable_ipv6=0')
sysctl_write('net.ipv6.conf.default.disable_ipv6=0')
- # we need the name set right for selecting / printing etc.
- wrapper.__name__ = fn.__name__
- wrapper.__doc__ = fn.__doc__
- # reparent to the right module for module filtering
- wrapper.__module__ = fn.__module__
- return wrapper
+ return cloned_wrapper(wrapper, fn)
+
+def reset_ignore_old_scan_res(fn):
+ def wrapper(dev, apdev, params):
+ try:
+ var_arg_call(fn, dev, apdev, params)
+ finally:
+ dev[0].set("ignore_old_scan_res", "0")
+ return cloned_wrapper(wrapper, fn)