tests: wpa_supplicant MIB command output for WPA/WPA2 information
authorJouni Malinen <j@w1.fi>
Sat, 5 Apr 2014 20:56:03 +0000 (23:56 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 5 Apr 2014 20:56:03 +0000 (23:56 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_eap.py
tests/hwsim/test_ap_ft.py
tests/hwsim/test_ap_psk.py

index df2fc10..8b2509f 100644 (file)
@@ -14,6 +14,7 @@ import os.path
 
 import hwsim_utils
 import hostapd
+from test_ap_psk import check_mib
 
 def read_pem(fname):
     with open(fname, "r") as f:
@@ -173,6 +174,8 @@ def test_ap_wpa2_eap_ttls_pap(dev, apdev):
                 altsubject_match="EMAIL:noone@example.com;DNS:server.w1.fi;URI:http://example.com/")
     hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
     eap_reauth(dev[0], "TTLS")
+    check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-1"),
+                        ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-1") ])
 
 def test_ap_wpa2_eap_ttls_chap(dev, apdev):
     """WPA2-Enterprise connection using EAP-TTLS/CHAP"""
@@ -836,6 +839,8 @@ def test_ap_wpa2_eap_psk(dev, apdev):
     eap_connect(dev[0], apdev[0], "PSK", "psk.user@example.com",
                 password_hex="0123456789abcdef0123456789abcdef", sha256=True)
     eap_reauth(dev[0], "PSK", sha256=True)
+    check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-5"),
+                        ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-5") ])
 
     logger.info("Negative test with incorrect password")
     dev[0].request("REMOVE_NETWORK all")
@@ -854,6 +859,8 @@ def test_ap_wpa_eap_peap_eap_mschapv2(dev, apdev):
     eap_check_auth(dev[0], "PEAP", True, rsn=False)
     hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
     eap_reauth(dev[0], "PEAP", rsn=False)
+    check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-50-f2-1"),
+                        ("dot11RSNAAuthenticationSuiteSelected", "00-50-f2-1") ])
 
 def test_ap_wpa2_eap_interactive(dev, apdev):
     """WPA2-Enterprise connection using interactive identity/password entry"""
index cdec192..024c2ef 100644 (file)
@@ -12,6 +12,7 @@ logger = logging.getLogger()
 import hwsim_utils
 import hostapd
 from wlantest import Wlantest
+from test_ap_psk import check_mib
 
 def ft_base_rsn():
     params = { "wpa": "2",
@@ -180,6 +181,8 @@ def test_ap_ft_over_ds(dev, apdev):
     hostapd.add_ap(apdev[1]['ifname'], params)
 
     run_roams(dev[0], apdev, ssid, passphrase, over_ds=True)
+    check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-4"),
+                        ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-4") ])
 
 def test_ap_ft_pmf_over_ds(dev, apdev):
     """WPA2-PSK-FT AP over DS with PMF"""
@@ -261,6 +264,8 @@ def test_ap_ft_eap(dev, apdev):
     hostapd.add_ap(apdev[1]['ifname'], params)
 
     run_roams(dev[0], apdev, ssid, passphrase, eap=True)
+    check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-3"),
+                        ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-3") ])
 
 def test_ap_ft_eap_pull(dev, apdev):
     """WPA2-EAP-FT AP (pull PMK)"""
index b3e1234..8f871d7 100644 (file)
@@ -11,6 +11,12 @@ import os
 import hostapd
 import hwsim_utils
 
+def check_mib(dev, vals):
+    mib = dev.get_mib()
+    for v in vals:
+        if mib[v[0]] != v[1]:
+            raise Exception("Unexpected {} = {} (expected {})".format(v[0], mib[v[0]], v[1]))
+
 def test_ap_wpa2_psk(dev, apdev):
     """WPA2-PSK AP with PSK instead of passphrase"""
     ssid = "test-wpa2-psk"
@@ -70,6 +76,8 @@ def test_ap_wpa2_sha256_ptk_rekey(dev, apdev):
     if ev is None:
         raise Exception("PTK rekey timed out")
     hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-6"),
+                        ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-6") ])
 
 def test_ap_wpa_ptk_rekey(dev, apdev):
     """WPA-PSK/TKIP AP and PTK rekey enforced by station"""
@@ -92,6 +100,14 @@ def test_ap_wpa_ccmp(dev, apdev):
     hostapd.add_ap(apdev[0]['ifname'], params)
     dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
     hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    check_mib(dev[0], [ ("dot11RSNAConfigGroupCipherSize", "128"),
+                        ("dot11RSNAGroupCipherRequested", "00-50-f2-4"),
+                        ("dot11RSNAPairwiseCipherRequested", "00-50-f2-4"),
+                        ("dot11RSNAAuthenticationSuiteRequested", "00-50-f2-2"),
+                        ("dot11RSNAGroupCipherSelected", "00-50-f2-4"),
+                        ("dot11RSNAPairwiseCipherSelected", "00-50-f2-4"),
+                        ("dot11RSNAAuthenticationSuiteSelected", "00-50-f2-2"),
+                        ("dot1xSuppSuppControlledPortStatus", "Authorized") ])
 
 def test_ap_wpa2_psk_file(dev, apdev):
     """WPA2-PSK AP with various PSK file error and success cases"""