From 145f35bf3083e36eb9437046e6b603ba9e035df9 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 23 Mar 2014 19:49:12 +0200 Subject: [PATCH] tests: Verify HT/VHT required rejection Previously, only the case of STA supporting HT/VHT was tested. Now both cases are verified. Signed-off-by: Jouni Malinen --- tests/hwsim/example-wpa_supplicant.config | 3 ++- tests/hwsim/test_ap_ht.py | 7 +++++++ tests/hwsim/test_ap_vht.py | 8 ++++++++ tests/hwsim/wpasupplicant.py | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/example-wpa_supplicant.config b/tests/hwsim/example-wpa_supplicant.config index c603baa84..d43799e12 100644 --- a/tests/hwsim/example-wpa_supplicant.config +++ b/tests/hwsim/example-wpa_supplicant.config @@ -91,7 +91,8 @@ CONFIG_NO_RANDOM_POOL=y CONFIG_TLSV11=y CONFIG_TLSV12=y -#CONFIG_HT_OVERRIDES=y +CONFIG_HT_OVERRIDES=y +CONFIG_VHT_OVERRIDES=y CONFIG_DEBUG_LINUX_TRACING=y diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py index fa95c2b83..030c71b8c 100644 --- a/tests/hwsim/test_ap_ht.py +++ b/tests/hwsim/test_ap_ht.py @@ -332,4 +332,11 @@ def test_ap_require_ht(dev, apdev): "require_ht": "1" } hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False) + dev[1].connect("require-ht", key_mgmt="NONE", scan_freq="2412", + disable_ht="1", wait_connect=False) dev[0].connect("require-ht", key_mgmt="NONE", scan_freq="2412") + ev = dev[1].wait_event(["CTRL-EVENT-ASSOC-REJECT"]) + if ev is None: + raise Exception("Association rejection timed out") + if "status_code=27" not in ev: + raise Exception("Unexpected rejection status code") diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py index 2df003f9b..c198d9b0a 100644 --- a/tests/hwsim/test_ap_vht.py +++ b/tests/hwsim/test_ap_vht.py @@ -60,7 +60,15 @@ def test_ap_vht80_params(dev, apdev): "require_vht": "1" } hapd = hostapd.add_ap(apdev[0]['ifname'], params) + dev[1].connect("vht", key_mgmt="NONE", scan_freq="5180", + disable_vht="1", wait_connect=False) dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180") + ev = dev[1].wait_event(["CTRL-EVENT-ASSOC-REJECT"]) + if ev is None: + raise Exception("Association rejection timed out") + if "status_code=104" not in ev: + raise Exception("Unexpected rejection status code") + dev[1].request("DISCONNECT") hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) except Exception, e: if isinstance(e, Exception) and str(e) == "AP startup failed": diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 8732f195a..49ab9cc5a 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -631,7 +631,7 @@ class WpaSupplicant: not_quoted = [ "proto", "key_mgmt", "ieee80211w", "pairwise", "group", "wep_key0", "scan_freq", "eap", "eapol_flags", "fragment_size", "scan_ssid", "auth_alg", - "wpa_ptk_rekey" ] + "wpa_ptk_rekey", "disable_ht", "disable_vht" ] for field in not_quoted: if field in kwargs and kwargs[field]: self.set_network(id, field, kwargs[field])