From 36a860b4d0a2f0740fe55c1c2e65a495ea8b0d3f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 22 Mar 2014 16:46:51 +0200 Subject: [PATCH] tests: WPS NFC failure cases in hostapd ctrl_iface Signed-off-by: Jouni Malinen --- tests/hwsim/test_nfc_wps.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/hwsim/test_nfc_wps.py b/tests/hwsim/test_nfc_wps.py index e36d479d3..1142840ad 100644 --- a/tests/hwsim/test_nfc_wps.py +++ b/tests/hwsim/test_nfc_wps.py @@ -141,6 +141,10 @@ def test_nfc_wps_password_token_ap(dev, apdev): if ev is None: raise Exception("Association with the AP timed out") check_wpa2_connection(dev[0], apdev[0], new_ssid, mixed=True) + if "FAIL" in hapd.request("WPS_NFC_TOKEN disable"): + raise Exception("Failed to disable AP password token") + if "FAIL" in hapd.request("WPS_NFC_TOKEN WPS"): + raise Exception("Unexpected WPS_NFC_TOKEN WPS failure") def test_nfc_wps_handover_init(dev, apdev): """Connect to WPS AP with NFC connection handover and move to configured state""" @@ -168,6 +172,36 @@ def test_nfc_wps_handover_init(dev, apdev): raise Exception("Association with the AP timed out") check_wpa2_connection(dev[0], apdev[0], ssid, mixed=True) +def test_nfc_wps_handover_errors(dev, apdev): + """WPS AP NFC handover report error cases""" + ssid = "test-wps-nfc-handover" + hostapd.add_ap(apdev[0]['ifname'], + { "ssid": ssid, "eap_server": "1", "wps_state": "1" }) + hapd = hostapd.Hostapd(apdev[0]['ifname']) + sel = hapd.request("NFC_GET_HANDOVER_SEL NDEF WPS-CR").rstrip() + if "FAIL" in sel: + raise Exception("Failed to generate NFC connection handover select") + if "FAIL" not in hapd.request("NFC_REPORT_HANDOVER "): + raise Exception("Unexpected handover report success") + if "FAIL" not in hapd.request("NFC_REPORT_HANDOVER RESP"): + raise Exception("Unexpected handover report success") + if "FAIL" not in hapd.request("NFC_REPORT_HANDOVER RESP WPS"): + raise Exception("Unexpected handover report success") + if "FAIL" not in hapd.request("NFC_REPORT_HANDOVER RESP WPS 001122"): + raise Exception("Unexpected handover report success") + if "FAIL" not in hapd.request("NFC_REPORT_HANDOVER RESP WPS 001122 00"): + raise Exception("Unexpected handover report success") + if "FAIL" not in hapd.request("NFC_REPORT_HANDOVER RESP WPS 0 00"): + raise Exception("Unexpected handover report success") + if "FAIL" not in hapd.request("NFC_REPORT_HANDOVER RESP WPS 001122 0"): + raise Exception("Unexpected handover report success") + if "FAIL" not in hapd.request("NFC_REPORT_HANDOVER RESP WPS 00q122 001122"): + raise Exception("Unexpected handover report success") + if "FAIL" not in hapd.request("NFC_REPORT_HANDOVER RESP WPS 001122 001q22"): + raise Exception("Unexpected handover report success") + if "FAIL" not in hapd.request("NFC_REPORT_HANDOVER RESP FOO 001122 00"): + raise Exception("Unexpected handover report success") + def test_nfc_wps_handover(dev, apdev): """Connect to WPS AP with NFC connection handover""" ssid = "test-wps-nfc-handover"