diff --git a/tests/hwsim/bss-ht40-1.conf b/tests/hwsim/bss-ht40-1.conf new file mode 100644 index 000000000..a338c6b66 --- /dev/null +++ b/tests/hwsim/bss-ht40-1.conf @@ -0,0 +1,12 @@ +driver=nl80211 + +hw_mode=g +channel=1 +ieee80211n=1 +ht_capab=[HT40+] + +interface=wlan3 +bssid=02:00:00:00:03:00 +ctrl_interface=/var/run/hostapd + +ssid=bss-1 diff --git a/tests/hwsim/bss-ht40-2.conf b/tests/hwsim/bss-ht40-2.conf new file mode 100644 index 000000000..c7e27ce3d --- /dev/null +++ b/tests/hwsim/bss-ht40-2.conf @@ -0,0 +1,12 @@ +driver=nl80211 + +hw_mode=g +channel=1 +ieee80211n=1 +ht_capab=[HT40+] + +interface=wlan3-2 +bssid=02:00:00:00:03:01 +ctrl_interface=/var/run/hostapd + +ssid=bss-2 diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py index dc7c9c85a..659c1ccc0 100644 --- a/tests/hwsim/test_ap_dynamic.py +++ b/tests/hwsim/test_ap_dynamic.py @@ -37,27 +37,28 @@ def test_ap_change_ssid(dev, apdev): def multi_check(dev, check): id = [] - for i in range(0, 3): + num_bss = len(check) + for i in range(0, num_bss): dev[i].request("BSS_FLUSH 0") dev[i].dump_monitor() id.append(dev[i].connect("bss-" + str(i + 1), key_mgmt="NONE", scan_freq="2412", wait_connect=check[i])) - for i in range(0, 3): + for i in range(0, num_bss): if not check[i]: ev = dev[i].wait_event(["CTRL-EVENT-CONNECTED"], timeout=0.2) if ev: raise Exception("Unexpected connection") - for i in range(0, 3): + for i in range(0, num_bss): dev[i].remove_network(id[i]) time.sleep(0.3) res = '' - for i in range(0, 3): + for i in range(0, num_bss): res = res + dev[i].request("BSS RANGE=ALL MASK=0x2") - for i in range(0, 3): + for i in range(0, num_bss): if not check[i]: bssid = '02:00:00:00:03:0' + str(i) if bssid in res: @@ -126,6 +127,29 @@ def test_ap_bss_add_remove(dev, apdev): hostapd.add_bss('phy3', ifname3, 'bss-3.conf', ignore_error=True) multi_check(dev, [ True, True, True ]) +def test_ap_bss_add_remove_during_ht_scan(dev, apdev): + """Dynamic BSS add during HT40 co-ex scan""" + for d in dev: + d.request("SET ignore_old_scan_res 1") + ifname1 = apdev[0]['ifname'] + ifname2 = apdev[0]['ifname'] + '-2' + hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf') + hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf') + multi_check(dev, [ True, True ]) + hostapd.remove_bss(ifname2) + hostapd.remove_bss(ifname1) + + hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf') + hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf') + hostapd.remove_bss(ifname2) + multi_check(dev, [ True, False ]) + hostapd.remove_bss(ifname1) + + hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf') + hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf') + hostapd.remove_bss(ifname1) + multi_check(dev, [ False, False ]) + def test_ap_multi_bss_config(dev, apdev): """hostapd start with a multi-BSS configuration file""" for d in dev: