Updated to hostap_2_6
[mech_eap.git] / libeap / tests / hwsim / test_wep.py
index bd8fec0..85ed028 100644 (file)
@@ -4,12 +4,18 @@
 # This software may be distributed under the terms of the BSD license.
 # See README for more details.
 
+import logging
+logger = logging.getLogger()
+import subprocess
+
+from remotehost import remote_compatible
 import hostapd
 import hwsim_utils
 
+@remote_compatible
 def test_wep_open_auth(dev, apdev):
     """WEP Open System authentication"""
-    hapd = hostapd.add_ap(apdev[0]['ifname'],
+    hapd = hostapd.add_ap(apdev[0],
                           { "ssid": "wep-open",
                             "wep_key0": '"hello"' })
     dev[0].flush_scan_cache()
@@ -25,9 +31,10 @@ def test_wep_open_auth(dev, apdev):
     if "[WEP]" not in bss['flags']:
         raise Exception("Unexpected BSS flags: " + bss['flags'])
 
+@remote_compatible
 def test_wep_shared_key_auth(dev, apdev):
     """WEP Shared Key authentication"""
-    hapd = hostapd.add_ap(apdev[0]['ifname'],
+    hapd = hostapd.add_ap(apdev[0],
                           { "ssid": "wep-shared-key",
                             "wep_key0": '"hello12345678"',
                             "auth_algs": "2" })
@@ -39,9 +46,10 @@ def test_wep_shared_key_auth(dev, apdev):
                    wep_key0='"hello12345678"',
                    scan_freq="2412")
 
+@remote_compatible
 def test_wep_shared_key_auth_not_allowed(dev, apdev):
     """WEP Shared Key authentication not allowed"""
-    hostapd.add_ap(apdev[0]['ifname'],
+    hostapd.add_ap(apdev[0],
                    { "ssid": "wep-shared-key",
                      "wep_key0": '"hello12345678"',
                      "auth_algs": "1" })
@@ -54,7 +62,7 @@ def test_wep_shared_key_auth_not_allowed(dev, apdev):
 
 def test_wep_shared_key_auth_multi_key(dev, apdev):
     """WEP Shared Key authentication with multiple keys"""
-    hapd = hostapd.add_ap(apdev[0]['ifname'],
+    hapd = hostapd.add_ap(apdev[0],
                           { "ssid": "wep-shared-key",
                             "wep_key0": '"hello12345678"',
                             "wep_key1": '"other12345678"',
@@ -80,3 +88,38 @@ def test_wep_shared_key_auth_multi_key(dev, apdev):
     dev[2].request("REASSOCIATE")
     dev[2].wait_connected(timeout=10, error="Reassociation timed out")
     hwsim_utils.test_connectivity(dev[2], hapd)
+
+def test_wep_ht_vht(dev, apdev):
+    """WEP and HT/VHT"""
+    dev[0].flush_scan_cache()
+    try:
+        hapd = None
+        params = { "ssid": "test-vht40-wep",
+                   "country_code": "SE",
+                   "hw_mode": "a",
+                   "channel": "36",
+                   "ieee80211n": "1",
+                   "ieee80211ac": "1",
+                   "ht_capab": "[HT40+]",
+                   "vht_capab": "",
+                   "vht_oper_chwidth": "0",
+                   "vht_oper_centr_freq_seg0_idx": "0",
+                   "wep_key0": '"hello"' }
+        hapd = hostapd.add_ap(apdev[0], params)
+        dev[0].connect("test-vht40-wep", scan_freq="5180", key_mgmt="NONE",
+                       wep_key0='"hello"')
+        hwsim_utils.test_connectivity(dev[0], hapd)
+        status = hapd.get_status()
+        logger.info("hostapd STATUS: " + str(status))
+        if status["ieee80211n"] != "0":
+            raise Exception("Unexpected STATUS ieee80211n value")
+        if status["ieee80211ac"] != "0":
+            raise Exception("Unexpected STATUS ieee80211ac value")
+        if status["secondary_channel"] != "0":
+            raise Exception("Unexpected STATUS secondary_channel value")
+    finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
+        subprocess.call(['iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()