]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Verify SAE anti-clogging mechanism
authorJouni Malinen <j@w1.fi>
Sun, 29 Dec 2013 10:24:25 +0000 (12:24 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 29 Dec 2013 15:18:17 +0000 (17:18 +0200)
Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/test_sae.py
tests/hwsim/wpasupplicant.py

index 39d745f3be53bdb9ea34a5b6efaf73d827772dd0..3461c54c6be375ab13c3c40d0bc9665a8bb9026f 100644 (file)
@@ -63,3 +63,24 @@ def test_sae_group_nego(dev, apdev):
                    scan_freq="2412")
     if dev[0].get_status_field('sae_group') != '19':
         raise Exception("Expected SAE group not used")
+
+def test_sae_anti_clogging(dev, apdev):
+    """SAE anti clogging"""
+    params = hostapd.wpa2_params(ssid="test-sae", passphrase="12345678")
+    params['wpa_key_mgmt'] = 'SAE'
+    params['sae_anti_clogging_threshold'] = '1'
+    hostapd.add_ap(apdev[0]['ifname'], params)
+
+    dev[0].request("SET sae_groups ")
+    dev[1].request("SET sae_groups ")
+    id = {}
+    for i in range(0, 2):
+        dev[i].scan(freq="2412")
+        id[i] = dev[i].connect("test-sae", psk="12345678", key_mgmt="SAE",
+                               scan_freq="2412", only_add_network=True)
+    for i in range(0, 2):
+        dev[i].select_network(id[i])
+    for i in range(0, 2):
+        ev = dev[i].wait_event(["CTRL-EVENT-CONNECTED"], timeout=10)
+        if ev is None:
+            raise Exception("Association with the AP timed out")
index ad6972573c4725efffdbb0672fe439bd5ce1b348..2ce964ba5b9ecb9b674959612b0dce14be4d61d1 100644 (file)
@@ -533,7 +533,7 @@ class WpaSupplicant:
                 password=None, phase1=None, phase2=None, ca_cert=None,
                 domain_suffix_match=None, password_hex=None,
                 client_cert=None, private_key=None, peerkey=False,
-                wait_connect=True):
+                wait_connect=True, only_add_network=False):
         logger.info("Connect STA " + self.ifname + " to AP")
         id = self.add_network()
         self.set_network_quoted(id, "ssid", ssid)
@@ -579,6 +579,8 @@ class WpaSupplicant:
                                     domain_suffix_match)
         if peerkey:
             self.set_network(id, "peerkey", "1")
+        if only_add_network:
+            return id
         if wait_connect:
             self.connect_network(id)
         else: