]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Generate BSS config files in ap_bss_add_remove_during_ht_scan
authorJouni Malinen <j@w1.fi>
Sun, 23 Feb 2020 15:13:04 +0000 (17:13 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 23 Feb 2020 15:52:53 +0000 (17:52 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/hostapd.py
tests/hwsim/test_ap_dynamic.py

index 04e460c1d73669a065c4d20900ade368bb186e46..d179fd0453682c76f7963639dd0df244c4141591 100644 (file)
@@ -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)
index 9a7d2f4af8953cd303815e18d16cb3b8a7546a1a..aab59f4ef298f8d90424a3ce08f9c8176b21702f 100644 (file)
@@ -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])