HOSTAPD设置ht_capab为HT40,强制为40MHz

首先看样例hostapd.conf文件中对ht_capab选项的描述

# ht_capab: HT capabilities (list of flags)
# LDPC coding capability: [LDPC] = supported
# Supported channel width set: [HT40-] = both 20 MHz and 40 MHz with secondary
#       channel below the primary channel; [HT40+] = both 20 MHz and 40 MHz
#       with secondary channel below the primary channel
#       (20 MHz only if neither is set)
#       Note: There are limits on which channels can be used with HT40- and
#       HT40+. Following table shows the channels that may be available for
#       HT40- and HT40+ use per IEEE 802.11n Annex J:
#       freq            HT40-           HT40+
#       2.4 GHz         5-13            1-7 (1-9 in Europe/Japan)
#       5 GHz           40,48,56,64     36,44,52,60
#       (depending on the location, not all of these channels may be available
#       for use)
#       Please note that 40 MHz channels may switch their primary and secondary
#       channels if needed or creation of 40 MHz channel maybe rejected based
#       on overlapping BSSes. These changes are done automatically when hostapd
#       is setting up the 40 MHz channel.
# Spatial Multiplexing (SM) Power Save: [SMPS-STATIC] or [SMPS-DYNAMIC]
#       (SMPS disabled if neither is set)
# HT-greenfield: [GF] (disabled if not set)
# Short GI for 20 MHz: [SHORT-GI-20] (disabled if not set)
# Short GI for 40 MHz: [SHORT-GI-40] (disabled if not set)
# Tx STBC: [TX-STBC] (disabled if not set)
# Rx STBC: [RX-STBC1] (one spatial stream), [RX-STBC12] (one or two spatial
#       streams), or [RX-STBC123] (one, two, or three spatial streams); Rx STBC
#       disabled if none of these set
# HT-delayed Block Ack: [DELAYED-BA] (disabled if not set)
# Maximum A-MSDU length: [MAX-AMSDU-7935] for 7935 octets (3839 octets if not
#       set)
# DSSS/CCK Mode in 40 MHz: [DSSS_CCK-40] = allowed (not allowed if not set)
# PSMP support: [PSMP] (disabled if not set)
# L-SIG TXOP protection support: [LSIG-TXOP-PROT] (disabled if not set)
#ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]

在2.4G频段下5-13信道设置40MHz时使用[HT40-],1-7信道使用[HT40+],因为40MHz分为两个通道:主通道和次通道,主通道频段较低即为1-7信道时,此时的次通道的频段则会大于主通道。主通道频段较高即为5-13信道时,此时的次通道的频段则会小于主通道。

如在成功设置上述配置却还未达到40MHz,则可考虑是否是因为主通道附近信道较拥挤,hostapd强制设置为20MHz。hostapd 在启动 HT40 前,有一段判断语句,如果发现频段冲突,会降低连接标准至 HT20。在hostapd的源码 hostapd/src/ap/hw_features.c中有如下代码

        if (!oper40) {
                wpa_printf(MSG_INFO, "20/40 MHz operation not permitted on "
                           "channel pri=%d sec=%d based on overlapping BSSes",
                           iface->conf->channel,
                           iface->conf->channel +
                           iface->conf->secondary_channel * 4);
                iface->conf->secondary_channel = 0;
        }

将此处的判断改成if 0 即可

你可能感兴趣的:(HOSTAPD设置ht_capab为HT40,强制为40MHz)