From d2ce1b4d6ccd5026cec5c00d5f202a984874b9da Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 9 May 2022 11:45:33 +0300 Subject: [PATCH] tests: Wait for request before responding in dscp_response There was a possible race condition here between the hostapd request transmission and wpa_supplicant response command. Wait for the wpa_supplicant event that indicates reception of the request before issuing the DSCP_RESP command to avoid failures. Signed-off-by: Jouni Malinen --- tests/hwsim/test_dscp.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/hwsim/test_dscp.py b/tests/hwsim/test_dscp.py index e017938bc..7e75e56e3 100644 --- a/tests/hwsim/test_dscp.py +++ b/tests/hwsim/test_dscp.py @@ -340,6 +340,11 @@ def test_dscp_response(dev, apdev): qos_ie += ie send_dscp_req(hapd, da, 1, dialog_token, 0, qos_ie) + ev = dev[0].wait_event(["CTRL-EVENT-DSCP-POLICY"], timeout=5) + if ev is None: + raise Exception("DSCP event not reported") + if "request_start" not in ev: + raise Exception("Unexpected DSCP event: " + ev) cmd = "DSCP_RESP solicited policy_id=1 status=0 policy_id=4 status=0" if "OK" not in dev[0].request(cmd): raise Exception("Sending DSCP Response failed")