diff --git a/tests/hwsim/test_ibss.py b/tests/hwsim/test_ibss.py index d9a95dacf..329702e70 100644 --- a/tests/hwsim/test_ibss.py +++ b/tests/hwsim/test_ibss.py @@ -29,6 +29,19 @@ def wait_4way_handshake(dev1, dev2): if ev is None: raise Exception("4-way handshake in IBSS timed out") +def wait_4way_handshake2(dev1, dev2, dev3): + logger.info(dev1.ifname + " waiting for 4-way handshake completion with " + dev2.ifname + " " + dev2.p2p_interface_addr() + " and " + dev3.p2p_interface_addr()) + ev = dev1.wait_event(["IBSS-RSN-COMPLETED " + dev2.p2p_interface_addr(), + "IBSS-RSN-COMPLETED " + dev3.p2p_interface_addr()], + timeout=20) + if ev is None: + raise Exception("4-way handshake in IBSS timed out") + ev = dev1.wait_event(["IBSS-RSN-COMPLETED " + dev2.p2p_interface_addr(), + "IBSS-RSN-COMPLETED " + dev3.p2p_interface_addr()], + timeout=20) + if ev is None: + raise Exception("4-way handshake in IBSS timed out") + def add_ibss(dev, ssid, psk=None, proto=None, key_mgmt=None, pairwise=None, group=None): id = dev.add_network() dev.set_network(id, "mode", "1") @@ -70,11 +83,10 @@ def test_ibss_rsn(dev): connect_ibss_cmd(dev[2], id) wait_ibss_connection(dev[2]) wait_4way_handshake(dev[0], dev[2]) - wait_4way_handshake(dev[2], dev[0]) + wait_4way_handshake2(dev[2], dev[0], dev[1]) # Allow some time for all peers to complete key setup time.sleep(3) hwsim_utils.test_connectivity(dev[0].ifname, dev[1].ifname) hwsim_utils.test_connectivity(dev[0].ifname, dev[2].ifname) - time.sleep(2) hwsim_utils.test_connectivity(dev[1].ifname, dev[2].ifname)