aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2018-12-02 15:17:50 (GMT)
committerJouni Malinen <j@w1.fi>2018-12-02 16:40:06 (GMT)
commitd0cd2d1ab22920995122a32b5acdf922c2090dc5 (patch)
tree23dc33dc54d13bcd4f97428c88b683899193ceef /tests
parentfe7c91f822a53bad639963dc39f5be81df56d92a (diff)
downloadhostap-d0cd2d1ab22920995122a32b5acdf922c2090dc5.zip
hostap-d0cd2d1ab22920995122a32b5acdf922c2090dc5.tar.gz
hostap-d0cd2d1ab22920995122a32b5acdf922c2090dc5.tar.bz2
tests: DPP network addition failure
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_dpp.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py
index 5e01cc7..db95361 100644
--- a/tests/hwsim/test_dpp.py
+++ b/tests/hwsim/test_dpp.py
@@ -5780,3 +5780,49 @@ def test_dpp_listen_continue(dev, apdev):
raise Exception("DPP configuration result not seen (Responder)")
dev[0].request("DPP_STOP_LISTEN")
dev[1].request("DPP_STOP_LISTEN")
+
+def test_dpp_network_addition_failure(dev, apdev):
+ """DPP network addition failure"""
+ try:
+ run_dpp_network_addition_failure(dev, apdev)
+ finally:
+ dev[0].set("dpp_config_processing", "0")
+
+def run_dpp_network_addition_failure(dev, apdev):
+ check_dpp_capab(dev[0])
+
+ res = dev[0].request("DPP_CONFIGURATOR_ADD");
+ if "FAIL" in res:
+ raise Exception("Failed to add configurator")
+ conf_id = int(res)
+
+ dev[0].set("dpp_config_processing", "1")
+ cmd = "DPP_CONFIGURATOR_SIGN conf=sta-dpp configurator=%d" % conf_id
+ tests = [ (1, "=wpas_dpp_add_network"),
+ (2, "=wpas_dpp_add_network"),
+ (3, "=wpas_dpp_add_network"),
+ (4, "=wpas_dpp_add_network"),
+ (1, "wpa_config_add_network;wpas_dpp_add_network") ]
+ for count,func in tests:
+ with alloc_fail(dev[0], count, func):
+ res = dev[0].request(cmd)
+ if "FAIL" in res:
+ raise Exception("Failed to generate own configuration")
+ ev = dev[0].wait_event(["DPP-NET-ACCESS-KEY"], timeout=2)
+ if ev is None:
+ raise Exception("Config object not processed")
+ wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
+ dev[0].dump_monitor()
+
+ cmd = "DPP_CONFIGURATOR_SIGN conf=sta-psk pass=%s configurator=%d" % ("passphrase".encode("hex"), conf_id)
+ tests = [ (1, "wpa_config_set_quoted;wpas_dpp_add_network") ]
+ for count,func in tests:
+ with alloc_fail(dev[0], count, func):
+ res = dev[0].request(cmd)
+ if "FAIL" in res:
+ raise Exception("Failed to generate own configuration")
+ ev = dev[0].wait_event(["DPP-NET-ACCESS-KEY"], timeout=2)
+ if ev is None:
+ raise Exception("Config object not processed")
+ wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
+ dev[0].dump_monitor()