aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2018-12-04 18:55:20 (GMT)
committerJouni Malinen <j@w1.fi>2018-12-04 18:55:20 (GMT)
commit4b1ae27974146d3b5ef5c5e4024cfa0cdcf59f2a (patch)
tree75052275015d617277f1e871045c4d1f867ffe41 /tests
parentf81e65510c8f74e2f22f37c66bd9f12d620ca13c (diff)
downloadhostap-4b1ae27974146d3b5ef5c5e4024cfa0cdcf59f2a.zip
hostap-4b1ae27974146d3b5ef5c5e4024cfa0cdcf59f2a.tar.gz
hostap-4b1ae27974146d3b5ef5c5e4024cfa0cdcf59f2a.tar.bz2
tests: Connect to WPS AP with NFC connection handover (local failure)
This is a regression test case for a potential NULL pointer dereferencing fixed in the previous commit. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_nfc_wps.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/hwsim/test_nfc_wps.py b/tests/hwsim/test_nfc_wps.py
index f9fa908..be30a99 100644
--- a/tests/hwsim/test_nfc_wps.py
+++ b/tests/hwsim/test_nfc_wps.py
@@ -635,3 +635,28 @@ def test_nfc_invalid_ndef_record(dev, apdev):
for test in tests:
if "FAIL" not in dev[0].request("WPS_NFC_TAG_READ " + test):
raise Exception("Invalid tag accepted: " + test)
+
+def test_nfc_wps_handover_failure(dev, apdev):
+ """Connect to WPS AP with NFC connection handover (local failure)"""
+ ssid = "test-wps-nfc-handover"
+ params = ap_wps_params(ssid)
+ hapd = hostapd.add_ap(apdev[0], params)
+ logger.info("NFC connection handover")
+ req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF WPS-CR").rstrip()
+ if "FAIL" in req:
+ raise Exception("Failed to generate NFC connection handover request")
+ sel = hapd.request("NFC_GET_HANDOVER_SEL NDEF WPS-CR").rstrip()
+ if "FAIL" in sel:
+ raise Exception("Failed to generate NFC connection handover select")
+ res = hapd.request("NFC_REPORT_HANDOVER RESP WPS " + req + " " + sel)
+ if "FAIL" in res:
+ raise Exception("Failed to report NFC connection handover to to hostapd")
+ dev[0].dump_monitor()
+
+ with alloc_fail(hapd, 1, "wpabuf_dup;wps_build_public_key"):
+ res = dev[0].request("NFC_REPORT_HANDOVER INIT WPS " + req + " " + sel)
+ if "FAIL" in res:
+ raise Exception("Failed to report NFC connection handover to to wpa_supplicant")
+ ev = dev[0].wait_event(["WPS-FAIL"], timeout=10)
+ if ev is None:
+ raise Exception("WPS failure not reported")