Ejemplo n.º 1
0
def actiontec_pk5000(iface_wlan_2g=None,
                     channel=None,
                     security=None,
                     ssid=None):
    """A simulated implementation of what a Actiontec PK5000 AP
    Args:
        iface_wlan_2g: The 2.4 interface of the test AP.
        channel: What channel to use.  Only 2.4Ghz is supported for this profile
        security: A security profile.  Must be none or WPA2 as this is what is
            supported by the PK5000.
        ssid: Network name
    Returns:
        A hostapd config

    Differences from real pk5000:
        Supported Rates IE:
            PK5000: Supported: 1, 2, 5.5, 11
                    Extended: 6, 9, 12, 18, 24, 36, 48, 54
            Simulated: Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                       Extended: 24, 36, 48, 54
    """
    if channel > 11:
        # Technically this should be 14 but since the PK5000 is a US only AP,
        # 11 is the highest allowable channel.
        raise ValueError('The Actiontec PK5000 does not support 5Ghz. '
                         'Invalid channel (%s)' % channel)
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    interface = iface_wlan_2g
    short_preamble = False
    force_wmm = False
    beacon_interval = 100
    dtim_period = 3
    # Sets the basic rates and supported rates of the PK5000
    additional_params = utils.merge_dicts(
        hostapd_constants.CCK_AND_OFDM_BASIC_RATES,
        hostapd_constants.CCK_AND_OFDM_DATA_RATES)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=hostapd_constants.MODE_11G,
        force_wmm=force_wmm,
        beacon_interval=beacon_interval,
        dtim_period=dtim_period,
        short_preamble=short_preamble,
        additional_parameters=additional_params)

    return config
Ejemplo n.º 2
0
def tplink_tlwr940n(iface_wlan_2g=None,
                    channel=None,
                    security=None,
                    ssid=None):
    # TODO(b/143104825): Permit RIFS once it is supported
    """A simulated implementation of an TPLink TLWR940N AP.
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        channel: What channel to use.
        security: A security profile (None or WPA2).
        ssid: The network name.
    Returns:
        A hostapd config.
    Differences from real TLWR940N:
        HT Info:
            TLWR940N: RIFS Permitted
            Simulated: RIFS Prohibited
        RSN Capabilities (w/ WPA2):
            TLWR940N:
                RSN PTKSA Replay Counter Capab: 1
            Simulated:
                RSN PTKSA Replay Counter Capab: 16
    """
    if channel > 11:
        raise ValueError('The mock TP-Link TLWR940N does not support 5Ghz. '
                         'Invalid channel (%s)' % channel)
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    n_capabilities = [
        hostapd_constants.N_CAPABILITY_SGI20,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_RX_STBC1
    ]

    rates = utils.merge_dicts(hostapd_constants.CCK_AND_OFDM_BASIC_RATES,
                              hostapd_constants.CCK_AND_OFDM_DATA_RATES)

    # Atheros Communications, Inc. IE
    # WPS IE
    vendor_elements = {
        'vendor_elements':
        'dd0900037f01010000ff7f'
        'dd260050f204104a0001101044000102104900140024e2600200010160000002000160'
        '0100020001'
    }

    additional_params = utils.merge_dicts(rates, vendor_elements,
                                          hostapd_constants.UAPSD_ENABLED)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=iface_wlan_2g,
        mode=hostapd_constants.MODE_11N_MIXED,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=1,
        short_preamble=True,
        n_capabilities=n_capabilities,
        additional_parameters=additional_params)

    return config
Ejemplo n.º 3
0
def tplink_c1200(iface_wlan_2g=None,
                 iface_wlan_5g=None,
                 channel=None,
                 security=None,
                 ssid=None):
    # TODO(b/143104825): Permit RIFS once it is supported
    # TODO(b/144446076): Address non-whirlwind hardware capabilities.
    """A simulated implementation of an TPLink C1200 AP.
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5GHz interface of the test AP.
        channel: What channel to use.
        security: A security profile (None or WPA2).
        ssid: The network name.
    Returns:
        A hostapd config.
    Differences from real C1200:
        2.4GHz:
            Rates:
                C1200:
                    Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                    Extended: 6, 9, 12, 48
                Simulated:
                    Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                    Extended: 24, 36, 48, 54
            HT Capab:
                Info:
                    C1200: Green Field supported
                    Simulated: Green Field not supported on Whirlwind.
        5GHz:
            VHT Operation Info:
                C1200: Basic MCS Map (0x0000)
                Simulated: Basic MCS Map (0xfffc)
            VHT Tx Power Envelope:
                C1200: Local Max Tx Pwr Constraint: 7.0 dBm
                Simulated: Local Max Tx Pwr Constraint: 23.0 dBm
        Both:
            HT Info:
                C1200: RIFS Permitted
                Simulated: RIFS Prohibited
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    vht_channel_width = 20
    n_capabilities = [
        hostapd_constants.N_CAPABILITY_SGI20,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_RX_STBC1,
        hostapd_constants.N_CAPABILITY_MAX_AMSDU_7935
    ]
    # WPS IE
    # Broadcom IE
    vendor_elements = {
        'vendor_elements':
        'dd350050f204104a000110104400010210470010000000000000000000000000000000'
        '00103c0001031049000a00372a00012005022688'
        'dd090010180200000c0000'
    }

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        short_preamble = True
        mode = hostapd_constants.MODE_11N_MIXED
        ac_capabilities = None

    # 5GHz
    else:
        interface = iface_wlan_5g
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)
        short_preamble = False
        mode = hostapd_constants.MODE_11AC_MIXED
        n_capabilities.append(hostapd_constants.N_CAPABILITY_LDPC)
        ac_capabilities = [
            hostapd_constants.AC_CAPABILITY_MAX_MPDU_11454,
            hostapd_constants.AC_CAPABILITY_SHORT_GI_80,
            hostapd_constants.AC_CAPABILITY_RXLDPC,
            hostapd_constants.AC_CAPABILITY_TX_STBC_2BY1,
            hostapd_constants.AC_CAPABILITY_RX_STBC_1,
            hostapd_constants.AC_CAPABILITY_MAX_A_MPDU_LEN_EXP7,
        ]

    additional_params = utils.merge_dicts(
        rates, vendor_elements, hostapd_constants.ENABLE_RRM_BEACON_REPORT,
        hostapd_constants.ENABLE_RRM_NEIGHBOR_REPORT,
        hostapd_constants.UAPSD_ENABLED)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=mode,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=1,
        short_preamble=short_preamble,
        n_capabilities=n_capabilities,
        ac_capabilities=ac_capabilities,
        vht_channel_width=vht_channel_width,
        additional_parameters=additional_params)
    return config
Ejemplo n.º 4
0
def tplink_archerc7(iface_wlan_2g=None,
                    iface_wlan_5g=None,
                    channel=None,
                    security=None,
                    ssid=None):
    # TODO(b/143104825): Permit RIFS once it is supported
    """A simulated implementation of an TPLink ArcherC7 AP.
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5GHz interface of the test AP.
        channel: What channel to use.
        security: A security profile (None or WPA2).
        ssid: The network name.
    Returns:
        A hostapd config.
    Differences from real ArcherC7:
        5GHz:
            Country Code:
                Simulated: Has two country code IEs, one that matches
                the actual, and another explicit IE that was required for
                hostapd's 802.11d to work.
        Both:
            HT Info:
                ArcherC7: RIFS Permitted
                Simulated: RIFS Prohibited
            RSN Capabilities (w/ WPA2):
                ArcherC7:
                    RSN PTKSA Replay Counter Capab: 1
                Simulated:
                    RSN PTKSA Replay Counter Capab: 16
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    vht_channel_width = 80
    n_capabilities = [
        hostapd_constants.N_CAPABILITY_LDPC,
        hostapd_constants.N_CAPABILITY_SGI20,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_RX_STBC1
    ]
    # Atheros IE
    # WPS IE
    vendor_elements = {
        'vendor_elements':
        'dd0900037f01010000ff7f'
        'dd180050f204104a00011010440001021049000600372a000120'
    }

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        short_preamble = True
        mode = hostapd_constants.MODE_11N_MIXED
        spectrum_mgmt = False
        pwr_constraint = {}
        ac_capabilities = None
        vht_channel_width = None

    # 5GHz
    else:
        interface = iface_wlan_5g
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)
        short_preamble = False
        mode = hostapd_constants.MODE_11AC_MIXED
        spectrum_mgmt = True
        # Country Information IE (w/ individual channel info)
        vendor_elements['vendor_elements'] += (
            '074255532024011e28011e2c011e30'
            '011e3401173801173c01174001176401176801176c0117700117740117840117'
            '8801178c011795011e99011e9d011ea1011ea5011e')
        pwr_constraint = {'local_pwr_constraint': 3}
        n_capabilities += [
            hostapd_constants.N_CAPABILITY_SGI40,
            hostapd_constants.N_CAPABILITY_MAX_AMSDU_7935
        ]

        if hostapd_config.ht40_plus_allowed(channel):
            n_capabilities.append(hostapd_constants.N_CAPABILITY_HT40_PLUS)
        elif hostapd_config.ht40_minus_allowed(channel):
            n_capabilities.append(hostapd_constants.N_CAPABILITY_HT40_MINUS)

        ac_capabilities = [
            hostapd_constants.AC_CAPABILITY_MAX_MPDU_11454,
            hostapd_constants.AC_CAPABILITY_RXLDPC,
            hostapd_constants.AC_CAPABILITY_SHORT_GI_80,
            hostapd_constants.AC_CAPABILITY_TX_STBC_2BY1,
            hostapd_constants.AC_CAPABILITY_RX_STBC_1,
            hostapd_constants.AC_CAPABILITY_MAX_A_MPDU_LEN_EXP7,
            hostapd_constants.AC_CAPABILITY_RX_ANTENNA_PATTERN,
            hostapd_constants.AC_CAPABILITY_TX_ANTENNA_PATTERN
        ]

    additional_params = utils.merge_dicts(rates, vendor_elements,
                                          hostapd_constants.UAPSD_ENABLED,
                                          pwr_constraint)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=mode,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=1,
        short_preamble=short_preamble,
        n_capabilities=n_capabilities,
        ac_capabilities=ac_capabilities,
        vht_channel_width=vht_channel_width,
        spectrum_mgmt_required=spectrum_mgmt,
        additional_parameters=additional_params)
    return config
Ejemplo n.º 5
0
def linksys_ea4500(iface_wlan_2g=None,
                   iface_wlan_5g=None,
                   channel=None,
                   security=None,
                   ssid=None):
    # TODO(b/143104825): Permit RIFS once it is supported
    # TODO(b/144446076): Address non-whirlwind hardware capabilities.
    """A simulated implementation of what a Linksys EA4500 AP
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5GHz interface of the test AP.
        channel: What channel to use.
        security: A security profile (None or WPA2).
        ssid: The network name.
    Returns:
        A hostapd config.
    Differences from real EA4500:
        CF (Contention-Free) Parameter IE:
            EA4500: has CF Parameter IE
            Simulated: does not have CF Parameter IE
        HT Capab:
            Info:
                EA4500: Green Field supported
                Simulated: Green Field not supported on Whirlwind.
            A-MPDU
                RTAC66U: MPDU Density 4
                Simulated: MPDU Density 8
        RSN Capab (w/ WPA2):
            EA4500:
                RSN PTKSA Replay Counter Capab: 1
            Simulated:
                RSN PTKSA Replay Counter Capab: 16
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES

    n_capabilities = [
        hostapd_constants.N_CAPABILITY_SGI20,
        hostapd_constants.N_CAPABILITY_SGI40,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_RX_STBC1,
        hostapd_constants.N_CAPABILITY_DSSS_CCK_40
    ]

    # Epigram HT Capabilities IE
    # Epigram HT Additional Capabilities IE
    # Marvell Semiconductor, Inc. IE
    vendor_elements = {
        'vendor_elements':
        'dd1e00904c33fc0117ffffff0000000000000000000000000000000000000000'
        'dd1a00904c3424000000000000000000000000000000000000000000'
        'dd06005043030000'
    }

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        obss_interval = 180
        n_capabilities.append(hostapd_constants.N_CAPABILITY_HT40_PLUS)

    # 5GHz
    else:
        interface = iface_wlan_5g
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)
        obss_interval = None

    additional_params = utils.merge_dicts(rates, vendor_elements,
                                          hostapd_constants.UAPSD_ENABLED)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=hostapd_constants.MODE_11N_MIXED,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=1,
        short_preamble=True,
        obss_interval=obss_interval,
        n_capabilities=n_capabilities,
        additional_parameters=additional_params)

    return config
Ejemplo n.º 6
0
def linksys_wrt1900acv2(iface_wlan_2g=None,
                        iface_wlan_5g=None,
                        channel=None,
                        security=None,
                        ssid=None):
    # TODO(b/144446076): Address non-whirlwind hardware capabilities.
    """A simulated implementation of what a Linksys WRT1900ACV2 AP
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5GHz interface of the test AP.
        channel: What channel to use.
        security: A security profile (None or WPA2).
        ssid: The network name.
    Returns:
        A hostapd config.
    Differences from real WRT1900ACV2:
        5 GHz:
            Simulated: Has two country code IEs, one that matches
                the actual, and another explicit IE that was required for
                hostapd's 802.11d to work.
        Both:
            HT Capab:
                A-MPDU
                    WRT1900ACV2: MPDU Density 4
                    Simulated: MPDU Density 8
            VHT Capab:
                WRT1900ACV2:
                    SU Beamformer Supported,
                    SU Beamformee Supported,
                    Beamformee STS Capability: 4,
                    Number of Sounding Dimensions: 4,
                Simulated:
                    Above are not supported on Whirlwind.
            RSN Capabilities (w/ WPA2):
                WRT1900ACV2:
                    RSN PTKSA Replay Counter Capab: 1
                Simulated:
                    RSN PTKSA Replay Counter Capab: 16
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    n_capabilities = [
        hostapd_constants.N_CAPABILITY_LDPC,
        hostapd_constants.N_CAPABILITY_SGI20,
        hostapd_constants.N_CAPABILITY_SGI40
    ]
    ac_capabilities = [
        hostapd_constants.AC_CAPABILITY_RXLDPC,
        hostapd_constants.AC_CAPABILITY_SHORT_GI_80,
        hostapd_constants.AC_CAPABILITY_RX_STBC_1,
        hostapd_constants.AC_CAPABILITY_RX_ANTENNA_PATTERN,
        hostapd_constants.AC_CAPABILITY_TX_ANTENNA_PATTERN,
        hostapd_constants.AC_CAPABILITY_MAX_A_MPDU_LEN_EXP7
    ]
    vht_channel_width = 20
    # Epigram, Inc. HT Capabilities IE
    # Epigram, Inc. HT Additional Capabilities IE
    # Marvell Semiconductor IE
    vendor_elements = {
        'vendor_elements':
        'dd1e00904c336c0017ffffff0001000000000000000000000000001fff071800'
        'dd1a00904c3424000000000000000000000000000000000000000000'
        'dd06005043030000'
    }

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        obss_interval = 180
        spectrum_mgmt = False
        local_pwr_constraint = {}

    # 5GHz
    else:
        interface = iface_wlan_5g
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)
        obss_interval = None
        spectrum_mgmt = True,
        local_pwr_constraint = {'local_pwr_constraint': 3}
        # Country Information IE (w/ individual channel info)
        vendor_elements['vendor_elements'] += '071e5553202401112801112c011130' \
            '01119501179901179d0117a10117a50117'

    additional_params = utils.merge_dicts(rates, vendor_elements,
                                          hostapd_constants.UAPSD_ENABLED,
                                          local_pwr_constraint)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=hostapd_constants.MODE_11AC_MIXED,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=1,
        short_preamble=True,
        obss_interval=obss_interval,
        n_capabilities=n_capabilities,
        ac_capabilities=ac_capabilities,
        vht_channel_width=vht_channel_width,
        spectrum_mgmt_required=spectrum_mgmt,
        additional_parameters=additional_params)
    return config
Ejemplo n.º 7
0
def linksys_ea9500(iface_wlan_2g=None,
                   iface_wlan_5g=None,
                   channel=None,
                   security=None,
                   ssid=None):
    """A simulated implementation of what a Linksys EA9500 AP
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5GHz interface of the test AP.
        channel: What channel to use.
        security: A security profile (None or WPA2).
        ssid: The network name.
    Returns:
        A hostapd config.
    Differences from real EA9500:
        2.4GHz:
            Rates:
                EA9500:
                    Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                    Extended: 6, 9, 12, 48
                Simulated:
                    Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                    Extended: 24, 36, 48, 54
        RSN Capab (w/ WPA2):
            EA9500:
                RSN PTKSA Replay Counter Capab: 16
            Simulated:
                RSN PTKSA Replay Counter Capab: 1
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    qbss = {'bss_load_update_period': 50, 'chan_util_avg_period': 600}
    # Measurement Pilot Transmission IE
    vendor_elements = {'vendor_elements': '42020000'}

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        mode = hostapd_constants.MODE_11G
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)

    # 5GHz
    else:
        interface = iface_wlan_5g
        mode = hostapd_constants.MODE_11A
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)

    additional_params = utils.merge_dicts(rates, qbss, vendor_elements)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=mode,
        force_wmm=False,
        beacon_interval=100,
        dtim_period=1,
        short_preamble=False,
        additional_parameters=additional_params)
    return config
Ejemplo n.º 8
0
def actiontec_mi424wr(iface_wlan_2g=None,
                      channel=None,
                      security=None,
                      ssid=None):
    # TODO(b/143104825): Permit RIFS once it is supported
    """A simulated implementation of an Actiontec MI424WR AP.
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        channel: What channel to use (2.4Ghz or 5Ghz).
        security: A security profile.
        ssid: The network name.
    Returns:
        A hostapd config.

    Differences from real MI424WR:
        HT Capabilities:
            MI424WR:
                HT Rx STBC: Support for 1, 2, and 3
            Simulated:
                HT Rx STBC: Support for 1
        HT Information:
            MI424WR:
                RIFS: Premitted
            Simulated:
                RIFS: Prohibited
    """
    if channel > 11:
        raise ValueError('The Actiontec MI424WR does not support 5Ghz. '
                         'Invalid channel (%s)' % channel)
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    n_capabilities = [
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_DSSS_CCK_40,
        hostapd_constants.N_CAPABILITY_RX_STBC1
    ]
    rates = utils.merge_dicts(hostapd_constants.CCK_AND_OFDM_DATA_RATES,
                              hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
    # Proprietary Atheros Communication: Adv Capability IE
    # Proprietary Atheros Communication: Unknown IE
    # Country Info: US Only IE
    vendor_elements = {
        'vendor_elements':
        'dd0900037f01010000ff7f'
        'dd0a00037f04010000000000'
        '0706555320010b1b'
    }

    additional_params = utils.merge_dicts(rates, vendor_elements)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=iface_wlan_2g,
        mode=hostapd_constants.MODE_11N_MIXED,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=1,
        short_preamble=True,
        n_capabilities=n_capabilities,
        additional_parameters=additional_params)

    return config
Ejemplo n.º 9
0
def netgear_wndr3400(iface_wlan_2g=None,
                     iface_wlan_5g=None,
                     channel=None,
                     security=None,
                     ssid=None):
    # TODO(b/143104825): Permit RIFS on 5GHz once it is supported
    # TODO(b/144446076): Address non-whirlwind hardware capabilities.
    """A simulated implementation of what a Netgear WNDR3400 AP
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5GHz interface of the test AP.
        channel: What channel to use.
        security: A security profile (None or WPA2).
        ssid: The network name.
    Returns:
        A hostapd config.
    Differences from real WNDR3400:
        2.4GHz:
            Rates:
                WNDR3400:
                    Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                    Extended: 6, 9, 12, 48
                Simulated:
                    Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                    Extended: 24, 36, 48,
        5GHz:
            HT Info:
                WNDR3400: RIFS Permitted
                Simulated: RIFS Prohibited
        Both:
            HT Capab:
                A-MPDU
                    WNDR3400: MPDU Density 16
                    Simulated: MPDU Density 8
                Info
                    WNDR3400: Green Field supported
                    Simulated: Green Field not supported on Whirlwind.
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    n_capabilities = [
        hostapd_constants.N_CAPABILITY_SGI20,
        hostapd_constants.N_CAPABILITY_SGI40,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_MAX_AMSDU_7935,
        hostapd_constants.N_CAPABILITY_DSSS_CCK_40
    ]
    # WPS IE
    # Broadcom IE
    vendor_elements = {
        'vendor_elements':
        'dd310050f204104a0001101044000102104700108c403eb883e7e225ab139828703ade'
        'dc103c0001031049000600372a000120'
        'dd090010180200f0040000'
    }

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        obss_interval = 300
        n_capabilities.append(hostapd_constants.N_CAPABILITY_DSSS_CCK_40)

    # 5GHz
    else:
        interface = iface_wlan_5g
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)
        obss_interval = None
        n_capabilities.append(hostapd_constants.N_CAPABILITY_HT40_PLUS)

    additional_params = utils.merge_dicts(rates, vendor_elements,
                                          hostapd_constants.UAPSD_ENABLED)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=hostapd_constants.MODE_11N_MIXED,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=2,
        short_preamble=False,
        obss_interval=obss_interval,
        n_capabilities=n_capabilities,
        additional_parameters=additional_params)

    return config
Ejemplo n.º 10
0
def asus_rtn66u(iface_wlan_2g=None,
                iface_wlan_5g=None,
                channel=None,
                security=None,
                ssid=None):
    # TODO(b/143104825): Permit RIFS once it is supported
    """A simulated implementation of an Asus RTN66U AP.
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5Ghz interface of the test AP.
        channel: What channel to use.
        security: A security profile.  Must be none or WPA2 as this is what is
            supported by the RTN66U.
        ssid: Network name
    Returns:
        A hostapd config
    Differences from real RTN66U:
        2.4GHz:
            Rates:
                RTN66U:
                    Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                    Extended: 6, 9, 12, 48
                Simulated:
                    Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                    Extended: 24, 36, 48, 54
        Both:
            HT Info:
                RTN66U: RIFS Permitted
                Simulated: RIFS Prohibited
            HT Capab:
                Info:
                    RTN66U: Green Field supported
                    Simulated: Green Field not supported on Whirlwind.
                A-MPDU
                    RTN66U: MPDU Density 4
                    Simulated: MPDU Density 8
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    n_capabilities = [
        hostapd_constants.N_CAPABILITY_LDPC,
        hostapd_constants.N_CAPABILITY_SGI20,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_RX_STBC1,
        hostapd_constants.N_CAPABILITY_MAX_AMSDU_7935
    ]
    # Broadcom IE
    vendor_elements = {'vendor_elements': 'dd090010180200001c0000'}

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        n_capabilities.append(hostapd_constants.N_CAPABILITY_DSSS_CCK_40)

    # 5GHz
    else:
        interface = iface_wlan_5g
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)

    additional_params = utils.merge_dicts(rates, vendor_elements,
                                          hostapd_constants.UAPSD_ENABLED)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=hostapd_constants.MODE_11N_MIXED,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=3,
        short_preamble=False,
        n_capabilities=n_capabilities,
        additional_parameters=additional_params)

    return config
Ejemplo n.º 11
0
def asus_rtn56u(iface_wlan_2g=None,
                iface_wlan_5g=None,
                channel=None,
                security=None,
                ssid=None):
    """A simulated implementation of an Asus RTN56U AP.
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5Ghz interface of the test AP.
        channel: What channel to use.
        security: A security profile.  Must be none or WPA2 as this is what is
            supported by the RTN56U.
        ssid: Network name
    Returns:
        A hostapd config
    Differences from real RTN56U:
        2.4GHz:
            Rates:
                RTN56U:
                    Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                    Extended: 6, 9, 12, 48
                Simulated:
                    Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                    Extended: 24, 36, 48, 54
        Both:
            Fixed Parameters:
                RTN56U: APSD Implemented
                Simulated: APSD Not Implemented
            HT Capab:
                A-MPDU
                    RTN56U: MPDU Density 4
                    Simulated: MPDU Density 8
            RSN Capabilities (w/ WPA2):
                RTN56U:
                    RSN PTKSA Replay Counter Capab: 1
                Simulated:
                    RSN PTKSA Replay Counter Capab: 16
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    qbss = {'bss_load_update_period': 50, 'chan_util_avg_period': 600}
    n_capabilities = [
        hostapd_constants.N_CAPABILITY_SGI20,
        hostapd_constants.N_CAPABILITY_SGI40,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_RX_STBC1
    ]

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        # Ralink Technology IE
        # US Country Code IE
        # AP Channel Report IEs (2)
        # WPS IE
        vendor_elements = {
            'vendor_elements':
            'dd07000c4307000000'
            '0706555320010b14'
            '33082001020304050607'
            '33082105060708090a0b'
            'dd270050f204104a000110104400010210470010bc329e001dd811b286011c872c'
            'd33448103c000101'
        }

    # 5GHz
    else:
        interface = iface_wlan_5g
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)
        # Ralink Technology IE
        # US Country Code IE
        vendor_elements = {
            'vendor_elements': 'dd07000c4307000000'
            '0706555320010b14'
        }

    additional_params = utils.merge_dicts(rates, vendor_elements, qbss,
                                          hostapd_constants.UAPSD_ENABLED)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=hostapd_constants.MODE_11N_MIXED,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=1,
        short_preamble=False,
        n_capabilities=n_capabilities,
        additional_parameters=additional_params)

    return config
Ejemplo n.º 12
0
def asus_rtac5300(iface_wlan_2g=None,
                  iface_wlan_5g=None,
                  channel=None,
                  security=None,
                  ssid=None):
    # TODO(b/143104825): Permit RIFS once it is supported
    # TODO(b/144446076): Address non-whirlwind hardware capabilities.
    """A simulated implementation of an Asus RTAC5300 AP.
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5Ghz interface of the test AP.
        channel: What channel to use.
        security: A security profile.  Must be none or WPA2 as this is what is
            supported by the RTAC5300.
        ssid: Network name
    Returns:
        A hostapd config
    Differences from real RTAC5300:
        2.4GHz:
            Rates:
                RTAC86U:
                    Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                    Extended: 6, 9, 12, 48
                Simulated:
                    Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                    Extended: 24, 36, 48, 54
        5GHz:
            VHT Capab:
                RTAC5300:
                    SU Beamformer Supported,
                    SU Beamformee Supported,
                    Beamformee STS Capability: 4,
                    Number of Sounding Dimensions: 4,
                    MU Beamformer Supported,
                    VHT Link Adaptation: Both
                Simulated:
                    Above are not supported on Whirlwind.
            VHT Operation Info:
                RTAC5300: Basic MCS Map (0x0000)
                Simulated: Basic MCS Map (0xfffc)
            VHT Tx Power Envelope:
                RTAC5300: Local Max Tx Pwr Constraint: 1.0 dBm
                Simulated: Local Max Tx Pwr Constraint: 23.0 dBm
        Both:
            HT Capab:
                A-MPDU
                    RTAC5300: MPDU Density 4
                    Simulated: MPDU Density 8
            HT Info:
                RTAC5300: RIFS Permitted
                Simulated: RIFS Prohibited
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    vht_channel_width = 20
    qbss = {'bss_load_update_period': 50, 'chan_util_avg_period': 600}
    n_capabilities = [
        hostapd_constants.N_CAPABILITY_LDPC,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_RX_STBC1,
        hostapd_constants.N_CAPABILITY_SGI20
    ]

    # Broadcom IE
    vendor_elements = {'vendor_elements': 'dd090010180200009c0000'}

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        mode = hostapd_constants.MODE_11N_MIXED
        # AsusTek IE
        # Epigram 2.4GHz IE
        vendor_elements['vendor_elements'] += 'dd25f832e4010101020100031411b5' \
        '2fd437509c30b3d7f5cf5754fb125aed3b8507045aed3b85' \
        'dd1e00904c0418bf0cb2798b0faaff0000aaff0000c0050001000000c3020002'
        ac_capabilities = None

    # 5GHz
    else:
        interface = iface_wlan_5g
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)
        mode = hostapd_constants.MODE_11AC_MIXED
        # Epigram 5GHz IE
        vendor_elements['vendor_elements'] += 'dd0500904c0410'
        ac_capabilities = [
            hostapd_constants.AC_CAPABILITY_RXLDPC,
            hostapd_constants.AC_CAPABILITY_SHORT_GI_80,
            hostapd_constants.AC_CAPABILITY_TX_STBC_2BY1,
            hostapd_constants.AC_CAPABILITY_RX_STBC_1,
            hostapd_constants.AC_CAPABILITY_MAX_MPDU_11454,
            hostapd_constants.AC_CAPABILITY_MAX_A_MPDU_LEN_EXP7
        ]

    additional_params = utils.merge_dicts(rates, qbss, vendor_elements,
                                          hostapd_constants.UAPSD_ENABLED)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=mode,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=3,
        short_preamble=False,
        n_capabilities=n_capabilities,
        ac_capabilities=ac_capabilities,
        vht_channel_width=vht_channel_width,
        additional_parameters=additional_params)
    return config
Ejemplo n.º 13
0
def asus_rtac66u(iface_wlan_2g=None,
                 iface_wlan_5g=None,
                 channel=None,
                 security=None,
                 ssid=None):
    # TODO(b/143104825): Permit RIFS once it is supported
    # TODO(b/144446076): Address non-whirlwind hardware capabilities.
    """A simulated implementation of an Asus RTAC66U AP.
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5Ghz interface of the test AP.
        channel: What channel to use.
        security: A security profile.  Must be none or WPA2 as this is what is
            supported by the RTAC66U.
        ssid: Network name
    Returns:
        A hostapd config
    Differences from real RTAC66U:
        2.4 GHz:
            Rates:
                RTAC66U:
                    Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                    Extended: 6, 9, 12, 48
                Simulated:
                    Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                    Extended: 24, 36, 48, 54
            HT Capab:
                Info
                    RTAC66U: Green Field supported
                    Simulated: Green Field not supported on Whirlwind.
        5GHz:
            VHT Capab:
                RTAC66U:
                    SU Beamformer Supported,
                    SU Beamformee Supported,
                    Beamformee STS Capability: 3,
                    Number of Sounding Dimensions: 3,
                    VHT Link Adaptation: Both
                Simulated:
                    Above are not supported on Whirlwind.
            VHT Operation Info:
                RTAC66U: Basic MCS Map (0x0000)
                Simulated: Basic MCS Map (0xfffc)
            VHT Tx Power Envelope:
                RTAC66U: Local Max Tx Pwr Constraint: 1.0 dBm
                Simulated: Local Max Tx Pwr Constraint: 23.0 dBm
        Both:
            HT Capab:
                A-MPDU
                    RTAC66U: MPDU Density 4
                    Simulated: MPDU Density 8
            HT Info:
                RTAC66U: RIFS Permitted
                Simulated: RIFS Prohibited
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    vht_channel_width = 20
    n_capabilities = [
        hostapd_constants.N_CAPABILITY_LDPC,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_RX_STBC1,
        hostapd_constants.N_CAPABILITY_MAX_AMSDU_7935,
        hostapd_constants.N_CAPABILITY_DSSS_CCK_40,
        hostapd_constants.N_CAPABILITY_SGI20
    ]
    # WPS IE
    # Broadcom IE
    vendor_elements = {
        'vendor_elements':
        'dd310050f204104a00011010440001021047001093689729d373c26cb1563c6c570f33'
        'd7103c0001031049000600372a000120'
        'dd090010180200001c0000'
    }

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        mode = hostapd_constants.MODE_11N_MIXED
        ac_capabilities = None

    # 5GHz
    else:
        interface = iface_wlan_5g
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)
        mode = hostapd_constants.MODE_11AC_MIXED
        ac_capabilities = [
            hostapd_constants.AC_CAPABILITY_RXLDPC,
            hostapd_constants.AC_CAPABILITY_SHORT_GI_80,
            hostapd_constants.AC_CAPABILITY_TX_STBC_2BY1,
            hostapd_constants.AC_CAPABILITY_RX_STBC_1,
            hostapd_constants.AC_CAPABILITY_MAX_MPDU_11454,
            hostapd_constants.AC_CAPABILITY_MAX_A_MPDU_LEN_EXP7
        ]

    additional_params = utils.merge_dicts(rates, vendor_elements,
                                          hostapd_constants.UAPSD_ENABLED)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=mode,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=3,
        short_preamble=False,
        n_capabilities=n_capabilities,
        ac_capabilities=ac_capabilities,
        vht_channel_width=vht_channel_width,
        additional_parameters=additional_params)

    return config
Ejemplo n.º 14
0
def asus_rtac86u(iface_wlan_2g=None,
                 iface_wlan_5g=None,
                 channel=None,
                 security=None,
                 ssid=None):
    """A simulated implementation of an Asus RTAC86U AP.
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5Ghz interface of the test AP.
        channel: What channel to use.
        security: A security profile.  Must be none or WPA2 as this is what is
            supported by the RTAC86U.
        ssid: Network name
    Returns:
        A hostapd config
    Differences from real RTAC86U:
        2.4GHz:
            Rates:
                RTAC86U:
                    Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                    Extended: 6, 9, 12, 48
                Simulated:
                    Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                    Extended: 24, 36, 48, 54
        5GHz:
            Country Code:
                Simulated: Has two country code IEs, one that matches
                the actual, and another explicit IE that was required for
                hostapd's 802.11d to work.
        Both:
            RSN Capabilities (w/ WPA2):
                RTAC86U:
                    RSN PTKSA Replay Counter Capab: 16
                Simulated:
                    RSN PTKSA Replay Counter Capab: 1
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    qbss = {'bss_load_update_period': 50, 'chan_util_avg_period': 600}

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        mode = hostapd_constants.MODE_11G
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        spectrum_mgmt = False
        # Measurement Pilot Transmission IE
        vendor_elements = {'vendor_elements': '42020000'}

    # 5GHz
    else:
        interface = iface_wlan_5g
        mode = hostapd_constants.MODE_11A
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)
        spectrum_mgmt = True,
        # Country Information IE (w/ individual channel info)
        # TPC Report Transmit Power IE
        # Measurement Pilot Transmission IE
        vendor_elements = {
            'vendor_elements':
            '074255532024011e28011e2c011e30011e34011e38011e3c011e40011e64011e'
            '68011e6c011e70011e74011e84011e88011e8c011e95011e99011e9d011ea1011e'
            'a5011e'
            '23021300'
            '42020000'
        }

    additional_params = utils.merge_dicts(rates, qbss, vendor_elements)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=mode,
        force_wmm=False,
        beacon_interval=100,
        dtim_period=3,
        short_preamble=False,
        spectrum_mgmt_required=spectrum_mgmt,
        additional_parameters=additional_params)
    return config
Ejemplo n.º 15
0
def belkin_f9k1001v5(iface_wlan_2g=None,
                     channel=None,
                     security=None,
                     ssid=None):
    # TODO(b/143104825): Permit RIFS once it is supported
    """A simulated implementation of what a Belkin F9K1001v5 AP
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        channel: What channel to use.
        security: A security profile (None or WPA2).
        ssid: The network name.
    Returns:
        A hostapd config.
    Differences from real F9K1001v5:
        Rates:
            F9K1001v5:
                Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                Extended: 6, 9, 12, 48
            Simulated:
                Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                Extended: 24, 36, 48, 54
        HT Info:
            F9K1001v5:
                RIFS: Permitted
            Simulated:
                RIFS: Prohibited
        RSN Capabilities (w/ WPA2):
            F9K1001v5:
                RSN PTKSA Replay Counter Capab: 1
            Simulated:
                RSN PTKSA Replay Counter Capab: 16
    """
    if channel > 11:
        raise ValueError('The Belkin F9k1001v5 does not support 5Ghz. '
                         'Invalid channel (%s)' % channel)
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    n_capabilities = [
        hostapd_constants.N_CAPABILITY_SGI20,
        hostapd_constants.N_CAPABILITY_SGI40,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_MAX_AMSDU_7935,
        hostapd_constants.N_CAPABILITY_DSSS_CCK_40
    ]

    rates = additional_params = utils.merge_dicts(
        hostapd_constants.CCK_AND_OFDM_BASIC_RATES,
        hostapd_constants.CCK_AND_OFDM_DATA_RATES)

    # Broadcom IE
    # WPS IE
    vendor_elements = {
        'vendor_elements':
        'dd090010180200100c0000'
        'dd180050f204104a00011010440001021049000600372a000120'
    }

    additional_params = utils.merge_dicts(rates, vendor_elements)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=iface_wlan_2g,
        mode=hostapd_constants.MODE_11N_MIXED,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=3,
        short_preamble=False,
        n_capabilities=n_capabilities,
        additional_parameters=additional_params)

    return config
Ejemplo n.º 16
0
def securifi_almond(iface_wlan_2g=None,
                    channel=None,
                    security=None,
                    ssid=None):
    """A simulated implementation of a Securifi Almond AP
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        channel: What channel to use.
        security: A security profile (None or WPA2).
        ssid: The network name.
    Returns:
        A hostapd config.
    Differences from real Almond:
            Rates:
                Almond:
                    Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                    Extended: 6, 9, 12, 48
                Simulated:
                    Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                    Extended: 24, 36, 48, 54
            HT Capab:
                A-MPDU
                    Almond: MPDU Density 4
                    Simulated: MPDU Density 8
            RSN Capab (w/ WPA2):
                Almond:
                    RSN PTKSA Replay Counter Capab: 1
                Simulated:
                    RSN PTKSA Replay Counter Capab: 16
    """
    if channel > 11:
        raise ValueError('The Securifi Almond does not support 5Ghz. '
                         'Invalid channel (%s)' % channel)
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    n_capabilities = [
        hostapd_constants.N_CAPABILITY_HT40_PLUS,
        hostapd_constants.N_CAPABILITY_SGI20,
        hostapd_constants.N_CAPABILITY_SGI40,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_RX_STBC1,
        hostapd_constants.N_CAPABILITY_DSSS_CCK_40
    ]

    rates = utils.merge_dicts(hostapd_constants.CCK_AND_OFDM_BASIC_RATES,
                              hostapd_constants.CCK_AND_OFDM_DATA_RATES)

    # Ralink Technology IE
    # Country Information IE
    # AP Channel Report IEs
    vendor_elements = {
        'vendor_elements':
        'dd07000c4307000000'
        '0706555320010b14'
        '33082001020304050607'
        '33082105060708090a0b'
    }

    qbss = {'bss_load_update_period': 50, 'chan_util_avg_period': 600}

    additional_params = utils.merge_dicts(rates, vendor_elements, qbss)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=iface_wlan_2g,
        mode=hostapd_constants.MODE_11N_MIXED,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=1,
        short_preamble=True,
        obss_interval=300,
        n_capabilities=n_capabilities,
        additional_parameters=additional_params)

    return config
Ejemplo n.º 17
0
def netgear_r7000(iface_wlan_2g=None,
                  iface_wlan_5g=None,
                  channel=None,
                  security=None,
                  ssid=None):
    # TODO(b/143104825): Permit RIFS once it is supported
    # TODO(b/144446076): Address non-whirlwind hardware capabilities.
    """A simulated implementation of what a Netgear R7000 AP
    Args:
        iface_wlan_2g: The 2.4Ghz interface of the test AP.
        iface_wlan_5g: The 5GHz interface of the test AP.
        channel: What channel to use.
        security: A security profile (None or WPA2).
        ssid: The network name.
    Returns:
        A hostapd config.
    Differences from real R7000:
        2.4GHz:
            Rates:
                R7000:
                    Supported: 1, 2, 5.5, 11, 18, 24, 36, 54
                    Extended: 6, 9, 12, 48
                Simulated:
                    Supported: 1, 2, 5.5, 11, 6, 9, 12, 18
                    Extended: 24, 36, 48,
        5GHz:
            VHT Capab:
                R7000:
                    SU Beamformer Supported,
                    SU Beamformee Supported,
                    Beamformee STS Capability: 3,
                    Number of Sounding Dimensions: 3,
                    VHT Link Adaptation: Both
                Simulated:
                    Above are not supported on Whirlwind.
            VHT Operation Info:
                R7000: Basic MCS Map (0x0000)
                Simulated: Basic MCS Map (0xfffc)
            VHT Tx Power Envelope:
                R7000: Local Max Tx Pwr Constraint: 1.0 dBm
                Simulated: Local Max Tx Pwr Constraint: 23.0 dBm
        Both:
            HT Capab:
                A-MPDU
                    R7000: MPDU Density 4
                    Simulated: MPDU Density 8
            HT Info:
                R7000: RIFS Permitted
                Simulated: RIFS Prohibited
            RM Capabilities:
                R7000:
                    Beacon Table Measurement: Not Supported
                    Statistic Measurement: Enabled
                    AP Channel Report Capability: Enabled
                Simulated:
                    Beacon Table Measurement: Supported
                    Statistic Measurement: Disabled
                    AP Channel Report Capability: Disabled
    """
    # Verify interface and security
    hostapd_utils.verify_interface(iface_wlan_2g,
                                   hostapd_constants.INTERFACE_2G_LIST)
    hostapd_utils.verify_interface(iface_wlan_5g,
                                   hostapd_constants.INTERFACE_5G_LIST)
    hostapd_utils.verify_security_mode(security,
                                       [None, hostapd_constants.WPA2])
    if security:
        hostapd_utils.verify_cipher(security,
                                    [hostapd_constants.WPA2_DEFAULT_CIPER])

    # Common Parameters
    rates = hostapd_constants.CCK_AND_OFDM_DATA_RATES
    vht_channel_width = 80
    n_capabilities = [
        hostapd_constants.N_CAPABILITY_LDPC,
        hostapd_constants.N_CAPABILITY_TX_STBC,
        hostapd_constants.N_CAPABILITY_RX_STBC1,
        hostapd_constants.N_CAPABILITY_MAX_AMSDU_7935,
        hostapd_constants.N_CAPABILITY_SGI20,
    ]
    # Netgear IE
    # WPS IE
    # Epigram, Inc. IE
    # Broadcom IE
    vendor_elements = {
        'vendor_elements':
        'dd0600146c000000'
        'dd310050f204104a00011010440001021047001066189606f1e967f9c0102048817a7'
        '69e103c0001031049000600372a000120'
        'dd1e00904c0408bf0cb259820feaff0000eaff0000c0050001000000c3020002'
        'dd090010180200001c0000'
    }
    qbss = {'bss_load_update_period': 50, 'chan_util_avg_period': 600}

    # 2.4GHz
    if channel <= 11:
        interface = iface_wlan_2g
        rates.update(hostapd_constants.CCK_AND_OFDM_BASIC_RATES)
        mode = hostapd_constants.MODE_11N_MIXED
        obss_interval = 300
        ac_capabilities = None

    # 5GHz
    else:
        interface = iface_wlan_5g
        rates.update(hostapd_constants.OFDM_ONLY_BASIC_RATES)
        mode = hostapd_constants.MODE_11AC_MIXED
        n_capabilities += [
            hostapd_constants.N_CAPABILITY_SGI40,
        ]

        if hostapd_config.ht40_plus_allowed(channel):
            n_capabilities.append(hostapd_constants.N_CAPABILITY_HT40_PLUS)
        elif hostapd_config.ht40_minus_allowed(channel):
            n_capabilities.append(hostapd_constants.N_CAPABILITY_HT40_MINUS)

        obss_interval = None
        ac_capabilities = [
            hostapd_constants.AC_CAPABILITY_RXLDPC,
            hostapd_constants.AC_CAPABILITY_SHORT_GI_80,
            hostapd_constants.AC_CAPABILITY_TX_STBC_2BY1,
            hostapd_constants.AC_CAPABILITY_RX_STBC_1,
            hostapd_constants.AC_CAPABILITY_MAX_MPDU_11454,
            hostapd_constants.AC_CAPABILITY_MAX_A_MPDU_LEN_EXP7
        ]

    additional_params = utils.merge_dicts(
        rates, vendor_elements, qbss,
        hostapd_constants.ENABLE_RRM_BEACON_REPORT,
        hostapd_constants.ENABLE_RRM_NEIGHBOR_REPORT,
        hostapd_constants.UAPSD_ENABLED)

    config = hostapd_config.HostapdConfig(
        ssid=ssid,
        channel=channel,
        hidden=False,
        security=security,
        interface=interface,
        mode=mode,
        force_wmm=True,
        beacon_interval=100,
        dtim_period=2,
        short_preamble=False,
        obss_interval=obss_interval,
        n_capabilities=n_capabilities,
        ac_capabilities=ac_capabilities,
        vht_channel_width=vht_channel_width,
        additional_parameters=additional_params)
    return config