diff mbox series

[v6a,6/7] Fixes for tests: Extended Key ID tests

Message ID 20190928181807.180530-7-alexander@wetzel-home.de
State Superseded
Headers show
Series Fixes for Extended Key ID patch series V6 | expand

Commit Message

Alexander Wetzel Sept. 28, 2019, 6:18 p.m. UTC
This is a correction on top of:
 [PATCH v6 12/17] tests: Extended Key ID tests

Changes:
 - Verify a TKIP only AP is not using Extended Key ID.
 - Tune the Extended Key ID detection
 - Adaptions to the log behavior changes by another patch
   (Fixes for hostapd: Add support for Extended Key ID)

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
---
 tests/hwsim/hostapd.py     | 13 ++++++-------
 tests/hwsim/test_ap_psk.py | 10 ++++++++++
 2 files changed, 16 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index c8021ffcc..d6d0bed37 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -555,17 +555,16 @@  def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30,
             return hapd
         hapd.enable()
         if wait_enabled:
-            if "wpa" in params and params["wpa"]  == "2":
-                ev = hapd.wait_event(["Extended Key ID"], timeout=5)
-                if ev is None or "requires wpa2" in ev:
-                    hapd.extKeyID = "unused"
-                elif "not supported" in ev:
+            ev = hapd.wait_event(["Extended Key ID",
+                                  "AP-ENABLED", "AP-DISABLED"], timeout=timeout)
+            if "Extended Key ID" in ev:
+                if "not supported" in ev:
                     hapd.extKeyID = "auto-off"
-                elif "disabled" in ev:
+                elif "support disabled" in ev:
                     hapd.extKeyID = "force-off"
                 else:
                     hapd.extKeyID = "auto-on"
-            ev = hapd.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=timeout)
+                ev = hapd.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=timeout)
             if ev is None:
                 raise Exception("AP startup timed out")
             if "AP-ENABLED" not in ev:
diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py
index 78dc7a662..6be9b19f8 100644
--- a/tests/hwsim/test_ap_psk.py
+++ b/tests/hwsim/test_ap_psk.py
@@ -3377,6 +3377,16 @@  def test_ap_wpa2_ptk_extended_key_id_compat_sta(dev, apdev):
     dev[0].reset()
 
 def test_ap_wpa2_ptk_extended_key_id_tkip(dev, apdev):
+    """Extended Key ID with TKIP only AP"""
+    ssid = "test-wpa2-psk"
+    passphrase = 'qwertyuiop'
+    params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
+    params["rsn_pairwise"] = "TKIP"
+    hapd = hostapd.add_ap(apdev[0], params)
+    if hapd.extKeyID != "force-off":
+        raise Exception("Extended Key ID support not disabled for TKIP only AP")
+
+def test_ap_wpa2_ptk_extended_key_id_tkip_sta(dev, apdev):
     """Extended Key ID WPA2-PSK AP and station using WPA2 with TKIP only"""
     ssid = "test-wpa2-psk"
     passphrase = 'qwertyuiop'