From 6c67ad0a525e53c6ea6f7d233c1f028325b2bab4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 1 May 2020 17:43:07 +0300 Subject: [PATCH] tests: Check DPP PFS negotiation result Signed-off-by: Jouni Malinen --- tests/hwsim/test_dpp.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py index 02329e088..5f0bff7ad 100644 --- a/tests/hwsim/test_dpp.py +++ b/tests/hwsim/test_dpp.py @@ -5193,7 +5193,7 @@ def start_dpp_pfs_ap(apdev, pfs): raise HwsimSkip("DPP not supported") return hapd -def run_dpp_pfs_sta(dev, pfs, fail=False): +def run_dpp_pfs_sta(dev, pfs, fail=False, pfs_expected=None): dev.connect("dpp", key_mgmt="DPP", scan_freq="2412", ieee80211w="2", dpp_pfs=str(pfs), dpp_csign=params1_csign, @@ -5210,6 +5210,11 @@ def run_dpp_pfs_sta(dev, pfs, fail=False): raise Exception("Unexpected connection") dev.request("REMOVE_NETWORK all") else: + if pfs_expected is not None: + res = dev.get_status_field("dpp_pfs") + pfs_used = res == "1" + if pfs_expected != pfs_used: + raise Exception("Unexpected PFS negotiation result") dev.request("REMOVE_NETWORK all") dev.wait_disconnected() dev.dump_monitor() @@ -5218,25 +5223,25 @@ def test_dpp_pfs_ap_0(dev, apdev): """DPP PFS AP default""" check_dpp_capab(dev[0]) hapd = start_dpp_pfs_ap(apdev[0], 0) - run_dpp_pfs_sta(dev[0], 0) - run_dpp_pfs_sta(dev[0], 1) - run_dpp_pfs_sta(dev[0], 2) + run_dpp_pfs_sta(dev[0], 0, pfs_expected=True) + run_dpp_pfs_sta(dev[0], 1, pfs_expected=True) + run_dpp_pfs_sta(dev[0], 2, pfs_expected=False) def test_dpp_pfs_ap_1(dev, apdev): """DPP PFS AP required""" check_dpp_capab(dev[0]) hapd = start_dpp_pfs_ap(apdev[0], 1) - run_dpp_pfs_sta(dev[0], 0) - run_dpp_pfs_sta(dev[0], 1) + run_dpp_pfs_sta(dev[0], 0, pfs_expected=True) + run_dpp_pfs_sta(dev[0], 1, pfs_expected=True) run_dpp_pfs_sta(dev[0], 2, fail=True) def test_dpp_pfs_ap_2(dev, apdev): """DPP PFS AP not allowed""" check_dpp_capab(dev[0]) hapd = start_dpp_pfs_ap(apdev[0], 2) - run_dpp_pfs_sta(dev[0], 0) + run_dpp_pfs_sta(dev[0], 0, pfs_expected=False) run_dpp_pfs_sta(dev[0], 1, fail=True) - run_dpp_pfs_sta(dev[0], 2) + run_dpp_pfs_sta(dev[0], 2, pfs_expected=False) def test_dpp_reconfig_connector(dev, apdev): """DPP reconfiguration connector"""