]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Wait for radio work to start after DPP_LISTEN command
authorJohannes Berg <johannes.berg@intel.com>
Mon, 25 Sep 2023 07:20:41 +0000 (09:20 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 28 Oct 2023 09:06:29 +0000 (12:06 +0300)
Since DPP listen is a radio work, it doesn't start immediately and
then we can end up missing whatever happens next in the test. Wait
for the radio work to start before continuing the test.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
tests/hwsim/wpasupplicant.py

index e9f10e221a2a620c6ef30c226412a99b68477c1a..ba372e5239aa7ac8b516eecdd6e74eb1576a1640 100644 (file)
@@ -1545,6 +1545,15 @@ class WpaSupplicant:
             cmd += " role=" + role
         if "OK" not in self.request(cmd):
             raise Exception("Failed to start listen operation")
+        # Since DPP listen is a radio work, make sure it has started
+        # by the time we return and continue with the test, since it
+        # usually will send something this side should receive.
+        work_started = "dpp-listen@" + self.ifname + ":" + str(freq) + ":1"
+        for i in range(10):
+            if work_started in self.request("RADIO_WORK show"):
+                return
+            time.sleep(0.01)
+        raise Exception("Failed to start DPP listen work")
 
     def dpp_auth_init(self, peer=None, uri=None, conf=None, configurator=None,
                       extra=None, own=None, role=None, neg_freq=None,