]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Multiple BSSs restart with hostapd
authorViktor Barna <viktor.barna@celeno.com>
Thu, 22 May 2025 11:19:39 +0000 (14:19 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 29 Sep 2025 19:46:24 +0000 (22:46 +0300)
This test emulates `ifconfig down/up secondary bss`.

Run example:

sudo ./start.sh
sudo ./run-tests.py ap_multi_bss_restart
DEV: wlan0: 02:00:00:00:00:00
DEV: wlan1: 02:00:00:00:01:00
DEV: wlan2: 02:00:00:00:02:00
APDEV: wlan3
APDEV: wlan4
START ap_multi_bss_restart 1/1
Test: Multiple BSSs restart with hostapd
Starting BSS phy=phy3 ifname=wlan3
Starting BSS phy=phy3 ifname=wlan3-2
Connect STA wlan0 to AP
Connect STA wlan1 to AP
PASS ap_multi_bss_restart 0.665893 2022-07-11 16:42:48.622036
passed all 1 test case(s)

Signed-off-by: Viktor Barna <viktor.barna.rj@bp.renesas.com>
Signed-off-by: Alexander Savchenko <oleksandr.savchenko.dn@bp.renesas.com>
tests/hwsim/test_ap_dynamic.py

index 02133687e74b95d3bdb3126b3e107d57d3577b12..d90fa3f851335784ad25faf8234ce3afaec04036 100644 (file)
@@ -497,6 +497,32 @@ def test_ap_multi_bss(dev, apdev):
     if 'rx_packets' not in sta1 or int(sta1['rx_packets']) < 1:
         raise Exception("sta1 did not report receiving packets")
 
+def test_ap_multi_bss_restart(dev, apdev):
+    """Multiple BSSs restart with hostapd"""
+    ifname1 = apdev[0]['ifname']
+    ifname2 = apdev[0]['ifname'] + '-2'
+    hapd1 = hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
+    hapd2 = hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
+
+    hostapd.cmd_execute(apdev[0], ['ip', 'link', 'set', ifname1, 'down'])
+    hostapd.cmd_execute(apdev[0], ['ip', 'link', 'set', ifname1, 'up'])
+
+    hostapd.cmd_execute(apdev[0], ['ip', 'link', 'set', ifname2, 'down'])
+    hostapd.cmd_execute(apdev[0], ['ip', 'link', 'set', ifname2, 'up'])
+
+    dev[0].connect("bss-1", key_mgmt="NONE", scan_freq="2412")
+    dev[1].connect("bss-2", key_mgmt="NONE", scan_freq="2412")
+
+    hwsim_utils.test_connectivity(dev[0], hapd1)
+    hwsim_utils.test_connectivity(dev[1], hapd2)
+
+    sta0 = hapd1.get_sta(dev[0].own_addr())
+    sta1 = hapd2.get_sta(dev[1].own_addr())
+    if 'rx_packets' not in sta0 or int(sta0['rx_packets']) < 1:
+        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")
+
 @remote_compatible
 def test_ap_add_with_driver(dev, apdev):
     """Add hostapd interface with driver specified"""