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

Raphaël Mélotte raphael.melotte at mind.be
Mon Aug 1 04:08:24 PDT 2022


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 at mind.be>
---
 tests/hwsim/test_ap_config.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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"""
-- 
2.37.1




More information about the Hostap mailing list