diff mbox

[v2,26/33] test: pre-authentification with full dynamic vlans

Message ID 1474751297-7277-27-git-send-email-michael-dev@fami-braun.de
State Not Applicable
Headers show

Commit Message

michael-dev Sept. 24, 2016, 9:08 p.m. UTC
From: Michael Braun <michael-dev@fami-braun.de>

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
---
 tests/hwsim/example-hostapd.config |  2 ++
 tests/hwsim/test_pmksa_cache.py    | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)
diff mbox

Patch

diff --git a/tests/hwsim/example-hostapd.config b/tests/hwsim/example-hostapd.config
index 56b4c4e..62d618f 100644
--- a/tests/hwsim/example-hostapd.config
+++ b/tests/hwsim/example-hostapd.config
@@ -3,6 +3,8 @@ 
 CONFIG_DRIVER_NONE=y
 CONFIG_DRIVER_NL80211=y
 CONFIG_RSN_PREAUTH=y
+CONFIG_RSN_PREAUTH_MACVLAN=y
+CONFIG_RSN_PREAUTH_COPY=y
 
 #CONFIG_TLS=internal
 #CONFIG_INTERNAL_LIBTOMMATH=y
diff --git a/tests/hwsim/test_pmksa_cache.py b/tests/hwsim/test_pmksa_cache.py
index e66cf17..77448e6 100644
--- a/tests/hwsim/test_pmksa_cache.py
+++ b/tests/hwsim/test_pmksa_cache.py
@@ -493,6 +493,25 @@  def test_pmksa_cache_preauth_vlan_enabled_per_sta_vif(dev, apdev):
     generic_pmksa_cache_preauth(dev, apdev, extraparams,
                                 "pax.user@example.com", "ap-br0")
 
+def test_pmksa_cache_preauth_vlan_used_full_dynamic(dev, apdev, p, extraparams = None):
+    """RSN pre-authentication to generate PMKSA cache entry (dynamic_vlan optional and station with VLAN set, full dynamic vlan)"""
+    try:
+        subprocess.call(['ip', 'link', 'add', 'dev', 'ap-pre0', 'type', 'veth', 'peer', 'name', 'ap-pre1'])
+        subprocess.call(['ip', 'link', 'set', 'dev', 'ap-pre0', 'up'])
+        subprocess.call(['ip', 'link', 'set', 'dev', 'ap-pre1', 'up'])
+        if not extraparams:
+            extraparams = [{}, {}]
+        extraparams[0]['dynamic_vlan'] = '1'
+        extraparams[0]['rsn_preauth_copy_iface'] = 'ap-pre0'
+        extraparams[1]['dynamic_vlan'] = '1'
+        extraparams[1]['rsn_preauth_interfaces'] = 'ap-pre1'
+        generic_pmksa_cache_preauth(dev, apdev, extraparams,
+                                        "vlan1", "brvlan1")
+    finally:
+        subprocess.call(['ip', 'link', 'set', 'dev', 'ap-pre0', 'down'])
+        subprocess.call(['ip', 'link', 'set', 'dev', 'ap-pre1', 'down'])
+        subprocess.call(['ip', 'link', 'del', 'ap-pre0'])
+
 def test_pmksa_cache_preauth_vlan_used(dev, apdev):
     """RSN pre-authentication to generate PMKSA cache entry (station with VLAN set)"""
     run_pmksa_cache_preauth_vlan_used(dev, apdev, None, force_disconnect=True)