コード例 #1
0
def vht80_test(apdev, dev, channel, ht_capab):
    clear_scan_cache(apdev)
    try:
        hapd = None
        params = {
            "ssid": "vht",
            "country_code": "FI",
            "hw_mode": "a",
            "channel": str(channel),
            "ht_capab": ht_capab,
            "ieee80211n": "1",
            "ieee80211ac": "1",
            "vht_oper_chwidth": "1",
            "vht_oper_centr_freq_seg0_idx": "42"
        }
        hapd = hostapd.add_ap(apdev, params)
        bssid = apdev['bssid']

        dev[0].connect("vht",
                       key_mgmt="NONE",
                       scan_freq=str(5000 + 5 * channel))
        hwsim_utils.test_connectivity(dev[0], hapd)
    except Exception as e:
        if isinstance(e, Exception) and str(e) == "AP startup failed":
            if not vht_supported():
                raise HwsimSkip(
                    "80 MHz channel not supported in regulatory information")
        raise
    finally:
        clear_regdom(hapd, dev)
コード例 #2
0
def test_ap_acs_errors(dev, apdev):
    """Automatic channel selection failures"""
    clear_scan_cache(apdev[0])
    force_prev_ap_on_24g(apdev[0])
    params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
    params['channel'] = '0'
    params['acs_num_scans'] = '2'
    params['chanlist'] = '1'
    hapd = hostapd.add_ap(apdev[0], params, no_enable=True)

    with alloc_fail(hapd, 1, "acs_request_scan"):
        if "FAIL" not in hapd.request("ENABLE"):
            raise Exception("Unexpected success for ENABLE")

    hapd.dump_monitor()
    with fail_test(hapd, 1, "acs_request_scan"):
        if "FAIL" not in hapd.request("ENABLE"):
            raise Exception("Unexpected success for ENABLE")

    hapd.dump_monitor()
    with fail_test(hapd, 1, "acs_scan_complete"):
        hapd.enable()
        ev = hapd.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=10)
        if not ev:
            raise Exception("ACS start timed out")

    hapd.dump_monitor()
    with fail_test(hapd, 1, "acs_request_scan;acs_scan_complete"):
        hapd.enable()
        ev = hapd.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=10)
        if not ev:
            raise Exception("ACS start timed out")
コード例 #3
0
ファイル: test_ap_acs.py プロジェクト: gxk/hostap
def test_ap_acs_errors(dev, apdev):
    """Automatic channel selection failures"""
    clear_scan_cache(apdev[0])
    force_prev_ap_on_24g(apdev[0])
    params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
    params['channel'] = '0'
    params['acs_num_scans'] = '2'
    params['chanlist'] = '1'
    hapd = hostapd.add_ap(apdev[0], params, no_enable=True)

    with alloc_fail(hapd, 1, "acs_request_scan"):
        if "FAIL" not in hapd.request("ENABLE"):
            raise Exception("Unexpected success for ENABLE")

    hapd.dump_monitor()
    with fail_test(hapd, 1, "acs_request_scan"):
        if "FAIL" not in hapd.request("ENABLE"):
            raise Exception("Unexpected success for ENABLE")

    hapd.dump_monitor()
    with fail_test(hapd, 1, "acs_scan_complete"):
        hapd.enable()
        ev = hapd.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=10)
        if not ev:
            raise Exception("ACS start timed out")

    hapd.dump_monitor()
    with fail_test(hapd, 1, "acs_request_scan;acs_scan_complete"):
        hapd.enable()
        ev = hapd.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=10)
        if not ev:
            raise Exception("ACS start timed out")
コード例 #4
0
ファイル: test_ap_vht.py プロジェクト: greearb/hostap-ct
def vht80_test(apdev, dev, channel, ht_capab):
    clear_scan_cache(apdev)
    try:
        hapd = None
        params = {"ssid": "vht",
                  "country_code": "FI",
                  "hw_mode": "a",
                  "channel": str(channel),
                  "ht_capab": ht_capab,
                  "ieee80211n": "1",
                  "ieee80211ac": "1",
                  "vht_oper_chwidth": "1",
                  "vht_oper_centr_freq_seg0_idx": "42"}
        hapd = hostapd.add_ap(apdev, params)
        bssid = apdev['bssid']

        dev.connect("vht", key_mgmt="NONE", scan_freq=str(5000 + 5 * channel))
        hwsim_utils.test_connectivity(dev, hapd)
    except Exception as e:
        if isinstance(e, Exception) and str(e) == "AP startup failed":
            if not vht_supported():
                raise HwsimSkip("80 MHz channel not supported in regulatory information")
        raise
    finally:
        dev.request("DISCONNECT")
        if hapd:
            hapd.request("DISABLE")
        subprocess.call(['iw', 'reg', 'set', '00'])
        dev.flush_scan_cache()
コード例 #5
0
def test_concurrent_autogo_5ghz_ht40(dev, apdev):
    """Concurrent P2P autonomous GO on 5 GHz and HT40 co-ex"""
    clear_scan_cache(apdev[1]['ifname'])
    try:
        hapd = None
        hapd2 = None
        params = {
            "ssid": "ht40",
            "hw_mode": "a",
            "channel": "153",
            "country_code": "US",
            "ht_capab": "[HT40-]"
        }
        hapd2 = hostapd.add_ap(apdev[1], params)

        params = {
            "ssid": "test-open-5",
            "hw_mode": "a",
            "channel": "149",
            "country_code": "US"
        }
        hapd = hostapd.add_ap(apdev[0], params)

        dev[0].request("P2P_SET cross_connect 0")
        dev[0].scan_for_bss(apdev[0]['bssid'], freq=5745)
        dev[0].scan_for_bss(apdev[1]['bssid'], freq=5765)
        dev[0].connect("test-open-5", key_mgmt="NONE", scan_freq="5745")

        dev[0].request("SET p2p_no_group_iface 0")
        if "OK" not in dev[0].global_request("P2P_GROUP_ADD ht40"):
            raise Exception("P2P_GROUP_ADD failed")
        ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=5)
        if ev is None:
            raise Exception("GO start up timed out")
        dev[0].group_form_result(ev)

        pin = dev[1].wps_read_pin()
        dev[0].p2p_go_authorize_client(pin)
        dev[1].p2p_find(freq=5745)
        addr0 = dev[0].p2p_dev_addr()
        count = 0
        while count < 10:
            time.sleep(0.25)
            count += 1
            if dev[1].peer_known(addr0):
                break
        dev[1].p2p_connect_group(addr0, pin, timeout=60)

        dev[0].remove_group()
        dev[1].wait_go_ending_session()
    finally:
        dev[0].request("REMOVE_NETWORK all")
        if hapd:
            hapd.request("DISABLE")
        if hapd2:
            hapd2.request("DISABLE")
        subprocess.call(['iw', 'reg', 'set', '00'])
        dev[0].flush_scan_cache()
        dev[1].flush_scan_cache()
コード例 #6
0
def test_concurrent_autogo_5ghz_ht40(dev, apdev):
    """Concurrent P2P autonomous GO on 5 GHz and HT40 co-ex"""
    clear_scan_cache(apdev[1]['ifname'])
    try:
        hapd = None
        hapd2 = None
        params = { "ssid": "ht40",
                   "hw_mode": "a",
                   "channel": "153",
                   "country_code": "US",
                   "ht_capab": "[HT40-]" }
        hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)

        params = { "ssid": "test-open-5",
                   "hw_mode": "a",
                   "channel": "149",
                   "country_code": "US" }
        hapd = hostapd.add_ap(apdev[0]['ifname'], params)

        dev[0].request("P2P_SET cross_connect 0")
        dev[0].scan_for_bss(apdev[0]['bssid'], freq=5745)
        dev[0].scan_for_bss(apdev[1]['bssid'], freq=5765)
        dev[0].connect("test-open-5", key_mgmt="NONE", scan_freq="5745")

        dev[0].request("SET p2p_no_group_iface 0")
        if "OK" not in dev[0].global_request("P2P_GROUP_ADD ht40"):
            raise Exception("P2P_GROUP_ADD failed")
        ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=5)
        if ev is None:
            raise Exception("GO start up timed out")
        dev[0].group_form_result(ev)

        pin = dev[1].wps_read_pin()
        dev[0].p2p_go_authorize_client(pin)
        dev[1].p2p_find(freq=5745)
        addr0 = dev[0].p2p_dev_addr()
        count = 0
        while count < 10:
            time.sleep(0.25)
            count += 1
            if dev[1].peer_known(addr0):
                break
        dev[1].p2p_connect_group(addr0, pin, timeout=60)

        dev[0].remove_group()
        dev[1].wait_go_ending_session()
    finally:
        dev[0].request("REMOVE_NETWORK all")
        if hapd:
            hapd.request("DISABLE")
        if hapd2:
            hapd2.request("DISABLE")
        subprocess.call(['iw', 'reg', 'set', '00'])
        dev[0].flush_scan_cache()
        dev[1].flush_scan_cache()
コード例 #7
0
def test_ap_acs_40mhz_minus(dev, apdev):
    """Automatic channel selection for HT40- channel"""
    clear_scan_cache(apdev[0])
    force_prev_ap_on_24g(apdev[0])
    params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
    params['channel'] = '0'
    params['ht_capab'] = '[HT40-]'
    params['acs_num_scans'] = '1'
    params['chanlist'] = '1 11'
    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")
コード例 #8
0
ファイル: test_ap_acs.py プロジェクト: gxk/hostap
def test_ap_acs_40mhz_minus(dev, apdev):
    """Automatic channel selection for HT40- channel"""
    clear_scan_cache(apdev[0])
    force_prev_ap_on_24g(apdev[0])
    params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
    params['channel'] = '0'
    params['ht_capab'] = '[HT40-]'
    params['acs_num_scans'] = '1'
    params['chanlist'] = '1 11'
    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")
コード例 #9
0
def run_ap_acs_40mhz(dev, apdev, ht_capab):
    clear_scan_cache(apdev[0])
    force_prev_ap_on_24g(apdev[0])
    params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
    params['channel'] = '0'
    params['ht_capab'] = ht_capab
    hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
    wait_acs(hapd)

    freq = hapd.get_status_field("freq")
    if int(freq) < 2400:
        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)
コード例 #10
0
def test_ap_acs_40mhz(dev, apdev):
    """Automatic channel selection for 40 MHz channel"""
    clear_scan_cache(apdev[0]['ifname'])
    force_prev_ap_on_24g(apdev[0])
    params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
    params['channel'] = '0'
    params['ht_capab'] = '[HT40+]'
    hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
    wait_acs(hapd)

    freq = hapd.get_status_field("freq")
    if int(freq) < 2400:
        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)