From d299756e3e3cea7dd99dc517a4f6a61327fbc5aa Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 11 Feb 2020 06:35:15 +0200 Subject: [PATCH] tests: DPP QR Code and enrollee initiating with netrole specified Signed-off-by: Jouni Malinen --- tests/hwsim/test_dpp.py | 24 ++++++++++++++++++++++++ tests/hwsim/wpasupplicant.py | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py index da2b91fee..46d29d4bd 100644 --- a/tests/hwsim/test_dpp.py +++ b/tests/hwsim/test_dpp.py @@ -1954,6 +1954,30 @@ def run_dpp_qr_code_auth_responder_configurator(dev, apdev, extra): wait_auth_success(dev[0], dev[1], configurator=dev[0], enrollee=dev[1], stop_responder=True) +def test_dpp_qr_code_auth_enrollee_init_netrole(dev, apdev): + """DPP QR Code and enrollee initiating with netrole specified""" + check_dpp_capab(dev[0]) + check_dpp_capab(dev[1]) + conf_id = dev[0].dpp_configurator_add() + id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True) + uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0) + dev[0].set("dpp_configurator_params", + " conf=configurator configurator=%d" % conf_id) + dev[0].dpp_listen(2412, role="configurator") + dev[1].dpp_auth_init(uri=uri0, role="enrollee", netrole="configurator") + wait_auth_success(dev[0], dev[1], configurator=dev[0], enrollee=dev[1], + stop_responder=True) + dev[0].dump_monitor() + dev[1].dump_monitor() + + # verify that netrole resets back to sta, if not explicitly stated + dev[0].set("dpp_configurator_params", + "conf=sta-dpp configurator=%d" % conf_id) + dev[0].dpp_listen(2412, role="configurator") + dev[1].dpp_auth_init(uri=uri0, role="enrollee") + wait_auth_success(dev[0], dev[1], configurator=dev[0], enrollee=dev[1], + stop_responder=True) + def test_dpp_qr_code_hostapd_init(dev, apdev): """DPP QR Code and hostapd as initiator""" check_dpp_capab(dev[0]) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 7ed5d1363..1287df80a 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -1476,7 +1476,7 @@ class WpaSupplicant: extra=None, own=None, role=None, neg_freq=None, ssid=None, passphrase=None, expect_fail=False, tcp_addr=None, tcp_port=None, conn_status=False, - ssid_charset=None, nfc_uri=None): + ssid_charset=None, nfc_uri=None, netrole=None): cmd = "DPP_AUTH_INIT" if peer is None: if nfc_uri: @@ -1508,6 +1508,8 @@ class WpaSupplicant: cmd += " tcp_port=" + tcp_port if conn_status: cmd += " conn_status=1" + if netrole: + cmd += " netrole=" + netrole res = self.request(cmd) if expect_fail: if "FAIL" not in res: