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 <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2022-05-09 11:45:33 +03:00 committed by Jouni Malinen
parent b859b9bcea
commit d2ce1b4d6c

View file

@ -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")