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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
def create_ap_preset(profile_name='whirlwind', iface_wlan_2g=None, iface_wlan_5g=None, channel=None, mode=None, frequency=None, security=None, pmf_support=None, ssid=None, hidden=None, dtim_period=None, frag_threshold=None, rts_threshold=None, force_wmm=None, beacon_interval=None, short_preamble=None, n_capabilities=None, ac_capabilities=None, vht_bandwidth=None, bss_settings=[]): """AP preset config generator. This a wrapper for hostapd_config but but supplies the default settings for the preset that is selected. You may specify channel or frequency, but not both. Both options are checked for validity (i.e. you can't specify an invalid channel or a frequency that will not be accepted). Args: profile_name: The name of the device want the preset for. Options: whirlwind channel: int, channel number. dtim: int, DTIM value of the AP, default is 2. frequency: int, frequency of channel. security: Security, the secuirty settings to use. ssid: string, The name of the ssid to brodcast. pmf_support: int, whether pmf is disabled, enabled, or required vht_bandwidth: VHT bandwidth for 11ac operation. bss_settings: The settings for all bss. iface_wlan_2g: the wlan 2g interface name of the AP. iface_wlan_5g: the wlan 5g interface name of the AP. mode: The hostapd 802.11 mode of operation. ssid: The ssid for the wireless network. hidden: Whether to include the ssid in the beacons. dtim_period: The dtim period for the BSS frag_threshold: Max size of packet before fragmenting the packet. rts_threshold: Max size of packet before requiring protection for rts/cts or cts to self. n_capabilities: 802.11n capabilities for for BSS to advertise. ac_capabilities: 802.11ac capabilities for for BSS to advertise. Returns: A hostapd_config object that can be used by the hostapd object. """ # Verify interfaces hostapd_utils.verify_interface(iface_wlan_2g, hostapd_constants.INTERFACE_2G_LIST) hostapd_utils.verify_interface(iface_wlan_5g, hostapd_constants.INTERFACE_5G_LIST) if channel: frequency = hostapd_config.get_frequency_for_channel(channel) elif frequency: channel = hostapd_config.get_channel_for_frequency(frequency) else: raise ValueError('Specify either frequency or channel.') if profile_name == 'whirlwind': # profile indicates phy mode is 11bgn for 2.4Ghz or 11acn for 5Ghz hidden = _get_or_default(hidden, False) force_wmm = _get_or_default(force_wmm, True) beacon_interval = _get_or_default(beacon_interval, 100) short_preamble = _get_or_default(short_preamble, True) dtim_period = _get_or_default(dtim_period, 2) frag_threshold = _get_or_default(frag_threshold, 2346) rts_threshold = _get_or_default(rts_threshold, 2347) if frequency < 5000: interface = iface_wlan_2g mode = _get_or_default(mode, hostapd_constants.MODE_11N_MIXED) n_capabilities = _get_or_default(n_capabilities, [ hostapd_constants.N_CAPABILITY_LDPC, 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 ]) config = hostapd_config.HostapdConfig( ssid=ssid, hidden=hidden, security=security, pmf_support=pmf_support, interface=interface, mode=mode, force_wmm=force_wmm, beacon_interval=beacon_interval, dtim_period=dtim_period, short_preamble=short_preamble, frequency=frequency, n_capabilities=n_capabilities, frag_threshold=frag_threshold, rts_threshold=rts_threshold, bss_settings=bss_settings) else: interface = iface_wlan_5g vht_bandwidth = _get_or_default(vht_bandwidth, 80) mode = _get_or_default(mode, hostapd_constants.MODE_11AC_MIXED) if hostapd_config.ht40_plus_allowed(channel): extended_channel = hostapd_constants.N_CAPABILITY_HT40_PLUS elif hostapd_config.ht40_minus_allowed(channel): extended_channel = hostapd_constants.N_CAPABILITY_HT40_MINUS # Channel 165 operates in 20MHz with n or ac modes. if channel == 165: mode = hostapd_constants.MODE_11N_MIXED extended_channel = hostapd_constants.N_CAPABILITY_HT20 # Define the n capability vector for 20 MHz and higher bandwidth if not vht_bandwidth: pass elif vht_bandwidth >= 40: n_capabilities = _get_or_default(n_capabilities, [ hostapd_constants.N_CAPABILITY_LDPC, extended_channel, hostapd_constants.N_CAPABILITY_SGI20, hostapd_constants.N_CAPABILITY_SGI40, hostapd_constants.N_CAPABILITY_TX_STBC, hostapd_constants.N_CAPABILITY_RX_STBC1 ]) else: n_capabilities = _get_or_default(n_capabilities, [ hostapd_constants.N_CAPABILITY_LDPC, 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_HT20 ]) ac_capabilities = _get_or_default(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 ]) config = hostapd_config.HostapdConfig( ssid=ssid, hidden=hidden, security=security, pmf_support=pmf_support, interface=interface, mode=mode, force_wmm=force_wmm, vht_channel_width=vht_bandwidth, beacon_interval=beacon_interval, dtim_period=dtim_period, short_preamble=short_preamble, frequency=frequency, frag_threshold=frag_threshold, rts_threshold=rts_threshold, n_capabilities=n_capabilities, ac_capabilities=ac_capabilities, bss_settings=bss_settings) elif profile_name == 'whirlwind_11ab_legacy': if frequency < 5000: mode = hostapd_constants.MODE_11B else: mode = hostapd_constants.MODE_11A config = create_ap_preset(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, ssid=ssid, channel=channel, mode=mode, security=security, pmf_support=pmf_support, hidden=hidden, force_wmm=force_wmm, beacon_interval=beacon_interval, short_preamble=short_preamble, dtim_period=dtim_period, rts_threshold=rts_threshold, frag_threshold=frag_threshold, n_capabilities=[], ac_capabilities=[], vht_bandwidth=None) elif profile_name == 'whirlwind_11ag_legacy': if frequency < 5000: mode = hostapd_constants.MODE_11G else: mode = hostapd_constants.MODE_11A config = create_ap_preset(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, ssid=ssid, channel=channel, mode=mode, security=security, pmf_support=pmf_support, hidden=hidden, force_wmm=force_wmm, beacon_interval=beacon_interval, short_preamble=short_preamble, dtim_period=dtim_period, rts_threshold=rts_threshold, frag_threshold=frag_threshold, n_capabilities=[], ac_capabilities=[], vht_bandwidth=None) elif profile_name == 'mistral': hidden = _get_or_default(hidden, False) force_wmm = _get_or_default(force_wmm, True) beacon_interval = _get_or_default(beacon_interval, 100) short_preamble = _get_or_default(short_preamble, True) dtim_period = _get_or_default(dtim_period, 2) frag_threshold = None rts_threshold = None # Google IE # Country Code IE ('us' lowercase) vendor_elements = { 'vendor_elements': 'dd0cf4f5e80505ff0000ffffffff' '070a75732024041e95051e00' } default_configs = {'bridge': 'br-lan', 'iapp_interface': 'br-lan'} if frequency < 5000: interface = iface_wlan_2g mode = _get_or_default(mode, hostapd_constants.MODE_11N_MIXED) n_capabilities = _get_or_default(n_capabilities, [ hostapd_constants.N_CAPABILITY_LDPC, 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 ]) additional_params = utils.merge_dicts( vendor_elements, hostapd_constants.ENABLE_RRM_BEACON_REPORT, hostapd_constants.ENABLE_RRM_NEIGHBOR_REPORT, default_configs) config = hostapd_config.HostapdConfig( ssid=ssid, hidden=hidden, security=security, pmf_support=pmf_support, interface=interface, mode=mode, force_wmm=force_wmm, beacon_interval=beacon_interval, dtim_period=dtim_period, short_preamble=short_preamble, frequency=frequency, n_capabilities=n_capabilities, frag_threshold=frag_threshold, rts_threshold=rts_threshold, bss_settings=bss_settings, additional_parameters=additional_params, set_ap_defaults_profile=profile_name) else: interface = iface_wlan_5g vht_bandwidth = _get_or_default(vht_bandwidth, 80) mode = _get_or_default(mode, hostapd_constants.MODE_11AC_MIXED) if hostapd_config.ht40_plus_allowed(channel): extended_channel = hostapd_constants.N_CAPABILITY_HT40_PLUS elif hostapd_config.ht40_minus_allowed(channel): extended_channel = hostapd_constants.N_CAPABILITY_HT40_MINUS # Channel 165 operates in 20MHz with n or ac modes. if channel == 165: mode = hostapd_constants.MODE_11N_MIXED extended_channel = hostapd_constants.N_CAPABILITY_HT20 if vht_bandwidth >= 40: n_capabilities = _get_or_default(n_capabilities, [ hostapd_constants.N_CAPABILITY_LDPC, extended_channel, hostapd_constants.N_CAPABILITY_SGI20, hostapd_constants.N_CAPABILITY_SGI40, hostapd_constants.N_CAPABILITY_TX_STBC, hostapd_constants.N_CAPABILITY_RX_STBC1 ]) else: n_capabilities = _get_or_default(n_capabilities, [ hostapd_constants.N_CAPABILITY_LDPC, 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_HT20 ]) ac_capabilities = _get_or_default(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, hostapd_constants.AC_CAPABILITY_SU_BEAMFORMER, hostapd_constants.AC_CAPABILITY_SU_BEAMFORMEE, hostapd_constants.AC_CAPABILITY_MU_BEAMFORMER, hostapd_constants.AC_CAPABILITY_SOUNDING_DIMENSION_4, hostapd_constants.AC_CAPABILITY_BF_ANTENNA_4 ]) additional_params = utils.merge_dicts( vendor_elements, hostapd_constants.ENABLE_RRM_BEACON_REPORT, hostapd_constants.ENABLE_RRM_NEIGHBOR_REPORT, default_configs) config = hostapd_config.HostapdConfig( ssid=ssid, hidden=hidden, security=security, pmf_support=pmf_support, interface=interface, mode=mode, force_wmm=force_wmm, vht_channel_width=vht_bandwidth, beacon_interval=beacon_interval, dtim_period=dtim_period, short_preamble=short_preamble, frequency=frequency, frag_threshold=frag_threshold, rts_threshold=rts_threshold, n_capabilities=n_capabilities, ac_capabilities=ac_capabilities, bss_settings=bss_settings, additional_parameters=additional_params, set_ap_defaults_profile=profile_name) elif profile_name == 'actiontec_pk5000': config = actiontec.actiontec_pk5000(iface_wlan_2g=iface_wlan_2g, channel=channel, ssid=ssid, security=security) elif profile_name == 'actiontec_mi424wr': config = actiontec.actiontec_mi424wr(iface_wlan_2g=iface_wlan_2g, channel=channel, ssid=ssid, security=security) elif profile_name == 'asus_rtac66u': config = asus.asus_rtac66u(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'asus_rtac86u': config = asus.asus_rtac86u(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'asus_rtac5300': config = asus.asus_rtac5300(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'asus_rtn56u': config = asus.asus_rtn56u(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'asus_rtn66u': config = asus.asus_rtn66u(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'belkin_f9k1001v5': config = belkin.belkin_f9k1001v5(iface_wlan_2g=iface_wlan_2g, channel=channel, ssid=ssid, security=security) elif profile_name == 'linksys_ea4500': config = linksys.linksys_ea4500(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'linksys_ea9500': config = linksys.linksys_ea9500(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'linksys_wrt1900acv2': config = linksys.linksys_wrt1900acv2(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'netgear_r7000': config = netgear.netgear_r7000(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'netgear_wndr3400': config = netgear.netgear_wndr3400(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'securifi_almond': config = securifi.securifi_almond(iface_wlan_2g=iface_wlan_2g, channel=channel, ssid=ssid, security=security) elif profile_name == 'tplink_archerc5': config = tplink.tplink_archerc5(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'tplink_archerc7': config = tplink.tplink_archerc7(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'tplink_c1200': config = tplink.tplink_c1200(iface_wlan_2g=iface_wlan_2g, iface_wlan_5g=iface_wlan_5g, channel=channel, ssid=ssid, security=security) elif profile_name == 'tplink_tlwr940n': config = tplink.tplink_tlwr940n(iface_wlan_2g=iface_wlan_2g, channel=channel, ssid=ssid, security=security) else: raise ValueError('Invalid ap model specified (%s)' % profile_name) return config
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
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