Add support for 8 VAPs with open security in multiple BSSID configuration. The first interface transmits beacons and probe responses which include the multiple BSSID element(s) with remaining profiles. Add helper functions to create the configuration file, start hostapd instance and client association with the transmitting interface. Signed-off-by: Aloka Dixit <quic_alokad@xxxxxxxxxxx> --- v1: depends on https://patchwork.kernel.org/project/linux-wireless/list/?series=700684&state=%2A&archive=both tests/hwsim/test_he_mbssid.py | 97 +++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 tests/hwsim/test_he_mbssid.py diff --git a/tests/hwsim/test_he_mbssid.py b/tests/hwsim/test_he_mbssid.py new file mode 100644 index 000000000000..a643e5c4666c --- /dev/null +++ b/tests/hwsim/test_he_mbssid.py @@ -0,0 +1,97 @@ +# Multiple BSSID and enhanced multi-BSS advertisements (EMA) +# Copyright (c) 2019, The Linux Foundation +# Copyright (c) 2022, Qualcomm Innovation Center, Inc +# +# This software may be distributed under the terms of the BSD license. +# See README for more details. + +import os, subprocess, time, logging, hwsim_utils, tempfile, hostapd +logger = logging.getLogger() +from wpasupplicant import WpaSupplicant +from utils import * + +def mbssid_create_cfg_file(apdev, params, mbssid=1): + # Create configuration file and add phy characteristics + fd, fname = tempfile.mkstemp(dir='/tmp', prefix='hostapd-' + get_phy(apdev[0])) + f = os.fdopen(fd, 'w') + f.write("driver=nl80211\n") + f.write("hw_mode=g\n") + f.write("channel=1\n") + f.write("ieee80211n=1\n") + f.write("vht_oper_chwidth=0\n") + f.write("ieee80211ac=1\n") + f.write("he_oper_chwidth=0\n") + f.write("ieee80211ax=1\n") + f.write("mbssid=%d\n\n" % mbssid) + + if isinstance(apdev[0], dict): + ifname = apdev[0]['ifname'] + else: + ifname = apdev + + return (f, fname, ifname) + +def mbssid_write_bss_params(f, ifname, idx, params=None): + # Add BSS specific characteristics + fields = ["wpa", "wpa_pairwise", "rsn_pairwise", "wpa_passphrase", + "wpa_key_mgmt", "ieee80211w", "sae_pwe" ] + + if idx == 0: + f.write("interface=%s\n" % ifname) + else: + f.write("\nbss=%s\n" % (ifname + '-' + str(idx))) + + f.write("ctrl_interface=/var/run/hostapd\n") + f.write("ssid=bss-%s\n" % idx) + f.write("bridge=br-lan\n") + f.write("bssid=00:03:7f:12:2a:%02x\n" % idx) + f.write("preamble=1\n") + f.write("auth_algs=1\n") + + if params is None: + return + + for field in fields: + if field in params: + f.write("%s=%s\n" % (field, params[field])) + +def mbssid_start_ap(dev, apdev, params, fname, ifname, sta_params): + pid = params['prefix'] + ".hostapd.pid" + cmd = ['../../hostapd/hostapd', '-dtSB', '-dt', '-P', pid, '-f', + params['prefix'] + ".hostapd.log", fname] + + logger.info("Starting APs for " + ifname) + res = subprocess.check_call(cmd) + if res != 0: + raise Exception("Could not start hostapd: %s" % str(res)) + + hapd = hostapd.Hostapd(apdev[0]['ifname']) + hapd.ping() + + dev[0].connect("bss-0", **sta_params) + sta = hapd.get_sta(dev[0].own_addr()) + if "[HE]" not in sta['flags']: + raise Exception("Missing STA flag: HE") + dev[0].request("DISCONNECT") + + if "OK" not in hapd.request("TERMINATE"): + raise Exception("Failed to terminate hostapd process") + ev = hapd.wait_event(["CTRL-EVENT-TERMINATING"], timeout=15) + if ev is None: + raise Exception("CTRL-EVENT-TERMINATING not seen") + for i in range(30): + time.sleep(0.1) + if not os.path.exists(pid): + break + if os.path.exists(pid): + raise Exception("PID file exits after process termination") + +def test_he_ap_mbssid_open(dev, apdev, params): + """HE AP MBSSID OPEN""" + f, fname, ifname = mbssid_create_cfg_file(apdev, params) + for idx in range(0, 8): + mbssid_write_bss_params(f, ifname, idx) + f.close() + + sta_params = {"key_mgmt": "NONE", "scan_freq": "2412"} + mbssid_start_ap(dev, apdev, params, fname, ifname, sta_params) -- 2.25.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap