From 32dca985c7320dc65699c993254d408e73ca874f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 10 May 2014 21:33:49 +0300 Subject: [PATCH] tests: EAP with expanded Nak Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_eap.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py index 6bfa802c4..655e31cc8 100644 --- a/tests/hwsim/test_ap_eap.py +++ b/tests/hwsim/test_ap_eap.py @@ -1198,3 +1198,27 @@ def test_ap_wpa2_eap_too_many_roundtrips(dev, apdev): ev = dev[0].wait_event(["EAP: more than"], timeout=20) if ev is None: raise Exception("EAP roundtrip limit not reached") + +def test_ap_wpa2_eap_expanded_nak(dev, apdev): + """WPA2-Enterprise connection with EAP resulting in expanded NAK""" + params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap") + hostapd.add_ap(apdev[0]['ifname'], params) + dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP WPA-EAP-SHA256", + eap="PSK", identity="vendor-test", + password_hex="ff23456789abcdef0123456789abcdef", + wait_connect=False) + + found = False + for i in range(0, 5): + ev = dev[0].wait_event(["CTRL-EVENT-EAP-STATUS"], timeout=10) + if ev is None: + raise Exception("Association and EAP start timed out") + if "refuse proposed method" in ev: + found = True + break + if not found: + raise Exception("Unexpected EAP status: " + ev) + + ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"]) + if ev is None: + raise Exception("EAP failure timed out")