]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: DPP reconfig after Controller-initiated operation through Relay
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 21 Jul 2022 10:16:26 +0000 (13:16 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 21 Jul 2022 10:16:26 +0000 (13:16 +0300)
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_dpp.py
tests/hwsim/test_sigma_dut.py

index 4f52e5c8ff0f9d2be5f20d3d1417eb0cc1992cd6..59ef199a0b620b1b820e76d00c1ab2d1c52d7e8e 100644 (file)
@@ -5595,6 +5595,19 @@ def run_dpp_controller_init_through_relay(dev, apdev, params):
     network = int(ev.split(' ')[1])
     dev[0].wait_connected()
     dev[0].dump_monitor()
+    dev[0].request("DISCONNECT")
+    dev[0].wait_disconnected()
+    dev[0].dump_monitor()
+
+    if "OK" not in dev[0].request("DPP_RECONFIG %s" % network):
+        raise Exception("Failed to start reconfiguration")
+    ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=15)
+    if ev is None:
+        raise Exception("DPP network id not reported for reconfiguration")
+    network2 = int(ev.split(' ')[1])
+    if network == network2:
+        raise Exception("Network ID did not change")
+    dev[0].wait_connected()
 
     time.sleep(0.5)
     wt.close()
index de9c547b723774b57d671c2f4871a176073fef5c..6d783a76c9d9c19ab20d346fe303c4b633ea1177 100644 (file)
@@ -2402,10 +2402,10 @@ def test_sigma_dut_dpp_pkex_init_configurator_tcp_through_relay(dev, apdev):
         res = sigma_dut_cmd("dev_exec_action,program,DPP,DPPActionType,AutomaticDPP,DPPAuthRole,Initiator,DPPProvisioningRole,Configurator,DPPConfIndex,1,DPPSigningKeyECC,P-256,DPPConfEnrolleeRole,AP,DPPBS,PKEX,DPPPKEXCodeIdentifier,test,DPPPKEXCode,secret,DPPTimeout,6")
         if "BootstrapResult,OK,AuthResult,OK,ConfResult,OK" not in res:
             raise Exception("Unexpected result: " + res)
-        #update_hapd_config(hapd)
+        update_hapd_config(hapd)
 
         # Relay
-        port = 8908
+        port = 8909
         pkhash = "05be01e0eb79ae5d2a174d9fc83548638d325f25ee9c5840dfe6dfe8b1ae6517"
         params = {"ssid": "unconfigured",
                   "channel": "6",
@@ -2415,6 +2415,7 @@ def test_sigma_dut_dpp_pkex_init_configurator_tcp_through_relay(dev, apdev):
         check_dpp_capab(relay)
 
         # PKEX init (STA Enrollee) through Relay
+        dev[1].set("dpp_config_processing", "2")
         dev[1].dpp_listen(2437)
         id1 = dev[1].dpp_bootstrap_gen(type="pkex")
         cmd = "DPP_PKEX_ADD own=%d identifier=test code=secret" % (id1)
@@ -2422,11 +2423,36 @@ def test_sigma_dut_dpp_pkex_init_configurator_tcp_through_relay(dev, apdev):
         if "FAIL" in res:
             raise Exception("Failed to set PKEX data (responder)")
 
-        res = sigma_dut_cmd("dev_exec_action,program,DPP,DPPActionType,AutomaticDPP,DPPAuthRole,Initiator,DPPProvisioningRole,Configurator,DPPConfIndex,1,DPPSigningKeyECC,P-256,DPPConfEnrolleeRole,STA,DPPBS,PKEX,DPPPKEXCodeIdentifier,test,DPPPKEXCode,secret,DPPTimeout,6,DPPOverTCP,127.0.0.1")
+        res = sigma_dut_cmd("dev_exec_action,program,DPP,DPPActionType,AutomaticDPP,DPPAuthRole,Initiator,DPPProvisioningRole,Configurator,DPPConfIndex,1,DPPSigningKeyECC,P-256,DPPConfEnrolleeRole,STA,DPPBS,PKEX,DPPPKEXCodeIdentifier,test,DPPPKEXCode,secret,DPPTimeout,6,DPPOverTCP,127.0.0.1 tcp_port=8909")
         if "BootstrapResult,OK,AuthResult,OK,ConfResult,OK" not in res:
             raise Exception("Unexpected result: " + res)
+
+        ev = dev[1].wait_event(["DPP-NETWORK-ID"], timeout=1)
+        if ev is None:
+            raise Exception("DPP network id not reported")
+        network = int(ev.split(' ')[1])
+        dev[1].wait_connected()
+        dev[1].dump_monitor()
+        dev[1].request("DISCONNECT")
+        dev[1].wait_disconnected()
+        dev[1].dump_monitor()
+        if "OK" not in dev[1].request("DPP_RECONFIG %s" % network):
+            raise Exception("Failed to start reconfiguration")
+
+        res = sigma_dut_cmd("dev_exec_action,program,DPP,DPPActionType,DPPReconfigure,DPPCryptoIdentifier,P-256,DPPProvisioningRole,Configurator,DPPConfIndex,1,DPPConfEnrolleeRole,STA,DPPTimeout,6,DPPSigningKeyECC,P-256,DPPOverTCP,yes", timeout=10)
+        if "ReconfigAuthResult,OK,ConfResult,OK" not in res:
+            raise Exception("Unexpected reconfiguration result: " + res)
+
+        ev = dev[1].wait_event(["DPP-NETWORK-ID"], timeout=15)
+        if ev is None:
+            raise Exception("DPP network id not reported for reconfiguration")
+        network2 = int(ev.split(' ')[1])
+        if network == network2:
+            raise Exception("Network ID did not change")
+        dev[1].wait_connected()
     finally:
         stop_sigma_dut(sigma)
+        dev[1].set("dpp_config_processing", "0", allow_fail=True)
 
 def dpp_pkex_resp_start_on_v1(dev):
     while True: