[PATCH] Breaking out ht_capab config variable
Carl Fürstenberg
azatoth
Mon Feb 22 11:40:50 PST 2010
From: Carl F?rstenberg <carl at excito.com>
Current ht_capab configuration variable has a rather strange layout,
which isn't found elsewhere in whole hostapd. Breaking it out into
separate variables for each field however it fits.
Questions that remains is if SMPS Static/Dynamic is mutually exclusive
or not.
Also there is need for decent documentation for many of the fields
and what they are used for, which isn't included in this patch.
---
hostapd/config_file.c | 175 ++++++++++++++++++++++++++++++++-----------------
hostapd/hostapd.conf | 103 +++++++++++++++++++++++-----
2 files changed, 198 insertions(+), 80 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 10b7a35..02157d2 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -983,64 +983,6 @@ static int add_r1kh(struct hostapd_bss_config *bss, char *value)
#endif /* CONFIG_IEEE80211R */
-#ifdef CONFIG_IEEE80211N
-static int hostapd_config_ht_capab(struct hostapd_config *conf,
- const char *capab)
-{
- if (os_strstr(capab, "[LDPC]"))
- conf->ht_capab |= HT_CAP_INFO_LDPC_CODING_CAP;
- if (os_strstr(capab, "[HT40-]")) {
- conf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
- conf->secondary_channel = -1;
- }
- if (os_strstr(capab, "[HT40+]")) {
- conf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
- conf->secondary_channel = 1;
- }
- if (os_strstr(capab, "[SMPS-STATIC]")) {
- conf->ht_capab &= ~HT_CAP_INFO_SMPS_MASK;
- conf->ht_capab |= HT_CAP_INFO_SMPS_STATIC;
- }
- if (os_strstr(capab, "[SMPS-DYNAMIC]")) {
- conf->ht_capab &= ~HT_CAP_INFO_SMPS_MASK;
- conf->ht_capab |= HT_CAP_INFO_SMPS_DYNAMIC;
- }
- if (os_strstr(capab, "[GF]"))
- conf->ht_capab |= HT_CAP_INFO_GREEN_FIELD;
- if (os_strstr(capab, "[SHORT-GI-20]"))
- conf->ht_capab |= HT_CAP_INFO_SHORT_GI20MHZ;
- if (os_strstr(capab, "[SHORT-GI-40]"))
- conf->ht_capab |= HT_CAP_INFO_SHORT_GI40MHZ;
- if (os_strstr(capab, "[TX-STBC]"))
- conf->ht_capab |= HT_CAP_INFO_TX_STBC;
- if (os_strstr(capab, "[RX-STBC1]")) {
- conf->ht_capab &= ~HT_CAP_INFO_RX_STBC_MASK;
- conf->ht_capab |= HT_CAP_INFO_RX_STBC_1;
- }
- if (os_strstr(capab, "[RX-STBC12]")) {
- conf->ht_capab &= ~HT_CAP_INFO_RX_STBC_MASK;
- conf->ht_capab |= HT_CAP_INFO_RX_STBC_12;
- }
- if (os_strstr(capab, "[RX-STBC123]")) {
- conf->ht_capab &= ~HT_CAP_INFO_RX_STBC_MASK;
- conf->ht_capab |= HT_CAP_INFO_RX_STBC_123;
- }
- if (os_strstr(capab, "[DELAYED-BA]"))
- conf->ht_capab |= HT_CAP_INFO_DELAYED_BA;
- if (os_strstr(capab, "[MAX-AMSDU-7935]"))
- conf->ht_capab |= HT_CAP_INFO_MAX_AMSDU_SIZE;
- if (os_strstr(capab, "[DSSS_CCK-40]"))
- conf->ht_capab |= HT_CAP_INFO_DSSS_CCK40MHZ;
- if (os_strstr(capab, "[PSMP]"))
- conf->ht_capab |= HT_CAP_INFO_PSMP_SUPP;
- if (os_strstr(capab, "[LSIG-TXOP-PROT]"))
- conf->ht_capab |= HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT;
-
- return 0;
-}
-#endif /* CONFIG_IEEE80211N */
-
-
static int hostapd_config_check_bss(struct hostapd_bss_config *bss,
struct hostapd_config *conf)
{
@@ -1857,12 +1799,123 @@ struct hostapd_config * hostapd_config_read(const char *fname)
#ifdef CONFIG_IEEE80211N
} else if (os_strcmp(buf, "ieee80211n") == 0) {
conf->ieee80211n = atoi(pos);
- } else if (os_strcmp(buf, "ht_capab") == 0) {
- if (hostapd_config_ht_capab(conf, pos) < 0) {
+ } else if (os_strcmp(buf, "ht_capab_ldpc") == 0 ) {
+ int val = atoi(pos);
+ if( val ) {
+ conf->ht_capab |= HT_CAP_INFO_LDPC_CODING_CAP;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_LDPC_CODING_CAP;
+ }
+ } else if (os_strcmp(buf, "ht_capab_ht40") == 0) {
+ int val = atoi(pos);
+ if( val == 1 ) {
+ conf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+ conf->secondary_channel = 1;
+ } else if ( val == -1 ) {
+ conf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+ conf->secondary_channel = -1;
+ } else {
wpa_printf(MSG_ERROR, "Line %d: invalid "
- "ht_capab", line);
+ "ht_capab_ht40", line);
errors++;
}
+ } else if (os_strcmp(buf, "ht_capab_smps") == 0) {
+ if(os_strcmp(pos, "dynamic") == 0 ) {
+ conf->ht_capab &= ~HT_CAP_INFO_SMPS_MASK;
+ conf->ht_capab |= HT_CAP_INFO_SMPS_DYNAMIC;
+ } else if (os_strcmp(pos, "static") == 0) {
+ conf->ht_capab &= ~HT_CAP_INFO_SMPS_MASK;
+ conf->ht_capab |= HT_CAP_INFO_SMPS_STATIC;
+ } else {
+ wpa_printf(MSG_ERROR, "Line %d: invalid "
+ "ht_capab_smps", line);
+ errors++;
+ }
+ } else if (os_strcmp(buf, "ht_capab_gf") == 0) {
+ int val = atoi(pos);
+ if( val ) {
+ conf->ht_capab |= HT_CAP_INFO_GREEN_FIELD;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_GREEN_FIELD;
+ }
+ } else if (os_strcmp(buf, "ht_capab_short_gi_20") == 0) {
+ int val = atoi(pos);
+ if( val ) {
+ conf->ht_capab |= HT_CAP_INFO_SHORT_GI20MHZ;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_SHORT_GI20MHZ;
+ }
+ } else if (os_strcmp(buf, "ht_capab_short_gi_40") == 0) {
+ int val = atoi(pos);
+ if( val ) {
+ conf->ht_capab |= HT_CAP_INFO_SHORT_GI40MHZ;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_SHORT_GI40MHZ;
+ }
+ } else if (os_strcmp(buf, "ht_capab_tx_stbc") == 0) {
+ int val = atoi(pos);
+ if( val ) {
+ conf->ht_capab |= HT_CAP_INFO_TX_STBC;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_TX_STBC;
+ }
+ } else if (os_strcmp(buf, "ht_capab_rx_stbc") == 0) {
+ int val = atoi(pos);
+ if( val < 0 || val > 3 ) {
+ wpa_printf(MSG_ERROR, "Line %d: invalid "
+ "ht_capab_rx_stbc", line);
+ errors++;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_RX_STBC_MASK;
+ if( val == 1 ) {
+ conf->ht_capab |= HT_CAP_INFO_RX_STBC_1;
+ } else if( val == 2 ){
+ conf->ht_capab |= HT_CAP_INFO_RX_STBC_12;
+ } else if( val == 3 ) {
+ conf->ht_capab |= HT_CAP_INFO_RX_STBC_123;
+ } else {
+ conf->ht_capab &= ~(
+ HT_CAP_INFO_RX_STBC_1 |
+ HT_CAP_INFO_RX_STBC_12 |
+ HT_CAP_INFO_RX_STBC_123
+ );
+ }
+ }
+ } else if (os_strcmp(buf, "ht_capab_delayed_ba") == 0) {
+ int val = atoi(pos);
+ if( val ) {
+ conf->ht_capab |= HT_CAP_INFO_DELAYED_BA;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_DELAYED_BA;
+ }
+ } else if (os_strcmp(buf, "ht_capab_max_amsdu_size") == 0) {
+ int val = atoi(pos);
+ if( val ) {
+ conf->ht_capab |= HT_CAP_INFO_MAX_AMSDU_SIZE;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_MAX_AMSDU_SIZE;
+ }
+ } else if (os_strcmp(buf, "ht_capab_dsss_cck_40") == 0) {
+ int val = atoi(pos);
+ if( val ) {
+ conf->ht_capab |= HT_CAP_INFO_DSSS_CCK40MHZ;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_DSSS_CCK40MHZ;
+ }
+ } else if (os_strcmp(buf, "ht_capab_psmp") == 0) {
+ int val = atoi(pos);
+ if( val ) {
+ conf->ht_capab |= HT_CAP_INFO_PSMP_SUPP;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_PSMP_SUPP;
+ }
+ } else if (os_strcmp(buf, "ht_capab_lsig_txop_prot") == 0) {
+ int val = atoi(pos);
+ if( val ) {
+ conf->ht_capab |= HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT;
+ } else {
+ conf->ht_capab &= ~HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT;
+ }
#endif /* CONFIG_IEEE80211N */
} else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos);
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index e7b5eab..9853be8 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -368,9 +368,16 @@ wmm_ac_vo_acm=0
# Note: You will also need to enable WMM for full HT functionality.
#ieee80211n=1
-# 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
+### HT capabillities ###
+
+# ht_capab_ldpc: LDPC coding capability
+# 0 = disabled (default)
+# 1 = enabled
+#
+#ht_capab_ldpc=1
+
+# ht_capab_ht40: Enables 40MHz channel width
+# TODO : rewrite below
# 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)
@@ -386,22 +393,80 @@ wmm_ac_vo_acm=0
# 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]
+#
+# 1 = secondary channel above primary channel
+# -1 = secondary channel below primary channel
+# default is 20MHz only channel
+#
+#ht_capab_ldpc=1
+
+# ht_capab_smps: Spatial Multiplexing (SM) Power Save
+# either "static" or "dynamic" (XXX are they mutual exclusive)
+#
+#ht_capab_smps=dynamic
+
+# ht_capab_gf: HT-greenfield
+# 0 = disabled (default)
+# 1 = enabled
+#
+#ht_capab_gf=1
+
+# ht_capab_short_gi_20: Short GI for 20 MHz
+# 0 = disabled (default)
+# 1 = enabled
+#
+#ht_capab_short_gi_20=1
+
+# ht_capab_short_gi_40: Short GI for 40 MHz
+# 0 = disabled (default)
+# 1 = enabled
+#
+#ht_capab_short_gi_40=1
+
+# ht_capab_tx_stbc: Tx STBC
+# 0 = disabled (default)
+# 1 = enabled
+#
+#ht_capab_tx_stbc=1
+
+# ht_capab_rx_stbc: Rx STBC
+# 0 = disabled (default)
+# 1 = one spatial stream
+# 2 = one or two spatial streams
+# 3 = one, two, or three spatial streams
+#
+#ht_capab_rx_stbc=3
+
+# ht_capab_delayed_ba: HT-delayed Block Ack
+# 0 = disabled (default)
+# 1 = enabled
+#
+#ht_capab_delayed_ba=1
+
+# ht_capab_max_amsdu_size: Maximum A-MSDU length.
+# When enabled , it's 7935 octets, when disabled, it's 3839 octets.
+# 0 = disabled (default)
+# 1 = enabled
+#
+#ht_capab_max_amsdu_size=1
+
+# ht_capab_dsss_cck_40: DSSS/CCK Mode in 40 MHz
+# 0 = disabled (default)
+# 1 = enabled
+#
+#ht_capab_dsss_cck_40=1
+
+# ht_capab_psmp: PSMP support
+# 0 = disabled (default)
+# 1 = enabled
+#
+#ht_capab_psmp=1
+
+# ht_capab_lsig_txop_prot: L-SIG TXOP protection support
+# 0 = disabled (default)
+# 1 = enabled
+#
+#ht_capab_lsig_txop_prot=1
##### IEEE 802.1X-2004 related configuration ##################################
--
1.7.0
More information about the Hostap
mailing list