tests: Wait for AP-STA-CONNECT before running connectivity test

When going through 4-way handshake, the station side reports
CTRL-EVENT-CONNECTED after having sent out EAPOL-Key msg 4/4. The AP
side reports AP-STA-CONNECT after having completed processing of this
frame. Especially when using UML with time travel, it is possible for
the connectivity test to be started before the AP side has configured
the pairwise TK if the test is triggered based on CTRL-EVENT-CONNECTED
instead of AP-STA-CONNECT.

Add explicit wait for AP-STA-CONNECT in some of these cases to reduce
likelihood of reporting failures for test cases that are actually
behaving as expected. This shows up with "dev1->dev2 unicast data
delivery failed" in the test log.

Do the same before requesting reauthentication from the station side
since that has a similar issue with the EAPOL-Start frame getting
encrypted before the AP is ready for it.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-08-04 15:16:46 +03:00
parent 752e7a33e8
commit 938c6e7b3d
10 changed files with 79 additions and 7 deletions

View File

@ -262,6 +262,13 @@ class Hostapd:
break
return None
def wait_sta(self, addr=None, timeout=2):
ev = self.wait_event("AP-STA-CONNECT", timeout=timeout)
if ev is None:
raise Exception("AP did not report STA connection")
if addr and addr not in ev:
raise Exception("Unexpected STA address in connection event: " + ev)
def get_status(self):
res = self.request("STATUS")
lines = res.splitlines()

View File

@ -34,6 +34,7 @@ def check_cipher(dev, ap, cipher, group_cipher=None):
hapd = hostapd.add_ap(ap, params)
dev.connect("test-wpa2-psk", psk="12345678",
pairwise=cipher, group=group_cipher, scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity(dev, hapd)
def check_group_mgmt_cipher(dev, ap, cipher, sta_req_cipher=None):
@ -56,6 +57,7 @@ def check_group_mgmt_cipher(dev, ap, cipher, sta_req_cipher=None):
dev.connect("test-wpa2-psk-pmf", psk="12345678", ieee80211w="2",
key_mgmt="WPA-PSK-SHA256", group_mgmt=sta_req_cipher,
pairwise="CCMP", group="CCMP", scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity(dev, hapd)
hapd.request("DEAUTHENTICATE ff:ff:ff:ff:ff:ff")
dev.wait_disconnected()
@ -388,6 +390,7 @@ def test_ap_cipher_mixed_wpa_wpa2(dev, apdev):
raise Exception("Missing BSS flag WPA-PSK-TKIP")
if "[WPA2-PSK-CCMP]" not in bss['flags']:
raise Exception("Missing BSS flag WPA2-PSK-CCMP")
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd)
dev[1].connect(ssid, psk=passphrase, proto="WPA",
@ -399,6 +402,7 @@ def test_ap_cipher_mixed_wpa_wpa2(dev, apdev):
raise Exception("Incorrect pairwise_cipher reported")
if status['group_cipher'] != 'TKIP':
raise Exception("Incorrect group_cipher reported")
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[1], hapd)
hwsim_utils.test_connectivity(dev[0], dev[1])
@ -535,6 +539,7 @@ def run_ap_cipher_replay_protection_ap(dev, apdev, cipher):
dev[0].connect("test-wpa2-psk", psk="12345678",
pairwise=cipher, group=cipher, scan_freq="2412")
hapd.wait_sta()
if cipher != "TKIP":
replays = get_tk_replay_counter(phy)
@ -604,6 +609,7 @@ def run_ap_cipher_replay_protection_sta(dev, apdev, cipher, gtk=False):
phy = dev[0].get_driver_status_field("phyname")
dev[0].connect("test-wpa2-psk", psk="12345678",
pairwise=cipher, group=cipher, scan_freq="2412")
hapd.wait_sta()
if cipher != "TKIP":
replays = get_tk_replay_counter(phy, gtk)
@ -658,6 +664,7 @@ def run_ap_wpa2_delayed_m3_retransmission(dev, apdev):
phy = dev[0].get_driver_status_field("phyname")
dev[0].connect("test-wpa2-psk", psk="12345678", scan_freq="2412")
hapd.wait_sta()
for i in range(5):
hwsim_utils.test_connectivity(dev[0], hapd)
@ -738,6 +745,7 @@ def run_ap_wpa2_delayed_m1_m3_retransmission(dev, apdev,
phy = dev[0].get_driver_status_field("phyname")
dev[0].connect("test-wpa2-psk", psk="12345678", scan_freq="2412")
hapd.wait_sta()
for i in range(5):
hwsim_utils.test_connectivity(dev[0], hapd)
@ -805,6 +813,7 @@ def run_ap_wpa2_delayed_group_m1_retransmission(dev, apdev):
phy = dev[0].get_driver_status_field("phyname")
dev[0].connect("test-wpa2-psk", psk="12345678", scan_freq="2412")
hapd.wait_sta()
for i in range(5):
hwsim_utils.test_connectivity(dev[0], hapd)
@ -842,6 +851,7 @@ def test_ap_wpa2_delayed_m1_m3_zero_tk(dev, apdev):
wt.add_passphrase("12345678")
dev[0].connect("test-wpa2-psk", psk="12345678", scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd)
addr = dev[0].own_addr()

View File

@ -790,7 +790,7 @@ def test_ap_wpa2_eap_sim_change_bssid(dev, apdev):
def _test_ap_wpa2_eap_sim_change_bssid(dev, apdev):
check_hlr_auc_gw_support()
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0], params)
hapd = hostapd.add_ap(apdev[0], params)
dev[0].request("SET external_sim 1")
id = dev[0].connect("test-wpa2-eap", eap="SIM", key_mgmt="WPA-EAP",
identity="1232010000000000",
@ -815,6 +815,7 @@ def _test_ap_wpa2_eap_sim_change_bssid(dev, apdev):
dev[0].request("CTRL-RSP-SIM-" + rid + ":GSM-AUTH:" + resp)
dev[0].wait_connected(timeout=15)
hapd.wait_sta()
# Verify that EAP-SIM Reauthentication can be used after a profile change
# that does not affect EAP parameters.
@ -831,7 +832,7 @@ def test_ap_wpa2_eap_sim_no_change_set(dev, apdev):
def _test_ap_wpa2_eap_sim_no_change_set(dev, apdev):
check_hlr_auc_gw_support()
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0], params)
hapd = hostapd.add_ap(apdev[0], params)
dev[0].request("SET external_sim 1")
id = dev[0].connect("test-wpa2-eap", eap="SIM", key_mgmt="WPA-EAP",
identity="1232010000000000",
@ -856,6 +857,7 @@ def _test_ap_wpa2_eap_sim_no_change_set(dev, apdev):
dev[0].request("CTRL-RSP-SIM-" + rid + ":GSM-AUTH:" + resp)
dev[0].wait_connected(timeout=15)
hapd.wait_sta()
# Verify that EAP-SIM Reauthentication can be used after network profile
# SET_NETWORK commands that do not actually change previously set
@ -1844,7 +1846,7 @@ def test_ap_wpa2_eap_ttls_eap_sim(dev, apdev):
ca_cert="auth_serv/ca.pem", phase2="autheap=SIM")
eap_reauth(dev[0], "TTLS")
def run_ext_sim_auth(dev):
def run_ext_sim_auth(hapd, dev):
ev = dev.wait_event(["CTRL-REQ-SIM"], timeout=15)
if ev is None:
raise Exception("Wait for external SIM processing request timed out")
@ -1864,6 +1866,7 @@ def run_ext_sim_auth(dev):
dev.request("CTRL-RSP-SIM-" + rid + ":GSM-AUTH:" + resp)
dev.wait_connected(timeout=15)
hapd.wait_sta()
dev.dump_monitor()
dev.request("REAUTHENTICATE")
@ -1893,7 +1896,7 @@ def run_ap_wpa2_eap_ttls_eap_sim_ext(dev, apdev):
password="90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82581",
ca_cert="auth_serv/ca.pem", phase2="autheap=SIM",
wait_connect=False, scan_freq="2412")
run_ext_sim_auth(dev[0])
run_ext_sim_auth(hapd, dev[0])
def test_ap_wpa2_eap_peap_eap_sim(dev, apdev):
"""WPA2-Enterprise connection using EAP-PEAP/EAP-SIM"""
@ -1923,7 +1926,7 @@ def run_ap_wpa2_eap_peap_eap_sim_ext(dev, apdev):
password="90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82581",
ca_cert="auth_serv/ca.pem", phase2="auth=SIM",
wait_connect=False, scan_freq="2412")
run_ext_sim_auth(dev[0])
run_ext_sim_auth(hapd, dev[0])
def test_ap_wpa2_eap_fast_eap_sim(dev, apdev):
"""WPA2-Enterprise connection using EAP-FAST/EAP-SIM"""
@ -1958,7 +1961,7 @@ def run_ap_wpa2_eap_fast_eap_sim_ext(dev, apdev):
pac_file="blob://fast_pac_auth_sim",
ca_cert="auth_serv/ca.pem", phase2="auth=SIM",
wait_connect=False, scan_freq="2412")
run_ext_sim_auth(dev[0])
run_ext_sim_auth(hapd, dev[0])
def test_ap_wpa2_eap_ttls_eap_aka(dev, apdev):
"""WPA2-Enterprise connection using EAP-TTLS/EAP-AKA"""
@ -3289,6 +3292,7 @@ def test_ap_wpa_eap_peap_eap_mschapv2(dev, apdev):
ca_cert="auth_serv/ca.pem", wait_connect=False,
scan_freq="2412")
eap_check_auth(dev[0], "PEAP", True, rsn=False)
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd)
eap_reauth(dev[0], "PEAP", rsn=False)
check_mib(dev[0], [("dot11RSNAAuthenticationSuiteRequested", "00-50-f2-1"),
@ -6806,6 +6810,7 @@ def test_ap_wpa2_eap_gpsk_ptk_rekey_ap(dev, apdev):
ev = dev[0].wait_event(["WPA: Key negotiation completed"])
if ev is None:
raise Exception("PTK rekey timed out")
time.sleep(0.1)
hwsim_utils.test_connectivity(dev[0], hapd)
def test_ap_wpa2_eap_wildcard_ssid(dev, apdev):

View File

@ -199,6 +199,7 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
hapd1ap = hapd1
hapd2ap = hapd0
if test_connectivity:
hapd1ap.wait_sta()
if conndev:
hwsim_utils.test_connectivity_iface(dev, hapd1ap, conndev)
else:
@ -224,6 +225,7 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
if dev.get_status_field('bssid') != ap2['bssid']:
raise Exception("Did not connect to correct AP")
if (i == 0 or i == roams - 1) and test_connectivity:
hapd2ap.wait_sta()
if conndev:
hwsim_utils.test_connectivity_iface(dev, hapd2ap, conndev)
else:
@ -246,6 +248,7 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
if dev.get_status_field('bssid') != ap1['bssid']:
raise Exception("Did not connect to correct AP")
if (i == 0 or i == roams - 1) and test_connectivity:
hapd1ap.wait_sta()
if conndev:
hwsim_utils.test_connectivity_iface(dev, hapd1ap, conndev)
else:

View File

@ -322,6 +322,7 @@ def test_ap_wpa_ccmp(dev, apdev):
params['wpa_pairwise'] = "CCMP"
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd)
check_mib(dev[0], [("dot11RSNAConfigGroupCipherSize", "128"),
("dot11RSNAGroupCipherRequested", "00-50-f2-4"),
@ -505,6 +506,8 @@ def test_ap_wpa2_bridge_fdb(dev, apdev):
bssid=apdev[0]['bssid'])
dev[1].connect(ssid, psk=passphrase, scan_freq="2412",
bssid=apdev[0]['bssid'])
hapd.wait_sta()
hapd.wait_sta()
addr0 = dev[0].p2p_interface_addr()
hwsim_utils.test_connectivity_sta(dev[0], dev[1])
err, macs1 = hapd.cmd_execute(['brctl', 'showmacs', 'ap-br0'])
@ -575,6 +578,7 @@ def test_ap_wpa2_in_different_bridge(dev, apdev):
if brname != 'ap-br0':
raise Exception("Incorrect bridge: " + brname)
dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity_iface(dev[0], hapd, "ap-br0")
if hapd.get_driver_status_field("added_bridge") != "1":
raise Exception("Unexpected added_bridge value")
@ -2644,6 +2648,7 @@ def test_ap_wpa2_psk_ifdown(dev, apdev):
if ev is None:
raise Exception("No INTERFACE-ENABLED event")
dev[0].wait_connected()
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd)
def test_ap_wpa2_psk_drop_first_msg_4(dev, apdev):
@ -2729,6 +2734,7 @@ def test_ap_wpa2_psk_disable_enable(dev, apdev):
dev[0].wait_disconnected()
hapd.request("ENABLE")
dev[0].wait_connected()
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd)
@remote_compatible

View File

@ -54,12 +54,15 @@ def test_ap_roam_wpa2_psk(dev, apdev):
params = hostapd.wpa2_params(ssid="test-wpa2-psk", passphrase="12345678")
hapd0 = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wpa2-psk", psk="12345678")
hapd0.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd0)
hapd1 = hostapd.add_ap(apdev[1], params)
dev[0].scan(type="ONLY")
dev[0].roam(apdev[1]['bssid'])
hapd1.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd1)
dev[0].roam(apdev[0]['bssid'])
hapd0.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd0)
def get_blacklist(dev):
@ -77,6 +80,7 @@ def test_ap_reconnect_auth_timeout(dev, apdev, params):
wpas.scan_for_bss(bssid0, freq=2412)
id = wpas.connect("test-wpa2-psk", psk="12345678", scan_freq="2412")
hapd0.wait_sta()
hwsim_utils.test_connectivity(wpas, hapd0)
hapd1 = hostapd.add_ap(apdev[1], params)
@ -116,6 +120,7 @@ def test_ap_roam_with_reassoc_auth_timeout(dev, apdev, params):
bssid0 = hapd0.own_addr()
id = wpas.connect("test-wpa2-psk", psk="12345678", scan_freq="2412")
hapd0.wait_sta()
hwsim_utils.test_connectivity(wpas, hapd0)
hapd1 = hostapd.add_ap(apdev[1], params)
@ -144,6 +149,7 @@ def test_ap_roam_wpa2_psk_failed(dev, apdev, params):
params = hostapd.wpa2_params(ssid="test-wpa2-psk", passphrase="12345678")
hapd0 = hostapd.add_ap(apdev[0], params)
id = dev[0].connect("test-wpa2-psk", psk="12345678", scan_freq="2412")
hapd0.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd0)
params['wpa_passphrase'] = "22345678"
hapd1 = hostapd.add_ap(apdev[1], params)
@ -169,6 +175,7 @@ def test_ap_roam_wpa2_psk_failed(dev, apdev, params):
raise Exception("CTRL-EVENT-SSID-REENABLED not seen")
dev[0].wait_connected(timeout=5)
hapd0.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd0)
@remote_compatible
@ -176,19 +183,23 @@ def test_ap_reassociation_to_same_bss(dev, apdev):
"""Reassociate to the same BSS"""
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-open"})
dev[0].connect("test-open", key_mgmt="NONE")
hapd.wait_sta()
dev[0].request("REASSOCIATE")
dev[0].wait_connected(timeout=10, error="Reassociation timed out")
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd)
dev[0].request("REATTACH")
dev[0].wait_connected(timeout=10, error="Reattach timed out")
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd)
# Wait for previous scan results to expire to trigger new scan
time.sleep(5)
dev[0].request("REATTACH")
dev[0].wait_connected(timeout=10, error="Reattach timed out")
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd)
@remote_compatible
@ -214,14 +225,17 @@ def test_ap_roam_wpa2_psk_race(dev, apdev):
params = hostapd.wpa2_params(ssid="test-wpa2-psk", passphrase="12345678")
hapd0 = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wpa2-psk", psk="12345678", scan_freq="2412")
hapd0.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd0)
params['channel'] = '2'
hapd1 = hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(apdev[1]['bssid'], freq=2417)
dev[0].roam(apdev[1]['bssid'])
hapd1.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd1)
dev[0].roam(apdev[0]['bssid'])
hapd0.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd0)
# Wait at least two seconds to trigger the previous issue with the
# disconnection callback.

View File

@ -117,6 +117,9 @@ def test_ap_vlan_wpa2(dev, apdev):
dev[0].connect("test-vlan", psk="12345678", scan_freq="2412")
dev[1].connect("test-vlan", psk="12345678", scan_freq="2412")
dev[2].connect("test-vlan", psk="12345678", scan_freq="2412")
hapd.wait_sta()
hapd.wait_sta()
hapd.wait_sta()
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
hwsim_utils.test_connectivity_iface(dev[1], hapd, "brvlan2")
hwsim_utils.test_connectivity(dev[2], hapd)
@ -139,6 +142,9 @@ def test_ap_vlan_wpa2_radius(dev, apdev):
identity="pax.user@example.com",
password_hex="0123456789abcdef0123456789abcdef",
scan_freq="2412")
hapd.wait_sta()
hapd.wait_sta()
hapd.wait_sta()
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
hwsim_utils.test_connectivity_iface(dev[1], hapd, "brvlan2")
hwsim_utils.test_connectivity(dev[2], hapd)
@ -154,6 +160,7 @@ def test_ap_vlan_wpa2_radius_2(dev, apdev):
password_hex="0123456789abcdef0123456789abcdef",
scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
def test_ap_vlan_wpa2_radius_local(dev, apdev):
@ -177,6 +184,9 @@ def test_ap_vlan_wpa2_radius_local(dev, apdev):
identity="pax.user@example.com",
password_hex="0123456789abcdef0123456789abcdef",
scan_freq="2412")
hapd.wait_sta()
hapd.wait_sta()
hapd.wait_sta()
hwsim_utils.test_connectivity_iface(dev[0], hapd, "test_br_vlan1")
hwsim_utils.test_connectivity_iface(dev[1], hapd, "test_br_vlan2")
hwsim_utils.test_connectivity(dev[2], hapd)
@ -229,6 +239,7 @@ def generic_ap_vlan_wpa2_radius_id_change(dev, apdev, tagged):
identity=identity,
password_hex="0123456789abcdef0123456789abcdef",
scan_freq="2412")
hapd.wait_sta()
if tagged:
hwsim_utils.run_connectivity_test(dev[0], hapd, 0, ifname1="wlan0.1",
ifname2="brvlan1")
@ -421,6 +432,7 @@ def ap_vlan_iface_cleanup_multibss(dev, apdev, cfgfile):
identity="vlan1",
password_hex="0123456789abcdef0123456789abcdef",
scan_freq="2412")
hapd.wait_sta()
ifaces = netifaces.interfaces()
if "brvlan1" not in ifaces:
@ -435,6 +447,7 @@ def ap_vlan_iface_cleanup_multibss(dev, apdev, cfgfile):
password_hex="0123456789abcdef0123456789abcdef",
scan_freq="2412")
hapd1.wait_sta()
hwsim_utils.test_connectivity_iface(dev[1], hapd1, "brvlan1")
if not iface_is_in_bridge("brvlan1", "dummy0.1"):
raise Exception("dummy0.1 not in brvlan1")
@ -701,6 +714,7 @@ def test_ap_vlan_reconnect(dev, apdev):
logger.info("connect sta")
dev[0].connect("test-vlan", psk="12345678", scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
logger.info("disconnect sta")
dev[0].request("REMOVE_NETWORK all")
@ -708,6 +722,7 @@ def test_ap_vlan_reconnect(dev, apdev):
time.sleep(1)
logger.info("reconnect sta")
dev[0].connect("test-vlan", psk="12345678", scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
def test_ap_vlan_psk(dev, apdev, params):
@ -727,6 +742,9 @@ def test_ap_vlan_psk(dev, apdev, params):
dev[0].connect(ssid, psk="passphrase-for-vlan-1", scan_freq="2412")
dev[1].connect(ssid, psk="passphrase-for-vlan-2", scan_freq="2412")
dev[2].connect(ssid, psk="passphrase-for-vlan-3", scan_freq="2412")
hapd.wait_sta()
hapd.wait_sta()
hapd.wait_sta()
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
hwsim_utils.test_connectivity_iface(dev[1], hapd, "brvlan2")
hwsim_utils.test_connectivity_iface(dev[2], hapd, "brvlan3")
@ -749,6 +767,7 @@ def test_ap_vlan_sae(dev, apdev, params):
dev[i].connect("test-sae-vlan", sae_password="pw%d" % (i + 1),
sae_password_id="id%d" % (i + 1),
key_mgmt="SAE", scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
hwsim_utils.test_connectivity_iface(dev[1], hapd, "brvlan2")

View File

@ -339,6 +339,7 @@ def test_pmksa_cache_expiration(dev, apdev):
eap="GPSK", identity="gpsk user",
password="abcdefghijklmnop0123456789abcdef",
scan_freq="2412")
hapd.wait_sta()
pmksa = dev[0].get_pmksa(bssid)
if pmksa is None:
raise Exception("No PMKSA cache entry created")
@ -494,7 +495,7 @@ def generic_pmksa_cache_preauth(dev, apdev, extraparams, identity, databridge,
params['rsn_preauth_interfaces'] = databridge
for key, value in extraparams[1].items():
params[key] = value
hostapd.add_ap(apdev[1], params)
hapd1 = hostapd.add_ap(apdev[1], params)
bssid1 = apdev[1]['bssid']
dev[0].scan(freq="2412")
success = False
@ -530,6 +531,7 @@ def generic_pmksa_cache_preauth(dev, apdev, extraparams, identity, databridge,
if pmksa['pmkid'] != pmksa2['pmkid']:
raise Exception("Unexpected PMKID change")
hapd1.wait_sta()
# Verify connectivity in the correct VLAN
hwsim_utils.test_connectivity_iface(dev[0], hapd, databridge)

View File

@ -64,6 +64,7 @@ def test_rfkill_wpa2_psk(dev, apdev):
params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
hapd.wait_sta()
try:
logger.info("rfkill block")
rfk.block()
@ -74,6 +75,7 @@ def test_rfkill_wpa2_psk(dev, apdev):
rfk.unblock()
dev[0].wait_connected(timeout=10,
error="Missing connection event on rfkill unblock")
hapd.wait_sta()
hwsim_utils.test_connectivity(dev[0], hapd)
finally:
rfk.unblock()

View File

@ -119,6 +119,7 @@ def test_sta_dynamic_down_up(dev, apdev):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5")
wpas.connect("sta-dynamic", psk="12345678", scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity(wpas, hapd)
subprocess.call(['ifconfig', wpas.ifname, 'down'])
wpas.wait_disconnected(timeout=10)
@ -126,6 +127,7 @@ def test_sta_dynamic_down_up(dev, apdev):
raise Exception("Unexpected wpa_state")
subprocess.call(['ifconfig', wpas.ifname, 'up'])
wpas.wait_connected(timeout=15, error="Reconnection not reported")
hapd.wait_sta()
hwsim_utils.test_connectivity(wpas, hapd)
def test_sta_dynamic_ext_mac_addr_change(dev, apdev):
@ -137,6 +139,7 @@ def test_sta_dynamic_ext_mac_addr_change(dev, apdev):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5")
wpas.connect("sta-dynamic", psk="12345678", scan_freq="2412")
hapd.wait_sta()
hwsim_utils.test_connectivity(wpas, hapd)
subprocess.call(['ifconfig', wpas.ifname, 'down'])
wpas.wait_disconnected(timeout=10)
@ -151,6 +154,7 @@ def test_sta_dynamic_ext_mac_addr_change(dev, apdev):
wpas.wait_connected(timeout=15, error="Reconnection not reported")
if wpas.get_driver_status_field('addr') != new_addr:
raise Exception("Address change not reported")
hapd.wait_sta()
hwsim_utils.test_connectivity(wpas, hapd)
sta = hapd.get_sta(new_addr)
if sta['addr'] != new_addr: