From 92f08a3ccd64780bb1781574d6f07937a770a4ba Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 23 Feb 2020 17:13:04 +0200 Subject: [PATCH] tests: Generate BSS config files in ap_bss_add_remove_during_ht_scan Signed-off-by: Jouni Malinen --- tests/hwsim/hostapd.py | 6 ++++-- tests/hwsim/test_ap_dynamic.py | 17 +++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py index 04e460c1d..d179fd045 100644 --- a/tests/hwsim/hostapd.py +++ b/tests/hwsim/hostapd.py @@ -806,10 +806,10 @@ def cfg_file(apdev, conf, ifname=None): # put cfg file in /tmp directory fname = os.path.join("/tmp", conf) - match = re.search(r'^bss-\d+', conf) + match = re.search(r'^bss-.+', conf) if match: with open(fname, 'w') as f: - idx = ''.join(filter(str.isdigit, conf)) + idx = ''.join(filter(str.isdigit, conf.split('-')[-1])) if ifname is None: ifname = apdev['ifname'] if idx != '1': @@ -820,6 +820,8 @@ def cfg_file(apdev, conf, ifname=None): f.write("hw_mode=g\n") f.write("channel=1\n") f.write("ieee80211n=1\n") + if conf.startswith('bss-ht40-'): + f.write("ht_capab=[HT40+]\n") f.write("interface=%s\n" % ifname) f.write("ssid=bss-%s\n" % idx) diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py index 9a7d2f4af..aab59f4ef 100644 --- a/tests/hwsim/test_ap_dynamic.py +++ b/tests/hwsim/test_ap_dynamic.py @@ -158,20 +158,25 @@ def test_ap_bss_add_remove_during_ht_scan(dev, apdev): dev[i].flush_scan_cache() ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' - hostapd.add_bss(apdev[0], ifname1, 'bss-ht40-1.conf') - hostapd.add_bss(apdev[0], ifname2, 'bss-ht40-2.conf') + confname1 = hostapd.cfg_file(apdev[0], "bss-ht40-1.conf") + confname2 = hostapd.cfg_file(apdev[0], "bss-ht40-2.conf") + hapd_global = hostapd.HostapdGlobal(apdev) + hapd_global.send_file(confname1, confname1) + hapd_global.send_file(confname2, confname2) + hostapd.add_bss(apdev[0], ifname1, confname1) + hostapd.add_bss(apdev[0], ifname2, confname2) multi_check(apdev[0], dev, [True, True], scan_opt=False) hostapd.remove_bss(apdev[0], ifname2) hostapd.remove_bss(apdev[0], ifname1) - hostapd.add_bss(apdev[0], ifname1, 'bss-ht40-1.conf') - hostapd.add_bss(apdev[0], ifname2, 'bss-ht40-2.conf') + hostapd.add_bss(apdev[0], ifname1, confname1) + hostapd.add_bss(apdev[0], ifname2, confname2) hostapd.remove_bss(apdev[0], ifname2) multi_check(apdev[0], dev, [True, False], scan_opt=False) hostapd.remove_bss(apdev[0], ifname1) - hostapd.add_bss(apdev[0], ifname1, 'bss-ht40-1.conf') - hostapd.add_bss(apdev[0], ifname2, 'bss-ht40-2.conf') + hostapd.add_bss(apdev[0], ifname1, confname1) + hostapd.add_bss(apdev[0], ifname2, confname2) hostapd.remove_bss(apdev[0], ifname1) multi_check(apdev[0], dev, [False, False])