tests: Verify that ssid_verified=1 is set appropriately

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2024-07-11 22:46:59 +03:00 committed by Jouni Malinen
parent c6f394b888
commit 42c1a512d9
3 changed files with 30 additions and 4 deletions

View file

@ -139,7 +139,8 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
sae_password_id=None, sae_and_psk=False, pmksa_caching=False,
roam_with_reassoc=False, also_non_ft=False, only_one_way=False,
wait_before_roam=0, return_after_initial=False, ieee80211w="1",
sae_transition=False, beacon_prot=False, sae_ext_key=False):
sae_transition=False, beacon_prot=False, sae_ext_key=False,
check_ssid=False):
logger.info("Connect to first AP")
copts = {}
@ -188,6 +189,8 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
hapd0.wait_sta()
else:
hapd1.wait_sta()
if check_ssid and dev[0].get_status_field("ssid_verified") == "1":
raise Exception("Unexpected ssid_verified=1 in STATUS")
dev.request("DISCONNECT")
dev.wait_disconnected()
dev.request("RECONNECT")
@ -247,6 +250,9 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
return
if dev.get_status_field('bssid') != ap2['bssid']:
raise Exception("Did not connect to correct AP")
if check_ssid and dev.get_status_field("ssid_verified") != "1":
raise Exception("ssid_verified=1 not in STATUS")
if (i == 0 or i == roams - 1) and test_connectivity:
hapd2ap.wait_sta()
dev.dump_monitor()
@ -277,6 +283,8 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
dev.roam(ap1['bssid'])
if dev.get_status_field('bssid') != ap1['bssid']:
raise Exception("Did not connect to correct AP")
if check_ssid and dev.get_status_field("ssid_verified") != "1":
raise Exception("ssid_verified=1 not in STATUS")
if (i == 0 or i == roams - 1) and test_connectivity:
hapd1ap.wait_sta()
dev.dump_monitor()
@ -3758,3 +3766,9 @@ def run_ap_ft_eap_dynamic_rxkhs(dev, apdev, f1, fn1, f2, fn2):
raise Exception("Unexpected number of RxKHs (AP1b)")
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, eap=True)
def test_ap_ft_ssid_verified(dev, apdev):
"""WPA2-PSK-FT and ssid_verified=1 indication"""
hapd0, hapd1 = start_ft(apdev)
run_roams(dev[0], apdev, hapd0, hapd1, "test-ft", "12345678",
check_ssid=True)

View file

@ -147,6 +147,9 @@ def test_fils_sk_pmksa_caching(dev, apdev, params):
if pmksa is None:
raise Exception("No PMKSA cache entry created")
if dev[0].get_status_field("ssid_verified") == "1":
raise Exception("Unexpected ssid_verified=1 in STATUS")
dev[0].request("DISCONNECT")
dev[0].wait_disconnected()
hapd.wait_sta_disconnect()
@ -160,6 +163,8 @@ def test_fils_sk_pmksa_caching(dev, apdev, params):
if "CTRL-EVENT-EAP-STARTED" in ev:
raise Exception("Unexpected EAP exchange")
hapd.wait_sta()
if dev[0].get_status_field("ssid_verified") != "1":
raise Exception("ssid_verified=1 not in STATUS")
hwsim_utils.test_connectivity(dev[0], hapd)
pmksa2 = dev[0].get_pmksa(bssid)
if pmksa2 is None:

View file

@ -1896,6 +1896,8 @@ def test_sae_password_id_pwe_looping(dev, apdev):
dev[0].connect("test-sae", sae_password="secret",
sae_password_id="pw id",
key_mgmt="SAE", scan_freq="2412")
if dev[0].get_status_field("ssid_verified") == "1":
raise Exception("Unexpected ssid_verified=1 in STATUS")
finally:
dev[0].set("sae_pwe", "0")
@ -2241,10 +2243,12 @@ def run_sae_pwe_group(dev, apdev, group):
dev[0].set("sae_groups", "")
dev[0].set("sae_pwe", "0")
def check_sae_pwe_group(dev, group, sae_pwe):
def check_sae_pwe_group(dev, group, sae_pwe, check_ssid=False):
dev.set("sae_groups", str(group))
dev.set("sae_pwe", str(sae_pwe))
dev.connect("sae-pwe", psk="12345678", key_mgmt="SAE", scan_freq="2412")
if check_ssid and dev.get_status_field("ssid_verified") != "1":
raise Exception("ssid_verified=1 not in STATUS")
dev.request("REMOVE_NETWORK all")
dev.wait_disconnected()
dev.dump_monitor()
@ -2254,8 +2258,8 @@ def test_sae_pwe_h2e_only_ap(dev, apdev):
check_sae_capab(dev[0])
start_sae_pwe_ap(apdev[0], 19, 1)
try:
check_sae_pwe_group(dev[0], 19, 1)
check_sae_pwe_group(dev[0], 19, 2)
check_sae_pwe_group(dev[0], 19, 1, check_ssid=True)
check_sae_pwe_group(dev[0], 19, 2, check_ssid=True)
finally:
dev[0].set("sae_groups", "")
dev[0].set("sae_pwe", "0")
@ -3266,3 +3270,6 @@ def test_sae_ssid_protection(dev, apdev):
raise Exception("SSID protection event not seen")
dev[0].wait_connected()
hapd.wait_sta()
if dev[0].get_status_field("ssid_verified") != "1":
raise Exception("ssid_verified=1 not in STATUS")