]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Add hostapd interface with driver specified
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 17 Jul 2015 20:57:04 +0000 (23:57 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 17 Jul 2015 20:57:04 +0000 (23:57 +0300)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/hostapd.py
tests/hwsim/test_ap_dynamic.py

index c8df679236b2809a4e20b58bee1c99ab6417ac35..33cfa6206100b2a9d2bca549709e9ac4ac418d61 100644 (file)
@@ -47,8 +47,11 @@ class HostapdGlobal:
     def request(self, cmd):
         return self.ctrl.request(cmd)
 
-    def add(self, ifname):
-        res = self.ctrl.request("ADD " + ifname + " " + hapd_ctrl)
+    def add(self, ifname, driver=None):
+        cmd = "ADD " + ifname + " " + hapd_ctrl
+        if driver:
+            cmd += " " + driver
+        res = self.ctrl.request(cmd)
         if not "OK" in res:
             raise Exception("Could not add hostapd interface " + ifname)
 
index e8836ca23c1e6647880be37cb425f6e21580f9a7..19eb9c43d030b654347bdbebc61bc2f1e6954baf 100644 (file)
@@ -466,3 +466,20 @@ def test_ap_multi_bss(dev, apdev):
         raise Exception("sta0 did not report receiving packets")
     if 'rx_packets' not in sta1 or int(sta1['rx_packets']) < 1:
         raise Exception("sta1 did not report receiving packets")
+
+def test_ap_add_with_driver(dev, apdev):
+    """Add hostapd interface with driver specified"""
+    ifname = apdev[0]['ifname']
+    hapd_global = hostapd.HostapdGlobal()
+    hapd_global.add(ifname, driver="nl80211")
+    hapd = hostapd.Hostapd(ifname)
+    hapd.set_defaults()
+    hapd.set("ssid", "dynamic")
+    hapd.enable()
+    ev = hapd.wait_event(["AP-ENABLED"], timeout=30)
+    if ev is None:
+        raise Exception("AP startup timed out")
+    dev[0].connect("dynamic", key_mgmt="NONE", scan_freq="2412")
+    dev[0].request("DISCONNECT")
+    dev[0].wait_disconnected()
+    hapd.disable()