]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: DPP QR Code and enrollee initiating with netrole specified
authorJouni Malinen <jouni@codeaurora.org>
Tue, 11 Feb 2020 04:35:15 +0000 (06:35 +0200)
committerJouni Malinen <jouni@codeaurora.org>
Tue, 11 Feb 2020 04:43:02 +0000 (06:43 +0200)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/test_dpp.py
tests/hwsim/wpasupplicant.py

index da2b91feebd26559da8b8cf7537f0a30cf46828b..46d29d4bd6943a2845c58dd9a037a6d26785c4da 100644 (file)
@@ -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])
index 7ed5d136318ed731b4c763ae259037f25b3778fa..1287df80a3cd597f5671c5a4f2822b8ad9cd818f 100644 (file)
@@ -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: