def test_ap_acs_vht160(dev, apdev): """Automatic channel selection for VHT160""" try: hapd = None force_prev_ap_on_5g(apdev[0]) params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") params['hw_mode'] = 'a' params['channel'] = '0' params['ht_capab'] = '[HT40+]' params['country_code'] = 'ZA' params['ieee80211ac'] = '1' params['vht_oper_chwidth'] = '2' params['ieee80211d'] = '1' params['ieee80211h'] = '1' params['chanlist'] = '100' params['acs_num_scans'] = '1' hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) ev = hapd.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=10) if not ev: raise Exception("ACS start timed out") # VHT160 is not currently supported in hostapd ACS, so do not try to # enforce successful AP start. if "AP-ENABLED" in ev: freq = hapd.get_status_field("freq") if int(freq) < 5000: raise Exception("Unexpected frequency") dev[0].connect("test-acs", psk="12345678", scan_freq=freq) dev[0].wait_regdom(country_ie=True) finally: clear_regdom(hapd, dev)
def test_ap_acs_vht40(dev, apdev): """Automatic channel selection for VHT40""" try: hapd = None force_prev_ap_on_5g(apdev[0]) params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") params['hw_mode'] = 'a' params['channel'] = '0' params['ht_capab'] = '[HT40+]' params['country_code'] = 'US' params['ieee80211ac'] = '1' params['vht_oper_chwidth'] = '0' params['acs_num_scans'] = '1' params['chanlist'] = '36 149' hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) wait_acs(hapd) freq = hapd.get_status_field("freq") if int(freq) < 5000: raise Exception("Unexpected frequency") sec = hapd.get_status_field("secondary_channel") if int(sec) == 0: raise Exception("Secondary channel not set") dev[0].connect("test-acs", psk="12345678", scan_freq=freq) dev[0].wait_regdom(country_ie=True) finally: clear_regdom(hapd, dev)
def test_nfc_wps_handover_5ghz(dev, apdev): """Connect to WPS AP with NFC connection handover on 5 GHz band""" hapd = None try: ssid = "test-wps-nfc-handover" params = ap_wps_params(ssid) params["country_code"] = "FI" params["hw_mode"] = "a" params["channel"] = "36" hapd = hostapd.add_ap(apdev[0], params) logger.info("NFC connection handover") req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF WPS-CR").rstrip() if "FAIL" in req: raise Exception( "Failed to generate NFC connection handover request") sel = hapd.request("NFC_GET_HANDOVER_SEL NDEF WPS-CR").rstrip() if "FAIL" in sel: raise Exception( "Failed to generate NFC connection handover select") res = hapd.request("NFC_REPORT_HANDOVER RESP WPS " + req + " " + sel) if "FAIL" in res: raise Exception( "Failed to report NFC connection handover to to hostapd") dev[0].dump_monitor() res = dev[0].request("NFC_REPORT_HANDOVER INIT WPS " + req + " " + sel) if "FAIL" in res: raise Exception( "Failed to report NFC connection handover to to wpa_supplicant" ) dev[0].wait_connected(timeout=30) check_wpa2_connection(dev[0], apdev[0], hapd, ssid) finally: clear_regdom(hapd, dev)
def test_wep_ht_vht(dev, apdev): """WEP and HT/VHT""" dev[0].flush_scan_cache() try: hapd = None params = { "ssid": "test-vht40-wep", "country_code": "SE", "hw_mode": "a", "channel": "36", "ieee80211n": "1", "ieee80211ac": "1", "ht_capab": "[HT40+]", "vht_capab": "", "vht_oper_chwidth": "0", "vht_oper_centr_freq_seg0_idx": "0", "wep_key0": '"hello"' } hapd = hostapd.add_ap(apdev[0], params) dev[0].connect("test-vht40-wep", scan_freq="5180", key_mgmt="NONE", wep_key0='"hello"') hwsim_utils.test_connectivity(dev[0], hapd) status = hapd.get_status() logger.info("hostapd STATUS: " + str(status)) if status["ieee80211n"] != "0": raise Exception("Unexpected STATUS ieee80211n value") if status["ieee80211ac"] != "0": raise Exception("Unexpected STATUS ieee80211ac value") if status["secondary_channel"] != "0": raise Exception("Unexpected STATUS secondary_channel value") finally: dev[0].request("DISCONNECT") clear_regdom(hapd, dev)
def test_ap_acs_vht160_scan_disable(dev, apdev): """Automatic channel selection for VHT160 and DISABLE during scan""" force_prev_ap_on_5g(apdev[0]) params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") params['hw_mode'] = 'a' params['channel'] = '0' params['ht_capab'] = '[HT40+]' params['country_code'] = 'ZA' params['ieee80211ac'] = '1' params['vht_oper_chwidth'] = '2' params["vht_oper_centr_freq_seg0_idx"] = "114" params['ieee80211d'] = '1' params['ieee80211h'] = '1' hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) time.sleep(3) clear_regdom(hapd, dev)
def test_ap_acs_5ghz(dev, apdev): """Automatic channel selection on 5 GHz""" try: hapd = None force_prev_ap_on_5g(apdev[0]) params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") params['hw_mode'] = 'a' params['channel'] = '0' params['country_code'] = 'US' hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) wait_acs(hapd) freq = hapd.get_status_field("freq") if int(freq) < 5000: raise Exception("Unexpected frequency") dev[0].connect("test-acs", psk="12345678", scan_freq=freq) dev[0].wait_regdom(country_ie=True) finally: clear_regdom(hapd, dev)