]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Beacon request - active scan mode and many BSSs
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 3 Jan 2017 16:24:24 +0000 (18:24 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 3 Jan 2017 17:53:03 +0000 (19:53 +0200)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/bss-4.conf [new file with mode: 0644]
tests/hwsim/bss-5.conf [new file with mode: 0644]
tests/hwsim/bss-6.conf [new file with mode: 0644]
tests/hwsim/run-tests.py
tests/hwsim/test_rrm.py

diff --git a/tests/hwsim/bss-4.conf b/tests/hwsim/bss-4.conf
new file mode 100644 (file)
index 0000000..4028794
--- /dev/null
@@ -0,0 +1,11 @@
+driver=nl80211
+
+hw_mode=g
+channel=1
+ieee80211n=1
+
+interface=wlan3-4
+bssid=02:00:00:00:03:03
+ctrl_interface=/var/run/hostapd
+
+ssid=bss-4
diff --git a/tests/hwsim/bss-5.conf b/tests/hwsim/bss-5.conf
new file mode 100644 (file)
index 0000000..8b88368
--- /dev/null
@@ -0,0 +1,11 @@
+driver=nl80211
+
+hw_mode=g
+channel=1
+ieee80211n=1
+
+interface=wlan3-5
+bssid=02:00:00:00:03:04
+ctrl_interface=/var/run/hostapd
+
+ssid=bss-5
diff --git a/tests/hwsim/bss-6.conf b/tests/hwsim/bss-6.conf
new file mode 100644 (file)
index 0000000..66a0d0c
--- /dev/null
@@ -0,0 +1,11 @@
+driver=nl80211
+
+hw_mode=g
+channel=1
+ieee80211n=1
+
+interface=wlan3-6
+bssid=02:00:00:00:03:05
+ctrl_interface=/var/run/hostapd
+
+ssid=bss-6
index 0ec9d23471436dec11639c2cf25d009d8de5eb46..6f62deacb74462c6d9d2e33ffbe29290d2076ed4 100755 (executable)
@@ -67,6 +67,9 @@ def reset_devs(dev, apdev):
     try:
         hapd = HostapdGlobal()
         hapd.flush()
+        hapd.remove('wlan3-6')
+        hapd.remove('wlan3-5')
+        hapd.remove('wlan3-4')
         hapd.remove('wlan3-3')
         hapd.remove('wlan3-2')
         for ap in apdev:
index b9566cca5ce538e9c7e1af8bdf44ca3ed6726907..bf0575616e126ab8e84b3cf735f993c0640bc550 100644 (file)
@@ -14,6 +14,7 @@ import struct
 import subprocess
 
 import hostapd
+from wpasupplicant import WpaSupplicant
 from utils import HwsimSkip, alloc_fail, fail_test, wait_fail_trigger
 from test_ap_ht import clear_scan_cache
 
@@ -992,6 +993,56 @@ def test_rrm_beacon_req_active(dev, apdev):
             if report.opclass != 81 or report.channel != 11:
                 raise Exception("Incorrect opclass/channel for AP1")
 
+def start_ap(dev):
+    id = dev.add_network()
+    dev.set_network(id, "mode", "2")
+    dev.set_network_quoted(id, "ssid", 32*'A')
+    dev.set_network_quoted(id, "psk", "1234567890")
+    dev.set_network(id, "frequency", "2412")
+    dev.set_network(id, "scan_freq", "2412")
+    dev.select_network(id)
+    dev.wait_connected()
+
+def test_rrm_beacon_req_active_many(dev, apdev):
+    """Beacon request - active scan mode and many BSSs"""
+    for i in range(1, 7):
+        ifname = apdev[0]['ifname'] if i == 1 else apdev[0]['ifname'] + "-%d" % i
+        hapd1 = hostapd.add_bss(apdev[0], ifname, 'bss-%i.conf' % i)
+        hapd1.set('vendor_elements', "dd50" + 80*'bb')
+        hapd1.request("UPDATE_BEACON")
+
+    wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+    wpas.interface_add("wlan5")
+    wpas.request("SET device_name " + 20*'a')
+    start_ap(wpas)
+    start_ap(dev[1])
+    start_ap(dev[2])
+
+    params = { "ssid": "rrm", "rrm_beacon_report": "1" }
+    params['vendor_elements'] = "dd50" + 80*'aa'
+    hapd = hostapd.add_ap(apdev[1]['ifname'], params)
+
+    dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
+    addr = dev[0].own_addr()
+
+    ok = False
+    for j in range(3):
+        token = run_req_beacon(hapd, addr, "51010000640001ffffffffffff")
+
+        for i in range(10):
+            ev = hapd.wait_event(["BEACON-RESP-RX"], timeout=10)
+            if ev is None:
+                raise Exception("Beacon report %d response not received" % i)
+            fields = ev.split(' ')
+            if len(fields[4]) == 0:
+                break
+            report = BeaconReport(binascii.unhexlify(fields[4]))
+            logger.info("Received beacon report: " + str(report))
+            if i == 9:
+                ok = True
+        if ok:
+            break
+
 def test_rrm_beacon_req_active_ap_channels(dev, apdev):
     """Beacon request - active scan mode with AP Channel Report subelement"""
     params = { "ssid": "rrm", "rrm_beacon_report": "1" }