tests: Make ap_wpa2_disable_eapol_retry_group more robust

Wait for hostapd to report completion of the connection before going
through the disconnection and reconnection steps to avoid a race
condition especially with UML time-travel.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-12-26 17:01:02 +02:00
parent f0825655c4
commit 0dfa6ea529

View file

@ -3079,16 +3079,20 @@ def test_ap_wpa2_disable_eapol_retry_group(dev, apdev):
bssid = apdev[0]['bssid'] bssid = apdev[0]['bssid']
id = dev[1].connect(ssid, psk=passphrase, scan_freq="2412") id = dev[1].connect(ssid, psk=passphrase, scan_freq="2412")
hapd.wait_sta()
dev[0].connect(ssid, psk=passphrase, scan_freq="2412") dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
hapd.wait_sta()
dev[0].dump_monitor() dev[0].dump_monitor()
addr = dev[0].own_addr() addr = dev[0].own_addr()
dev[1].request("DISCONNECT") dev[1].request("DISCONNECT")
dev[1].wait_disconnected()
ev = dev[0].wait_event(["WPA: Group rekeying completed"], timeout=2) ev = dev[0].wait_event(["WPA: Group rekeying completed"], timeout=2)
if ev is None: if ev is None:
raise Exception("GTK rekey timed out") raise Exception("GTK rekey timed out")
dev[1].request("RECONNECT") dev[1].request("RECONNECT")
dev[1].wait_connected() dev[1].wait_connected()
hapd.wait_sta()
dev[0].dump_monitor() dev[0].dump_monitor()
hapd.request("SET ext_eapol_frame_io 1") hapd.request("SET ext_eapol_frame_io 1")