From 9f47fdb6c366c2403461baa62fb5743ee4b8566a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 24 Dec 2019 19:04:36 +0200 Subject: [PATCH] tests: Make FT PMKSA caching test cases more robust The RECONNECT command on the station was issued immediately after wpa_supplicant had processed EAPOL-Key msg 3/4. This could happen before hostapd has processed EAPOL-Key msg 4/4 and especially with UML time-travel, this could result in the following FT protocol exchange going through in a manner that makes the hostapd process EAPOL-Key msg 4/4 from the first association as a postponed EAPOL RX at the beginning of the second association. Avoid this by waiting hostapd to report completion of the connection before issuing RECONNECT. Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_ft.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py index 5404e1f53..51a070e8e 100644 --- a/tests/hwsim/test_ap_ft.py +++ b/tests/hwsim/test_ap_ft.py @@ -175,6 +175,10 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False, copts["bssid"] = apdev[0]['bssid'] netw = dev.connect(ssid, **copts) if pmksa_caching: + if dev.get_status_field('bssid') == apdev[0]['bssid']: + hapd0.wait_sta() + else: + hapd1.wait_sta() dev.request("DISCONNECT") dev.wait_disconnected() dev.request("RECONNECT")