[PATCH 24/44] test: FT with broadcasts

michael-dev at fami-braun.de michael-dev at fami-braun.de
Wed Feb 24 03:53:30 PST 2016


From: Michael Braun <michael-dev at fami-braun.de>

Signed-off-by: Michael Braun <michael-dev at fami-braun.de>
---
 tests/hwsim/test_ap_ft.py | 62 ++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 48 insertions(+), 14 deletions(-)

diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index 4143072..9657ea4 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -58,11 +58,15 @@ def ft_params1a(rsn=True, ssid=None, passphrase=None):
     params['r1_key_holder'] = "000102030405"
     return params
 
-def ft_params1(rsn=True, ssid=None, passphrase=None):
+def ft_params1(rsn=True, ssid=None, passphrase=None, discovery=False):
     params = ft_params1a(rsn, ssid, passphrase)
-    params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 100102030405060708090a0b0c0d0e0f",
-                       "02:00:00:00:04:00 nas2.w1.fi 300102030405060708090a0b0c0d0e0f" ]
-    params['r1kh'] = "02:00:00:00:04:00 00:01:02:03:04:06 200102030405060708090a0b0c0d0e0f"
+    if discovery:
+        params['r0kh'] = "ff:ff:ff:ff:ff:ff * 100102030405060708090a0b0c0d0e0f"
+        params['r1kh'] = "00:00:00:00:00:00 00:00:00:00:00:00 100102030405060708090a0b0c0d0e0f"
+    else:
+        params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 100102030405060708090a0b0c0d0e0f",
+                           "02:00:00:00:04:00 nas2.w1.fi 300102030405060708090a0b0c0d0e0f" ]
+        params['r1kh'] = "02:00:00:00:04:00 00:01:02:03:04:06 200102030405060708090a0b0c0d0e0f"
     return params
 
 def ft_params2a(rsn=True, ssid=None, passphrase=None):
@@ -71,11 +75,15 @@ def ft_params2a(rsn=True, ssid=None, passphrase=None):
     params['r1_key_holder'] = "000102030406"
     return params
 
-def ft_params2(rsn=True, ssid=None, passphrase=None):
+def ft_params2(rsn=True, ssid=None, passphrase=None, discovery=False):
     params = ft_params2a(rsn, ssid, passphrase)
-    params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f",
-                       "02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0e0f" ]
-    params['r1kh'] = "02:00:00:00:03:00 00:01:02:03:04:05 300102030405060708090a0b0c0d0e0f"
+    if discovery:
+        params['r0kh'] = "ff:ff:ff:ff:ff:ff * 100102030405060708090a0b0c0d0e0f"
+        params['r1kh'] = "00:00:00:00:00:00 00:00:00:00:00:00 100102030405060708090a0b0c0d0e0f"
+    else:
+        params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f",
+                           "02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0e0f" ]
+        params['r1kh'] = "02:00:00:00:03:00 00:01:02:03:04:05 300102030405060708090a0b0c0d0e0f"
     return params
 
 def ft_params1_r0kh_mismatch(rsn=True, ssid=None, passphrase=None):
@@ -600,8 +608,7 @@ def test_ap_ft_sae_over_ds(dev, apdev):
     run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, sae=True,
               over_ds=True)
 
-def generic_ap_ft_eap(dev, apdev, vlan, over_ds=False):
-    """WPA2-EAP-FT AP"""
+def generic_ap_ft_eap(dev, apdev, vlan, over_ds=False, discovery=False, roams=1):
     ssid = "test-ft"
     passphrase="12345678"
     if vlan:
@@ -612,7 +619,7 @@ def generic_ap_ft_eap(dev, apdev, vlan, over_ds=False):
         conndev=False
 
     radius = hostapd.radius_params()
-    params = ft_params1(ssid=ssid, passphrase=passphrase)
+    params = ft_params1(ssid=ssid, passphrase=passphrase, discovery=discovery)
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
     if vlan:
@@ -622,7 +629,7 @@ def generic_ap_ft_eap(dev, apdev, vlan, over_ds=False):
     key_mgmt = hapd.get_config()['key_mgmt']
     if key_mgmt.split(' ')[0] != "FT-EAP":
         raise Exception("Unexpected GET_CONFIG(key_mgmt): " + key_mgmt)
-    params = ft_params2(ssid=ssid, passphrase=passphrase)
+    params = ft_params2(ssid=ssid, passphrase=passphrase, discovery=discovery)
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
     if vlan:
@@ -630,7 +637,7 @@ def generic_ap_ft_eap(dev, apdev, vlan, over_ds=False):
     params = dict(radius.items() + params.items())
     hapd1 = hostapd.add_ap(apdev[1]['ifname'], params)
 
-    run_roams(dev[0], apdev, hapd, hapd1, ssid, passphrase, eap=True, eap_identity=identity, conndev=conndev, over_ds=over_ds)
+    run_roams(dev[0], apdev, hapd, hapd1, ssid, passphrase, eap=True, eap_identity=identity, conndev=conndev, over_ds=over_ds, roams=roams)
     if "[WPA2-FT/EAP-CCMP]" not in dev[0].request("SCAN_RESULTS"):
         raise Exception("Scan results missing RSN element info")
     check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-3"),
@@ -649,7 +656,10 @@ def generic_ap_ft_eap(dev, apdev, vlan, over_ds=False):
     if ev is None:
         raise Exception("EAP authentication did not succeed")
     time.sleep(0.1)
-    hwsim_utils.test_connectivity(dev[0], ap)
+    if conndev:
+      hwsim_utils.test_connectivity_iface(dev[0], ap, conndev)
+    else:
+      hwsim_utils.test_connectivity(dev[0], ap)
 
 def test_ap_ft_eap(dev, apdev):
     """WPA2-EAP-FT AP"""
@@ -675,6 +685,30 @@ def test_ap_ft_eap_vlan_over_ds_multi(dev, apdev):
     """WPA2-EAP-FT AP w VLAN + over_ds"""
     generic_ap_ft_eap(dev, apdev, vlan=True, over_ds=True, roams=50)
 
+def test_ap_ft_eap_dis(dev, apdev):
+    """WPA2-EAP-FT AP w discovery"""
+    generic_ap_ft_eap(dev, apdev, vlan=False, discovery=True)
+
+def test_ap_ft_eap_dis_vlan(dev, apdev):
+    """WPA2-EAP-FT AP w discovery + VLAN"""
+    generic_ap_ft_eap(dev, apdev, vlan=True, discovery=True)
+
+def test_ap_ft_eap_dis_vlan_multi(dev, apdev):
+    """WPA2-EAP-FT AP w discovery + VLAN"""
+    generic_ap_ft_eap(dev, apdev, vlan=True, discovery=True, roams=50)
+
+def test_ap_ft_eap_dis_over_ds(dev, apdev):
+    """WPA2-EAP-FT AP w discovery + over_ds"""
+    generic_ap_ft_eap(dev, apdev, vlan=False, over_ds=True, discovery=True)
+
+def test_ap_ft_eap_dis_vlan_over_ds(dev, apdev):
+    """WPA2-EAP-FT AP w discovery + over_ds + VLAN"""
+    generic_ap_ft_eap(dev, apdev, vlan=True, over_ds=True, discovery=True)
+
+def test_ap_ft_eap_dis_vlan_over_ds(dev, apdev):
+    """WPA2-EAP-FT AP w discovery + over_ds + VLAN"""
+    generic_ap_ft_eap(dev, apdev, vlan=True, over_ds=True, discovery=True, roams=50)
+
 def generic_ap_ft_eap_pull(dev, apdev, vlan):
     """WPA2-EAP-FT AP (pull PMK)"""
     ssid = "test-ft"
-- 
1.9.1




More information about the Hostap mailing list