diff mbox series

[4/7] tests: hwsim: write_hostapd_config: Add iface_params and bss_params

Message ID 20220801110827.237391-5-raphael.melotte@mind.be
State Accepted
Headers show
Series hostapd: add support for reconfiguring single BSSes | expand

Commit Message

Raphaël Mélotte Aug. 1, 2022, 11:08 a.m. UTC
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 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tests/hwsim/test_ap_config.py b/tests/hwsim/test_ap_config.py
index b1d9d2133..a1e068203 100644
--- a/tests/hwsim/test_ap_config.py
+++ b/tests/hwsim/test_ap_config.py
@@ -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"""