]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: DPP chirp with an AP as a standalone Configurator
authorJouni Malinen <j@w1.fi>
Sun, 7 Mar 2021 11:18:01 +0000 (13:18 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 7 Mar 2021 11:18:01 +0000 (13:18 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/hostapd.py
tests/hwsim/test_dpp.py

index de9263b5859acff83ba3963155ff087b0842baf8..d484f67bc47fdbe8045535650842f4d58c13f4c1 100644 (file)
@@ -439,6 +439,20 @@ class Hostapd:
             raise Exception("Failed to generate bootstrapping info")
         return int(res)
 
+    def dpp_bootstrap_set(self, id, conf=None, configurator=None, ssid=None,
+                          extra=None):
+        cmd = "DPP_BOOTSTRAP_SET %d" % id
+        if ssid:
+            cmd += " ssid=" + binascii.hexlify(ssid.encode()).decode()
+        if extra:
+            cmd += " " + extra
+        if conf:
+            cmd += " conf=" + conf
+        if configurator is not None:
+            cmd += " configurator=%d" % configurator
+        if "OK" not in self.request(cmd):
+            raise Exception("Failed to set bootstrapping parameters")
+
     def dpp_listen(self, freq, netrole=None, qr=None, role=None):
         cmd = "DPP_LISTEN " + str(freq)
         if netrole:
index f99d31b435a66735c6f016172eb768e41ecb0a27..fdaf60174e034fc657e3f6ee9c247ea59eb84b8e 100644 (file)
@@ -5489,6 +5489,26 @@ def test_dpp_chirp_configurator(dev, apdev):
 
     wait_auth_success(dev[0], dev[1], dev[1], dev[0])
 
+def test_dpp_chirp_ap_as_configurator(dev, apdev):
+    """DPP chirp with an AP as a standalone Configurator"""
+    check_dpp_capab(dev[0], min_ver=2)
+
+    hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
+    check_dpp_capab(hapd, min_ver=2)
+
+    id1 = dev[0].dpp_bootstrap_gen(chan="81/1")
+    uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
+
+    conf_id = hapd.dpp_configurator_add()
+    idc = hapd.dpp_qr_code(uri)
+    hapd.dpp_bootstrap_set(idc, conf="sta-dpp", configurator=conf_id)
+    hapd.dpp_listen(2412)
+
+    if "OK" not in dev[0].request("DPP_CHIRP own=%d iter=2" % id1):
+        raise Exception("DPP_CHIRP failed")
+
+    wait_auth_success(dev[0], hapd, hapd, dev[0])
+
 def test_dpp_chirp_configurator_inits(dev, apdev):
     """DPP chirp with a standalone Configurator initiating"""
     check_dpp_capab(dev[0])