def test_autogo_with_bss_on_disallowed_chan(dev, apdev):
    """P2P channel selection: Autonomous GO with BSS on a disallowed channel"""

    with HWSimRadio(n_channels=2) as (radio, iface):
        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
        wpas.interface_add(iface)

        wpas.request("SET p2p_no_group_iface 0")

        if wpas.get_mcc() < 2:
            raise Exception("New radio does not support MCC")

        try:
            hapd = hostapd.add_ap(apdev[0]['ifname'], {
                "ssid": 'bss-2.4ghz',
                "channel": '1'
            })
            wpas.request("P2P_SET disallow_freq 2412")
            wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
            res = autogo(wpas)
            if res['freq'] == "2412":
                raise Exception("GO set on a disallowed channel")
            hwsim_utils.test_connectivity(wpas, hapd)
        finally:
            wpas.request("P2P_SET disallow_freq ")
def test_p2p_go_move_reg_change(dev, apdev, params):
    """P2P GO move due to regulatory change [long]"""
    if not params['long']:
        raise HwsimSkip(
            "Skip test case with long duration due to --long not specified")

    try:
        set_country("US")
        dev[0].global_request("P2P_SET disallow_freq 2400-5000")
        res = autogo(dev[0])
        freq1 = int(res['freq'])
        if freq1 < 5000:
            raise Exception("Unexpected channel %d MHz" % freq1)

        dev[0].global_request("P2P_SET disallow_freq ")

        # GO move is not allowed while waiting for initial client connection
        time.sleep(20)
        set_country("00")
        ev = dev[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP"],
                                     timeout=10)
        if ev is None:
            raise Exception("P2P-REMOVE-AND-REFORM-GROUP not seen")

        freq2 = dev[0].get_group_status_field('freq')
        if freq1 == freq2:
            raise Exception("Unexpected freq after group reform=" + freq2)

        dev[0].remove_group()
    finally:
        dev[0].global_request("P2P_SET disallow_freq ")
        set_country("00")
def test_go_pref_chan_bss_on_disallowed_chan(dev, apdev):
    """P2P channel selection: Station interface on different channel than GO configured pref channel, and station channel is disallowed"""
    with HWSimRadio(n_channels=2) as (radio, iface):
        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
        wpas.interface_add(iface)

        if wpas.get_mcc() < 2:
            raise Exception("New radio does not support MCC")

        wpas.request("SET p2p_no_group_iface 0")

        try:
            hapd = hostapd.add_ap(apdev[0]['ifname'], {
                "ssid": 'bss-2.4ghz',
                "channel": '1'
            })
            wpas.request("P2P_SET disallow_freq 2412")
            wpas.request("SET p2p_pref_chan 81:2")
            wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
            res2 = autogo(wpas)
            if res2['freq'] != "2417":
                raise Exception(
                    "GO channel did not follow pref_chan configuration")
            hwsim_utils.test_connectivity(wpas, hapd)
        finally:
            wpas.request("P2P_SET disallow_freq ")
            wpas.request("SET p2p_pref_chan ")
def test_p2p_go_move_active(dev, apdev, params):
    """P2P GO stays in freq although SCM is possible [long]"""
    if dev[0].get_mcc() <= 1:
        raise HwsimSkip("Skip due to MCC not being enabled")

    if not params['long']:
        raise HwsimSkip(
            "Skip test case with long duration due to --long not specified")

    dev[0].request("SET p2p_no_group_iface 0")
    try:
        dev[0].global_request("P2P_SET disallow_freq 2430-6000")
        hapd = hostapd.add_ap(apdev[0]['ifname'], {
            "ssid": 'ap-test',
            "channel": '11'
        })
        dev[0].connect("ap-test", key_mgmt="NONE", scan_freq="2462")

        res = autogo(dev[0])
        freq = int(res['freq'])
        if freq > 2430:
            raise Exception("Unexpected channel %d MHz" % freq)

        # GO move is not allowed while waiting for initial client connection
        time.sleep(20)
        dev[0].global_request("P2P_SET disallow_freq ")

        ev = dev[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP"],
                                     timeout=10)
        if ev is not None:
            raise Exception("Unexpected P2P-REMOVE-AND-REFORM-GROUP seen")

        dev[0].remove_group()
    finally:
        dev[0].global_request("P2P_SET disallow_freq ")
Exemplo n.º 5
0
def test_p2p_go_move_active(dev, apdev, params):
    """P2P GO stays in freq although SCM is possible [long]"""
    if dev[0].get_mcc() <= 1:
        raise HwsimSkip("Skip due to MCC not being enabled")

    if not params['long']:
        raise HwsimSkip("Skip test case with long duration due to --long not specified")

    dev[0].request("SET p2p_no_group_iface 0")
    try:
        dev[0].global_request("P2P_SET disallow_freq 2430-6000")
        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test',
                                                    "channel" : '11' })
        dev[0].connect("ap-test", key_mgmt="NONE",
                       scan_freq="2462")

        res = autogo(dev[0])
        freq = int(res['freq'])
        if freq > 2430:
            raise Exception("Unexpected channel %d MHz" % freq)

        # GO move is not allowed while waiting for initial client connection
        time.sleep(20)
        dev[0].global_request("P2P_SET disallow_freq ")

        ev = dev[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP"],
                                     timeout=10)
        if ev is not None:
            raise Exception("Unexpected P2P-REMOVE-AND-REFORM-GROUP seen")

        dev[0].remove_group()
    finally:
        dev[0].global_request("P2P_SET disallow_freq ")
Exemplo n.º 6
0
def test_p2p_go_move_reg_change(dev, apdev, params):
    """P2P GO move due to regulatory change [long]"""
    if not params['long']:
        raise HwsimSkip("Skip test case with long duration due to --long not specified")

    try:
        set_country("US")
        dev[0].global_request("P2P_SET disallow_freq 2400-5000")
        res = autogo(dev[0])
        freq1 = int(res['freq'])
        if freq1 < 5000:
            raise Exception("Unexpected channel %d MHz" % freq1)

        dev[0].global_request("P2P_SET disallow_freq ")

        # GO move is not allowed while waiting for initial client connection
        time.sleep(20)
        set_country("00")
        ev = dev[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP"],
                                     timeout=10)
        if ev is None:
            raise Exception("P2P-REMOVE-AND-REFORM-GROUP not seen")

        freq2 = dev[0].get_group_status_field('freq')
        if freq1 == freq2:
            raise Exception("Unexpected freq after group reform=" + freq2)

        dev[0].remove_group()
    finally:
        dev[0].global_request("P2P_SET disallow_freq ")
        set_country("00")
def test_p2p_go_move_scm_multi(dev, apdev, params):
    """P2P GO move due to SCM operation preference multiple times [long]"""
    if dev[0].get_mcc() <= 1:
        raise HwsimSkip("Skip due to MCC not being enabled")

    if not params['long']:
        raise HwsimSkip(
            "Skip test case with long duration due to --long not specified")

    dev[0].request("SET p2p_no_group_iface 0")
    try:
        dev[0].global_request("P2P_SET disallow_freq 2430-6000")
        hapd = hostapd.add_ap(apdev[0]['ifname'], {
            "ssid": 'ap-test-1',
            "channel": '11'
        })
        dev[0].connect("ap-test-1", key_mgmt="NONE", scan_freq="2462")

        dev[0].global_request("SET p2p_go_freq_change_policy 0")
        res = autogo(dev[0])
        freq = int(res['freq'])
        if freq > 2430:
            raise Exception("Unexpected channel %d MHz" % freq)

        # GO move is not allowed while waiting for initial client connection
        time.sleep(20)
        dev[0].global_request("P2P_SET disallow_freq ")

        ev = dev[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP"],
                                     timeout=3)
        if ev is None:
            raise Exception("P2P-REMOVE-AND-REFORM-GROUP not seen")

        freq = dev[0].get_group_status_field('freq')
        if freq != '2462':
            raise Exception("Unexpected freq after group reform=" + freq)

        hapd = hostapd.add_ap(apdev[0]['ifname'], {
            "ssid": 'ap-test-2',
            "channel": '6'
        })
        dev[0].connect("ap-test-2", key_mgmt="NONE", scan_freq="2437")

        ev = dev[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP"],
                                     timeout=5)
        if ev is None:
            raise Exception("(2) P2P-REMOVE-AND-REFORM-GROUP not seen")

        freq = dev[0].get_group_status_field('freq')
        if freq != '2437':
            raise Exception("(2) Unexpected freq after group reform=" + freq)

        dev[0].remove_group()
    finally:
        dev[0].global_request("P2P_SET disallow_freq ")
        dev[0].global_request("SET p2p_go_freq_change_policy 2")
Exemplo n.º 8
0
def test_p2p_go_move_scm_multi(dev, apdev, params):
    """P2P GO move due to SCM operation preference multiple times [long]"""
    if dev[0].get_mcc() <= 1:
        raise HwsimSkip("Skip due to MCC not being enabled")

    if not params['long']:
        raise HwsimSkip("Skip test case with long duration due to --long not specified")

    dev[0].request("SET p2p_no_group_iface 0")
    try:
        dev[0].global_request("P2P_SET disallow_freq 2430-6000")
        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test-1',
                                                    "channel" : '11' })
        dev[0].connect("ap-test-1", key_mgmt="NONE",
                       scan_freq="2462")

        dev[0].global_request("SET p2p_go_freq_change_policy 0")
        res = autogo(dev[0])
        freq = int(res['freq'])
        if freq > 2430:
            raise Exception("Unexpected channel %d MHz" % freq)

        # GO move is not allowed while waiting for initial client connection
        time.sleep(20)
        dev[0].global_request("P2P_SET disallow_freq ")

        ev = dev[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
                                      "AP-CSA-FINISHED"], timeout=3)
        if ev is None:
            raise Exception("P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")

        freq = dev[0].get_group_status_field('freq')
        if freq != '2462':
            raise Exception("Unexpected freq after group reform=" + freq)

        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test-2',
                                                    "channel" : '6' })
        dev[0].connect("ap-test-2", key_mgmt="NONE",
                       scan_freq="2437")

        ev = dev[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
                                      "AP-CSA-FINISHED"], timeout=5)
        if ev is None:
            raise Exception("(2) P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")

        freq = dev[0].get_group_status_field('freq')
        if freq != '2437':
            raise Exception("(2) Unexpected freq after group reform=" + freq)

        dev[0].remove_group()
    finally:
        dev[0].global_request("P2P_SET disallow_freq ")
        dev[0].global_request("SET p2p_go_freq_change_policy 2")
Exemplo n.º 9
0
def test_p2p_autogo_pref_chan_disallowed(dev, apdev):
    """P2P channel selection: GO preferred channels are disallowed"""
    try:
        dev[0].request("SET p2p_pref_chan 81:1,81:3,81:6,81:9,81:11")
        dev[0].request("P2P_SET disallow_freq 2412,2422,2437,2452,2462")
        for i in range(0, 5):
            res = autogo(dev[0])
            if res['freq'] in ["2412", "2422", "2437", "2452", "2462"]:
                raise Exception("GO channel is disallowed")
            dev[0].remove_group(res['ifname'])
    finally:
        dev[0].request("P2P_SET disallow_freq ")
        dev[0].request("SET p2p_pref_chan ")
Exemplo n.º 10
0
def test_p2p_autogo_pref_chan_disallowed(dev, apdev):
    """P2P channel selection: GO preferred channels are disallowed"""
    try:
       dev[0].request("SET p2p_pref_chan 81:1,81:3,81:6,81:9,81:11")
       dev[0].request("P2P_SET disallow_freq 2412,2422,2437,2452,2462")
       for i in range(0, 5):
           res = autogo(dev[0])
           if res['freq'] in [ "2412", "2422", "2437", "2452", "2462" ]:
               raise Exception("GO channel is disallowed")
           dev[0].remove_group(res['ifname'])
    finally:
       dev[0].request("P2P_SET disallow_freq ")
       dev[0].request("SET p2p_pref_chan ")
def test_p2p_channel_5ghz_only(dev):
    """P2P GO start with only 5 GHz band allowed"""
    try:
        set_country("US", dev[0])
        dev[0].request("P2P_SET disallow_freq 2400-2500")
        res = autogo(dev[0])
        freq = int(res['freq'])
        if freq < 5000:
            raise Exception("Unexpected channel %d MHz" % freq)
        dev[0].remove_group()
    finally:
        set_country("00")
        dev[0].request("P2P_SET disallow_freq ")
Exemplo n.º 12
0
def test_p2p_channel_5ghz_only(dev):
    """P2P GO start with only 5 GHz band allowed"""
    try:
        set_country("US", dev[0])
        dev[0].request("P2P_SET disallow_freq 2400-2500")
        res = autogo(dev[0])
        freq = int(res['freq'])
        if freq < 5000:
            raise Exception("Unexpected channel %d MHz" % freq)
        dev[0].remove_group()
    finally:
        set_country("00")
        dev[0].request("P2P_SET disallow_freq ")
Exemplo n.º 13
0
def test_p2p_autogo_pref_chan_not_in_regulatory(dev, apdev):
    """P2P channel selection: GO preferred channel not allowed in the regulatory rules"""
    try:
        set_country("US", dev[0])
        dev[0].request("SET p2p_pref_chan 124:149")
        res = autogo(dev[0], persistent=True)
        if res['freq'] != "5745":
            raise Exception("Unexpected channel selected: " + res['freq'])
        dev[0].remove_group(res['ifname'])

        netw = dev[0].list_networks()
        if len(netw) != 1:
            raise Exception("Unexpected number of network blocks: " + str(netw))
        id = netw[0]['id']

        set_country("DE", dev[0])
        res = autogo(dev[0], persistent=id)
        if res['freq'] == "5745":
            raise Exception("Unexpected channel selected(2): " + res['freq'])
        dev[0].remove_group(res['ifname'])
    finally:
        dev[0].request("SET p2p_pref_chan ")
        set_country("00")
Exemplo n.º 14
0
def test_autogo_random_channel(dev, apdev):
    """P2P channel selection: GO instantiated on random channel 1, 6, 11"""
    freqs = []
    go_freqs = ["2412", "2437", "2462"]
    for i in range(0, 20):
        result = autogo(dev[0])
        if result['freq'] not in go_freqs:
           raise Exception("Unexpected frequency selected: " + result['freq'])
        if result['freq'] not in freqs:
            freqs.append(result['freq'])
        if len(freqs) == 3:
            break
        dev[0].remove_group(result['ifname'])
    if i == 20:
       raise Exception("GO created 20 times and not all social channels were selected. freqs not selected: " + str(list(set(go_freqs) - set(freqs))))
Exemplo n.º 15
0
def test_go_pref_chan_bss_on_diff_chan(dev, apdev):
    """P2P channel selection: Station on different channel than GO configured pref channel"""

    dev[0].request("SET p2p_no_group_iface 0")

    try:
        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
                                                    "channel": '1' })
        dev[0].request("SET p2p_pref_chan 81:2")
        dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
        res = autogo(dev[0])
        if res['freq'] != "2412":
           raise Exception("GO channel did not follow BSS")
        hwsim_utils.test_connectivity(dev[0], hapd)
    finally:
        dev[0].request("SET p2p_pref_chan ")
Exemplo n.º 16
0
def test_autogo_force_diff_channel(dev, apdev):
    """P2P autonomous GO and station interface operate on different channels"""
    if dev[0].get_mcc() < 2:
        logger.info("Skiping test because the driver doesn't support MCC")
        return "skip"

    dev[0].request("SET p2p_no_group_iface 0")

    hostapd.add_ap(apdev[0]['ifname'], {"ssid" : 'ap-test', "channel" : '1'})
    dev[0].connect("ap-test", key_mgmt = "NONE", scan_freq = "2412")
    channels = { 2 : 2417, 5 : 2432, 9 : 2452 }
    for key in channels:
        res_go = autogo(dev[0], channels[key])
        hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
        if int(res_go['freq']) == 2412:
            raise Exception("Group operation channel is: 2412 excepted: " + res_go['freq'])
        dev[0].remove_group(res_go['ifname'])
Exemplo n.º 17
0
def test_autogo_following_bss(dev, apdev):
    """P2P autonomous GO operate on the same channel as station interface"""
    if dev[0].get_mcc() > 1:
        logger.info("test mode: MCC")

    dev[0].request("SET p2p_no_group_iface 0")

    channels = { 3 : "2422", 5 : "2432", 9 : "2452" }
    for key in channels:
        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test',
                                                    "channel" : str(key) })
        dev[0].connect("ap-test", key_mgmt="NONE",
                       scan_freq=str(channels[key]))
        res_go = autogo(dev[0])
        if res_go['freq'] != channels[key]:
            raise Exception("Group operation channel is not the same as on connected station interface")
        hwsim_utils.test_connectivity(dev[0], hapd)
        dev[0].remove_group(res_go['ifname'])
def test_autogo_force_diff_channel(dev, apdev):
    """P2P autonomous GO and station interface operate on different channels"""
    if dev[0].get_mcc() < 2:
        logger.info("Skiping test because the driver doesn't support MCC")
        return "skip"

    dev[0].request("SET p2p_no_group_iface 0")

    hostapd.add_ap(apdev[0]['ifname'], {"ssid": 'ap-test', "channel": '1'})
    dev[0].connect("ap-test", key_mgmt="NONE", scan_freq="2412")
    channels = {2: 2417, 5: 2432, 9: 2452}
    for key in channels:
        res_go = autogo(dev[0], channels[key])
        hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
        if int(res_go['freq']) == 2412:
            raise Exception("Group operation channel is: 2412 excepted: " +
                            res_go['freq'])
        dev[0].remove_group(res_go['ifname'])
Exemplo n.º 19
0
def test_autogo_with_bss_on_disallowed_chan(dev, apdev):
    """P2P channel selection: Autonomous GO with BSS on a disallowed channel"""

    dev[0].request("SET p2p_no_group_iface 0")

    if dev[0].get_mcc() < 2:
       logger.info("Skipping test because driver does not support MCC")
       return "skip"
    try:
        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
                                                    "channel": '1' })
        dev[0].request("P2P_SET disallow_freq 2412")
        dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
        res = autogo(dev[0])
        if res['freq'] == "2412":
           raise Exception("GO set on a disallowed channel")
        hwsim_utils.test_connectivity(dev[0], hapd)
    finally:
        dev[0].request("P2P_SET disallow_freq ")
Exemplo n.º 20
0
def test_autogo_with_bss_on_disallowed_chan(dev, apdev):
    """P2P channel selection: Autonomous GO with BSS on a disallowed channel"""

    dev[0].request("SET p2p_no_group_iface 0")

    if dev[0].get_mcc() < 2:
        logger.info("Skipping test because driver does not support MCC")
        return "skip"
    try:
        hapd = hostapd.add_ap(apdev[0]['ifname'], {
            "ssid": 'bss-2.4ghz',
            "channel": '1'
        })
        dev[0].request("P2P_SET disallow_freq 2412")
        dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
        res = autogo(dev[0])
        if res['freq'] == "2412":
            raise Exception("GO set on a disallowed channel")
        hwsim_utils.test_connectivity(dev[0], hapd)
    finally:
        dev[0].request("P2P_SET disallow_freq ")
Exemplo n.º 21
0
def test_go_pref_chan_bss_on_disallowed_chan(dev, apdev):
    """P2P channel selection: Station interface on different channel than GO configured pref channel, and station channel is disallowed"""
    if dev[0].get_mcc() < 2:
       logger.info("Skipping test because driver does not support MCC")
       return "skip"

    dev[0].request("SET p2p_no_group_iface 0")

    try:
        hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
                                                    "channel": '1' })
        dev[0].request("P2P_SET disallow_freq 2412")
        dev[0].request("SET p2p_pref_chan 81:2")
        dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
        res2 = autogo(dev[0])
        if res2['freq'] != "2417":
           raise Exception("GO channel did not follow pref_chan configuration")
        hwsim_utils.test_connectivity(dev[0], hapd)
    finally:
        dev[0].request("P2P_SET disallow_freq ")
        dev[0].request("SET p2p_pref_chan ")
Exemplo n.º 22
0
def test_autogo_force_diff_channel(dev, apdev):
    """P2P autonomous GO and station interface operate on different channels"""
    with HWSimRadio(n_channels=2) as (radio, iface):
        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
        wpas.interface_add(iface)

        if wpas.get_mcc() < 2:
           raise Exception("New radio does not support MCC")

        wpas.request("SET p2p_no_group_iface 0")

        hapd = hostapd.add_ap(apdev[0]['ifname'],
                              {"ssid" : 'ap-test', "channel" : '1'})
        wpas.connect("ap-test", key_mgmt = "NONE", scan_freq = "2412")
        channels = { 2 : 2417, 5 : 2432, 9 : 2452 }
        for key in channels:
            res_go = autogo(wpas, channels[key])
            hwsim_utils.test_connectivity(wpas, hapd)
            if int(res_go['freq']) == 2412:
                raise Exception("Group operation channel is: 2412 excepted: " + res_go['freq'])
            wpas.remove_group(res_go['ifname'])
Exemplo n.º 23
0
def test_autogo_with_bss_on_disallowed_chan(dev, apdev):
    """P2P channel selection: Autonomous GO with BSS on a disallowed channel"""

    with HWSimRadio(n_channels=2) as (radio, iface):
        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
        wpas.interface_add(iface)

        wpas.request("SET p2p_no_group_iface 0")

        if wpas.get_mcc() < 2:
           raise Exception("New radio does not support MCC")

        try:
            hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
                                                        "channel": '1' })
            wpas.request("P2P_SET disallow_freq 2412")
            wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
            res = autogo(wpas)
            if res['freq'] == "2412":
               raise Exception("GO set on a disallowed channel")
            hwsim_utils.test_connectivity(wpas, hapd)
        finally:
            wpas.request("P2P_SET disallow_freq ")
Exemplo n.º 24
0
def test_go_pref_chan_bss_on_disallowed_chan(dev, apdev):
    """P2P channel selection: Station interface on different channel than GO configured pref channel, and station channel is disallowed"""
    if dev[0].get_mcc() < 2:
        logger.info("Skipping test because driver does not support MCC")
        return "skip"

    dev[0].request("SET p2p_no_group_iface 0")

    try:
        hapd = hostapd.add_ap(apdev[0]['ifname'], {
            "ssid": 'bss-2.4ghz',
            "channel": '1'
        })
        dev[0].request("P2P_SET disallow_freq 2412")
        dev[0].request("SET p2p_pref_chan 81:2")
        dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
        res2 = autogo(dev[0])
        if res2['freq'] != "2417":
            raise Exception(
                "GO channel did not follow pref_chan configuration")
        hwsim_utils.test_connectivity(dev[0], hapd)
    finally:
        dev[0].request("P2P_SET disallow_freq ")
        dev[0].request("SET p2p_pref_chan ")
Exemplo n.º 25
0
def test_go_pref_chan_bss_on_disallowed_chan(dev, apdev):
    """P2P channel selection: Station interface on different channel than GO configured pref channel, and station channel is disallowed"""
    with HWSimRadio(n_channels=2) as (radio, iface):
        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
        wpas.interface_add(iface)

        if wpas.get_mcc() < 2:
           raise Exception("New radio does not support MCC")

        wpas.request("SET p2p_no_group_iface 0")

        try:
            hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
                                                        "channel": '1' })
            wpas.request("P2P_SET disallow_freq 2412")
            wpas.request("SET p2p_pref_chan 81:2")
            wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
            res2 = autogo(wpas)
            if res2['freq'] != "2417":
               raise Exception("GO channel did not follow pref_chan configuration")
            hwsim_utils.test_connectivity(wpas, hapd)
        finally:
            wpas.request("P2P_SET disallow_freq ")
            wpas.request("SET p2p_pref_chan ")