]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: WPS NFC failure cases in hostapd ctrl_iface
authorJouni Malinen <j@w1.fi>
Sat, 22 Mar 2014 14:46:51 +0000 (16:46 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 22 Mar 2014 17:01:34 +0000 (19:01 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_nfc_wps.py

index e36d479d3c1abefccbd93cf4bc04dcaaf4e4a7fe..1142840ade7041f14e1fad48860c97318563dbb6 100644 (file)
@@ -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"