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 <raphael.melotte@mind.be>
This commit is contained in:
parent
bc2b88b253
commit
34e4a17b48
1 changed files with 8 additions and 1 deletions
|
@ -136,7 +136,8 @@ def test_ap_config_reload_file_while_disabled(dev, apdev, params):
|
||||||
hapd.enable()
|
hapd.enable()
|
||||||
dev[0].connect("foobar", key_mgmt="NONE", scan_freq="2412")
|
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:
|
with open(conffile, "w") as f:
|
||||||
f.write("driver=nl80211\n")
|
f.write("driver=nl80211\n")
|
||||||
f.write("hw_mode=g\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("ieee80211n=1\n")
|
||||||
f.write("interface=" + ifname + "\n")
|
f.write("interface=" + ifname + "\n")
|
||||||
f.write("ssid=" + ssid + "\n")
|
f.write("ssid=" + ssid + "\n")
|
||||||
|
if iface_params:
|
||||||
|
for l in iface_params:
|
||||||
|
f.write(l + "\n")
|
||||||
if bss2:
|
if bss2:
|
||||||
f.write("bss=" + ifname + "_2\n")
|
f.write("bss=" + ifname + "_2\n")
|
||||||
f.write("ssid=" + ssid + "-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):
|
def test_ap_config_reload_on_sighup(dev, apdev, params):
|
||||||
"""hostapd configuration reload modification from file on SIGHUP"""
|
"""hostapd configuration reload modification from file on SIGHUP"""
|
||||||
|
|
Loading…
Reference in a new issue