[PATCH v2 20/33] test: FT ft_macvlan generation

M. Braun michael-dev at fami-braun.de
Sat Sep 24 14:08:04 PDT 2016


From: Michael Braun <michael-dev at fami-braun.de>

Signed-off-by: Michael Braun <michael-dev at fami-braun.de>
---
 tests/hwsim/example-hostapd.config |  1 +
 tests/hwsim/test_ap_ft.py          | 39 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/tests/hwsim/example-hostapd.config b/tests/hwsim/example-hostapd.config
index 036c16c..56b4c4e 100644
--- a/tests/hwsim/example-hostapd.config
+++ b/tests/hwsim/example-hostapd.config
@@ -49,6 +49,7 @@ CONFIG_LIBNL3_ROUTE=y
 CONFIG_PEERKEY=y
 CONFIG_IEEE80211W=y
 CONFIG_IEEE80211R=y
+CONFIG_IEEE80211R_MACVLAN=y
 CONFIG_IEEE80211N=y
 CONFIG_IEEE80211AC=y
 
diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index b707569..09368fa 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -8,6 +8,7 @@ from remotehost import remote_compatible
 import binascii
 import os
 import time
+import subprocess
 import logging
 logger = logging.getLogger()
 
@@ -17,6 +18,12 @@ from utils import HwsimSkip, alloc_fail, fail_test, skip_with_fips
 from wlantest import Wlantest
 from test_ap_psk import check_mib, find_wpas_process, read_process_memory, verify_not_present, get_key_locations
 
+try:
+    import netifaces
+    netifaces_imported = True
+except ImportError:
+    netifaces_imported = False
+
 def ft_base_rsn():
     params = { "wpa": "2",
                "wpa_key_mgmt": "FT-PSK",
@@ -1475,3 +1482,35 @@ def test_ap_ft_internal_rrb_check(dev, apdev):
     # Try over_ds roaming to non-WPA-enabled AP.
     # If hostapd does not check hapd->wpa_auth internally, it will crash now.
     dev[0].roam_over_ds(apdev[1]['bssid'], fail_test=True)
+
+def test_ap_ft_iface(dev, apdev):
+    """FT AP iface & macvlan"""
+    ssid = "test-ft"
+    passphrase="12345678"
+
+    try:
+        subprocess.call(['brctl', 'addbr', "brft"])
+        subprocess.call(['brctl', 'setfd', "brft", '0'])
+        subprocess.call(['ip', 'link', 'set', 'dev', "brft", 'up'])
+
+        params = ft_params1(ssid=ssid, passphrase=passphrase)
+        params["ft_iface"] = "brft"
+        hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+
+        if netifaces_imported:
+            ifaces = netifaces.interfaces()
+            if not ("ftwlan3" in ifaces):
+                raise Exception("device ftwlan3 has not been created")
+
+        hapd.request("DISABLE")
+        time.sleep(5)
+
+        if netifaces_imported:
+            ifaces = netifaces.interfaces()
+            if "ftwlan3" in ifaces:
+                raise Exception("device ftwlan3 has not been cleaned up")
+    finally:
+        subprocess.call(['ip', 'link', 'set', 'dev', "brft", 'down'])
+        subprocess.call(['brctl', 'delbr', "brft"])
+        subprocess.call(['ifconfig', 'ftwlan3', 'down'])
+        subprocess.call(['ip', 'link', 'del', 'ftwlan3'])
-- 
2.1.4




More information about the Hostap mailing list