Exemple #1
0
def test_ap_bss_add_out_of_memory(dev, apdev):
    """Running out of memory while adding a BSS"""
    hapd2 = hostapd.add_ap(apdev[1], {"ssid": "open"})

    ifname1 = apdev[0]['ifname']
    ifname2 = apdev[0]['ifname'] + '-2'

    confname1 = hostapd.cfg_file(apdev[0], "bss-1.conf")
    confname2 = hostapd.cfg_file(apdev[0], "bss-2.conf")
    hapd_bss_out_of_mem(hapd2, 'phy3', confname1, 1, 'hostapd_add_iface')
    for i in range(1, 3):
        hapd_bss_out_of_mem(hapd2, 'phy3', confname1,
                            i, 'hostapd_interface_init_bss')
    hapd_bss_out_of_mem(hapd2, 'phy3', confname1,
                        1, 'ieee802_11_build_ap_params')

    hostapd.add_bss(apdev[0], ifname1, confname1)

    hapd_bss_out_of_mem(hapd2, 'phy3', confname2,
                        1, 'hostapd_interface_init_bss')
    hapd_bss_out_of_mem(hapd2, 'phy3', confname2,
                        1, 'ieee802_11_build_ap_params')

    hostapd.add_bss(apdev[0], ifname2, confname2)
    hostapd.remove_bss(apdev[0], ifname2)
    hostapd.remove_bss(apdev[0], ifname1)
Exemple #2
0
def test_ap_bss_config_file(dev, apdev, params):
    """hostapd BSS config file"""
    pidfile = os.path.join(params['logdir'], "ap_bss_config_file-hostapd.pid")
    logfile = os.path.join(params['logdir'], "ap_bss_config_file-hostapd-log")
    prg = os.path.join(params['logdir'], 'alt-hostapd/hostapd/hostapd')
    if not os.path.exists(prg):
        prg = '../../hostapd/hostapd'
    phy = get_phy(apdev[0])
    confname1 = hostapd.cfg_file(apdev[0], "bss-1.conf")
    confname2 = hostapd.cfg_file(apdev[0], "bss-2.conf")
    confname3 = hostapd.cfg_file(apdev[0], "bss-3.conf")

    cmd = [prg, '-B', '-dddt', '-P', pidfile, '-f', logfile, '-S', '-T',
           '-b', phy + ':' + confname1, '-b', phy + ':' + confname2,
           '-b', phy + ':' + confname3]
    res = subprocess.check_call(cmd)
    if res != 0:
        raise Exception("Could not start hostapd: %s" % str(res))
    multi_check(apdev[0], dev, [True, True, True])
    for i in range(0, 3):
        dev[i].request("DISCONNECT")

    hapd = hostapd.Hostapd(apdev[0]['ifname'])
    hapd.ping()
    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(pidfile):
            break
    if os.path.exists(pidfile):
        raise Exception("PID file exits after process termination")
Exemple #3
0
def test_ap_bss_add_remove_during_ht_scan(dev, apdev):
    """Dynamic BSS add during HT40 co-ex scan"""
    for i in range(3):
        dev[i].flush_scan_cache()
    ifname1 = apdev[0]['ifname']
    ifname2 = apdev[0]['ifname'] + '-2'
    confname1 = hostapd.cfg_file(apdev[0], "bss-ht40-1.conf")
    confname2 = hostapd.cfg_file(apdev[0], "bss-ht40-2.conf")
    hapd_global = hostapd.HostapdGlobal(apdev)
    hapd_global.send_file(confname1, confname1)
    hapd_global.send_file(confname2, confname2)
    hostapd.add_bss(apdev[0], ifname1, confname1)
    hostapd.add_bss(apdev[0], ifname2, confname2)
    multi_check(apdev[0], dev, [True, True], scan_opt=False)
    hostapd.remove_bss(apdev[0], ifname2)
    hostapd.remove_bss(apdev[0], ifname1)

    hostapd.add_bss(apdev[0], ifname1, confname1)
    hostapd.add_bss(apdev[0], ifname2, confname2)
    hostapd.remove_bss(apdev[0], ifname2)
    multi_check(apdev[0], dev, [True, False], scan_opt=False)
    hostapd.remove_bss(apdev[0], ifname1)

    hostapd.add_bss(apdev[0], ifname1, confname1)
    hostapd.add_bss(apdev[0], ifname2, confname2)
    hostapd.remove_bss(apdev[0], ifname1)
    multi_check(apdev[0], dev, [False, False])