]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: SAE-PK mixed deployment
authorJouni Malinen <jouni@codeaurora.org>
Sun, 7 Jun 2020 13:50:09 +0000 (16:50 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 7 Jun 2020 13:50:09 +0000 (16:50 +0300)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/test_sae_pk.py

index 73dea23ffcb9618ef721e20678fc91869dcca494..14bfe42f460b305c7443c1fc2d11f2b9fe0d6f4c 100644 (file)
@@ -232,3 +232,35 @@ def test_sae_pk_transition_disable(dev, apdev):
     val = dev[0].get_network(id, "sae_pk")
     if val != "1":
         raise Exception("Unexpected sae_pk value: " + str(val))
+
+def test_sae_pk_mixed(dev, apdev):
+    """SAE-PK mixed deployment"""
+    check_sae_pk_capab(dev[0])
+    dev[0].set("sae_groups", "")
+
+    params = hostapd.wpa2_params(ssid=SAE_PK_SEC2_SSID)
+    params['wpa_key_mgmt'] = 'SAE'
+    params['sae_password'] = SAE_PK_SEC2_PW
+    hapd = hostapd.add_ap(apdev[0], params)
+    bssid = hapd.own_addr()
+
+    params = hostapd.wpa2_params(ssid=SAE_PK_SEC2_SSID)
+    params['wpa_key_mgmt'] = 'SAE'
+    params['sae_password'] = ['%s|pk=%s:%s' % (SAE_PK_SEC2_PW, SAE_PK_SEC2_M,
+                                               SAE_PK_SEC2_PK)]
+    # Disable HT from the SAE-PK BSS to make the station prefer the other BSS
+    # by default.
+    params['ieee80211n'] = '0'
+    hapd2 = hostapd.add_ap(apdev[1], params)
+    bssid2 = hapd2.own_addr()
+
+    dev[0].scan_for_bss(bssid, freq=2412)
+    dev[0].scan_for_bss(bssid2, freq=2412)
+
+    dev[0].connect(SAE_PK_SEC2_SSID, sae_password=SAE_PK_SEC2_PW,
+                   key_mgmt="SAE", scan_freq="2412")
+
+    if dev[0].get_status_field("sae_pk") != "1":
+        raise Exception("SAE-PK was not used")
+    if dev[0].get_status_field("bssid") != bssid2:
+        raise Exception("Unexpected BSSID selected")