]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Additional coverage for SCAN_RESULTS and BSS entry flags
authorJouni Malinen <j@w1.fi>
Sun, 7 Dec 2014 21:27:45 +0000 (23:27 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 8 Dec 2014 09:42:06 +0000 (11:42 +0200)
This increases wpa_supplicant_ie_txt(), print_bss_info(), and
wpa_supplicant_ctrl_iface_scan_result() testing coverage to include the
previously missing key management options.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_eap.py
tests/hwsim/test_ap_hs20.py
tests/hwsim/test_ibss.py
tests/hwsim/test_p2p_autogo.py
tests/hwsim/test_sae.py
tests/hwsim/test_suite_b.py
tests/hwsim/test_wep.py

index f5a7e6baccb2d58963df209a80a8be60e996a8f5..aca575155b1dc9a65d5cc780817402fa729c8673 100644 (file)
@@ -1695,6 +1695,12 @@ def test_ap_wpa2_eap_psk(dev, apdev):
     check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-5"),
                         ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-5") ])
 
+    bss = dev[0].get_bss(apdev[0]['bssid'])
+    if 'flags' not in bss:
+        raise Exception("Could not get BSS flags from BSS table")
+    if "[WPA2-EAP-SHA256-CCMP]" not in bss['flags']:
+        raise Exception("Unexpected BSS flags: " + bss['flags'])
+
     logger.info("Negative test with incorrect password")
     dev[0].request("REMOVE_NETWORK all")
     eap_connect(dev[0], apdev[0], "PSK", "psk.user@example.com",
index fdb267d1f131c55efdbccbe8040888c242b8ff85..0ee7c53e77b0139003a0f4ff04e007321f2b0609 100644 (file)
@@ -345,6 +345,10 @@ def test_ap_hs20_select(dev, apdev):
     dev[0].set_cred_quoted(id, "realm", "no.match.example.com");
     interworking_select(dev[0], bssid, no_match=True, freq="2412")
 
+    res = dev[0].request("SCAN_RESULTS")
+    if "[HS20]" not in res:
+        raise Exception("HS20 flag missing from scan results: " + res)
+
     bssid2 = apdev[1]['bssid']
     params = hs20_ap_params()
     params['nai_realm'] = [ "0,example.org,21" ]
index fd5c32daee81e11a59a3eba15cacdec714df3b5a..a05e2d7236a4d9f42a3db33d6bc04ef47c2ec1c0 100644 (file)
@@ -169,6 +169,16 @@ def test_ibss_wpa_none(dev):
     print bssid1
     print bssid2
 
+    bss = dev[0].get_bss(bssid0)
+    if not bss:
+        bss = dev[1].get_bss(bssid1)
+        if not bss:
+            raise Exception("Could not find BSS entry for IBSS")
+    if 'flags' not in bss:
+        raise Exception("Could not get BSS flags from BSS table")
+    if "[WPA-None-TKIP]" not in bss['flags']:
+        raise Exception("Unexpected BSS flags: " + bss['flags'])
+
     # Allow some time for all peers to complete key setup
     time.sleep(1)
 
@@ -240,6 +250,21 @@ def test_ibss_open(dev):
     if bssid0 != bssid1:
         logger.info("STA0 BSSID " + bssid0 + " differs from STA1 BSSID " + bssid1)
 
+    res = dev[0].request("SCAN_RESULTS")
+    if "[IBSS]" not in res:
+        res = dev[1].request("SCAN_RESULTS")
+        if "[IBSS]" not in res:
+            raise Exception("IBSS flag missing from scan results: " + res)
+    bss = dev[0].get_bss(bssid0)
+    if not bss:
+        bss = dev[1].get_bss(bssid1)
+        if not bss:
+            raise Exception("Could not find BSS entry for IBSS")
+    if 'flags' not in bss:
+        raise Exception("Could not get BSS flags from BSS table")
+    if "[IBSS]" not in bss['flags']:
+        raise Exception("Unexpected BSS flags: " + bss['flags'])
+
 def test_ibss_open_fixed_bssid(dev):
     """IBSS open (no security) and fixed BSSID"""
     ssid="ibss"
index 4aa1932d230e592c770c8f64bbfe5071dccdd241..79abd4c50cef125520801519c7b72203d7e4bda5 100644 (file)
@@ -49,6 +49,10 @@ def test_autogo(dev):
     if "id=" + id not in res:
         raise Exception("Could not find BSS entry based on id range")
 
+    res = dev[1].request("SCAN_RESULTS")
+    if "[P2P]" not in res:
+        raise Exception("P2P flag missing from scan results: " + res)
+
     # Presence request to increase testing coverage
     if "FAIL" in dev[1].group_request("P2P_PRESENCE_REQ 30000 102400"):
         raise Exception("Could not send presence request")
index f870dd60e1b096e524c0813dd0ccc9ee9a41be39..c57bb06432137ed65c855f0fd1f45f043e9630eb 100644 (file)
@@ -27,6 +27,11 @@ def test_sae(dev, apdev):
                         scan_freq="2412")
     if dev[0].get_status_field('sae_group') != '19':
             raise Exception("Expected default SAE group not used")
+    bss = dev[0].get_bss(apdev[0]['bssid'])
+    if 'flags' not in bss:
+        raise Exception("Could not get BSS flags from BSS table")
+    if "[WPA2-SAE-CCMP]" not in bss['flags']:
+        raise Exception("Unexpected BSS flags: " + bss['flags'])
 
 def test_sae_pmksa_caching(dev, apdev):
     """SAE and PMKSA caching"""
index dec9eb7b172a0311d72fdfed09327fd65484d2ae..f378614095f8c6ccba39299849fde88fcc89e215 100644 (file)
@@ -24,6 +24,13 @@ def test_suite_b(dev, apdev):
                    client_cert="auth_serv/user.pem",
                    private_key="auth_serv/user.key",
                    pairwise="GCMP", group="GCMP", scan_freq="2412")
+
+    bss = dev[0].get_bss(apdev[0]['bssid'])
+    if 'flags' not in bss:
+        raise Exception("Could not get BSS flags from BSS table")
+    if "[WPA2-EAP-SUITE-B-GCMP]" not in bss['flags']:
+        raise Exception("Unexpected BSS flags: " + bss['flags'])
+
     dev[0].request("DISCONNECT")
     ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=20)
     if ev is None:
index 7f3a9417ea9fdc851b56c87257954a8531a10efc..7237aaf4f99b2b085d3b795b6a8bf50f74996fe7 100644 (file)
@@ -18,6 +18,12 @@ def test_wep_open_auth(dev, apdev):
     if "[WEP]" not in dev[0].request("SCAN_RESULTS"):
         raise Exception("WEP flag not indicated in scan results")
 
+    bss = dev[0].get_bss(apdev[0]['bssid'])
+    if 'flags' not in bss:
+        raise Exception("Could not get BSS flags from BSS table")
+    if "[WEP]" not in bss['flags']:
+        raise Exception("Unexpected BSS flags: " + bss['flags'])
+
 def test_wep_shared_key_auth(dev, apdev):
     """WEP Shared Key authentication"""
     hapd = hostapd.add_ap(apdev[0]['ifname'],