From: Raphaël Mélotte Date: Mon, 1 Aug 2022 11:08:24 +0000 (+0200) Subject: tests: Add iface_params and bss_params to write_hostapd_config() X-Git-Tag: hostap_2_11~1465 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34e4a17b48c1efea20a1f5353c2439f6ac44eee6;p=thirdparty%2Fhostap.git tests: Add iface_params and bss_params to write_hostapd_config() 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 --- 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"""