]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Add iface_params and bss_params to write_hostapd_config()
authorRaphaël Mélotte <raphael.melotte@mind.be>
Mon, 1 Aug 2022 11:08:24 +0000 (13:08 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 27 Nov 2022 13:43:53 +0000 (15:43 +0200)
To make it easier to write custom hostapd configuration files, add
"iface_params" and "bss_params".

They are both meant to be lists of parameters that the user can supply
to append additional parameters to the configuration file.

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
tests/hwsim/test_ap_config.py

index b1d9d213318839251bcdb591c2e257ccd623e764..a1e068203365988906141b9c991cd5bf4ab5f065 100644 (file)
@@ -136,7 +136,8 @@ def test_ap_config_reload_file_while_disabled(dev, apdev, params):
     hapd.enable()
     dev[0].connect("foobar", key_mgmt="NONE", scan_freq="2412")
 
-def write_hostapd_config(conffile, ifname, ssid, ht=True, bss2=False):
+def write_hostapd_config(conffile, ifname, ssid, ht=True, bss2=False,
+                         iface_params=None, bss_params=None):
     with open(conffile, "w") as f:
         f.write("driver=nl80211\n")
         f.write("hw_mode=g\n")
@@ -145,9 +146,15 @@ def write_hostapd_config(conffile, ifname, ssid, ht=True, bss2=False):
             f.write("ieee80211n=1\n")
         f.write("interface=" + ifname + "\n")
         f.write("ssid=" + ssid + "\n")
+        if iface_params:
+            for l in iface_params:
+                f.write(l + "\n")
         if bss2:
             f.write("bss=" + ifname + "_2\n")
             f.write("ssid=" + ssid + "-2\n")
+        if bss_params:
+            for l in bss_params:
+                f.write(l + "\n")
 
 def test_ap_config_reload_on_sighup(dev, apdev, params):
     """hostapd configuration reload modification from file on SIGHUP"""