]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Verify mixed mode WPA+WPA2 operation
authorJouni Malinen <j@w1.fi>
Tue, 31 Dec 2013 09:32:48 +0000 (11:32 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 31 Dec 2013 17:03:39 +0000 (19:03 +0200)
Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/test_ap_ciphers.py

index c6c42dd5728cb3588843ebd7953d5d9c58648933..a4982972687e287b955e865e65d4790a6b8c175e 100644 (file)
@@ -46,3 +46,45 @@ def test_ap_cipher_ccmp_256(dev, apdev):
 def test_ap_cipher_gcmp_256(dev, apdev):
     """WPA2-PSK/GCMP-256 connection"""
     check_cipher(dev[0], apdev[0], "GCMP-256")
+
+def test_ap_cipher_mixed_wpa_wpa2(dev, apdev):
+    """WPA2-PSK/CCMP/ and WPA-PSK/TKIP mixed configuration"""
+    ssid = "test-wpa-wpa2-psk"
+    passphrase = "12345678"
+    params = { "ssid": ssid,
+               "wpa_passphrase": passphrase,
+               "wpa": "3",
+               "wpa_key_mgmt": "WPA-PSK",
+               "rsn_pairwise": "CCMP",
+               "wpa_pairwise": "TKIP" }
+    hostapd.add_ap(apdev[0]['ifname'], params)
+    dev[0].request("SET ignore_old_scan_res 1")
+    dev[0].connect(ssid, psk=passphrase, proto="WPA2",
+                   pairwise="CCMP", group="TKIP", scan_freq="2412")
+    status = dev[0].get_status()
+    if status['key_mgmt'] != 'WPA2-PSK':
+        raise Exception("Incorrect key_mgmt reported")
+    if status['pairwise_cipher'] != 'CCMP':
+        raise Exception("Incorrect pairwise_cipher reported")
+    if status['group_cipher'] != 'TKIP':
+        raise Exception("Incorrect group_cipher reported")
+    bss = dev[0].get_bss(apdev[0]['bssid'])
+    if bss['ssid'] != ssid:
+        raise Exception("Unexpected SSID in the BSS entry")
+    if "[WPA-PSK-TKIP]" not in bss['flags']:
+        raise Exception("Missing BSS flag WPA-PSK-TKIP")
+    if "[WPA2-PSK-CCMP]" not in bss['flags']:
+        raise Exception("Missing BSS flag WPA2-PSK-CCMP")
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+    dev[1].connect(ssid, psk=passphrase, proto="WPA",
+                   pairwise="TKIP", group="TKIP", scan_freq="2412")
+    status = dev[1].get_status()
+    if status['key_mgmt'] != 'WPA-PSK':
+        raise Exception("Incorrect key_mgmt reported")
+    if status['pairwise_cipher'] != 'TKIP':
+        raise Exception("Incorrect pairwise_cipher reported")
+    if status['group_cipher'] != 'TKIP':
+        raise Exception("Incorrect group_cipher reported")
+    hwsim_utils.test_connectivity(dev[1].ifname, apdev[0]['ifname'])
+    hwsim_utils.test_connectivity(dev[0].ifname, dev[1].ifname)