[PATCH] hostapd: Disable HT MCS and set basic MCS per BSS

Shay Bar shay.bar at celeno.com
Tue Jun 30 05:03:56 EDT 2020


Add the ability to disable specific supported HT MCS's per BSS via the new
(can be per bss) disabled_ht_mcs config.
This will overwrite the configured HT capab supported_mcs_set.

Add the ability to set specific basic MCS's (can be per BSS)
If absent (default) - no basic MCS's are set.

Signed-off-by: Shay Bar <shay.bar at celeno.com>
---
 hostapd/config_file.c  | 12 ++++++++++++
 hostapd/hostapd.conf   | 10 ++++++++++
 src/ap/ap_config.h     |  3 +++
 src/ap/ieee802_11_ht.c | 21 +++++++++++++++++++++
 4 files changed, 46 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index e7a47d71d..9b78594ac 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3234,6 +3234,18 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                   line);
                        return 1;
                }
+       } else if (os_strcmp(buf, "disabled_ht_mcs") == 0) {
+               if (hostapd_parse_intlist(&bss->disabled_ht_mcs, pos)) {
+                       wpa_printf(MSG_ERROR, "Line %d: invalid disabled mcs",
+                                  line);
+                       return 1;
+               }
+       } else if (os_strcmp(buf, "basic_ht_mcs") == 0) {
+               if (hostapd_parse_intlist(&bss->basic_ht_mcs, pos)) {
+                       wpa_printf(MSG_ERROR, "Line %d: invalid basic ht mcs",
+                                  line);
+                       return 1;
+               }
        } else if (os_strcmp(buf, "beacon_rate") == 0) {
                int val;

diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 91ac96785..367077370 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -270,6 +270,16 @@ fragm_threshold=-1
 #basic_rates=10 20 55 110
 #basic_rates=60 120 240

+# Disable supported HT MCS's per BSS
+# List of MCS's to disable
+# If absent (default) MCS's are as configured in the HT capab supported_mcs_set
+#disabled_ht_mcs=0 1
+
+# Set basic HT MCS's per BSS
+# List of MCS's
+# If absent (default) - no basic MCS's set
+#basic_ht_mcs=7
+
 # Beacon frame TX rate configuration
 # This sets the TX rate that is used to transmit Beacon frames. If this item is
 # not included, the driver default rate (likely lowest rate) is used.
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index b705c378f..3859ccbe0 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -314,6 +314,9 @@ struct hostapd_bss_config {

        struct hostapd_ssid ssid;

+       int *disabled_ht_mcs;
+       int *basic_ht_mcs;
+
        char *eap_req_id_text; /* optional displayable message sent with
                                * EAP Request-Identity */
        size_t eap_req_id_text_len;
diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c
index 59ecbdce7..d0e87aa31 100644
--- a/src/ap/ieee802_11_ht.c
+++ b/src/ap/ieee802_11_ht.c
@@ -25,6 +25,7 @@ u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid)
 {
        struct ieee80211_ht_capabilities *cap;
        u8 *pos = eid;
+       int *disabled_ht_mcs = hapd->conf->disabled_ht_mcs;

        if (!hapd->iconf->ieee80211n || !hapd->iface->current_mode ||
            hapd->conf->disable_11n || is_6ghz_op_class(hapd->iconf->op_class))
@@ -40,6 +41,18 @@ u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid)
        os_memcpy(cap->supported_mcs_set, hapd->iface->current_mode->mcs_set,
                  16);

+       if (disabled_ht_mcs) {
+               int i = 0;
+
+               while (disabled_ht_mcs[i] != -1) {
+                       u8 *supp_mcs_set = cap->supported_mcs_set;
+
+                       while (*supp_mcs_set)
+                               *supp_mcs_set++ &= ~(1 << disabled_ht_mcs[i]);
+                       i++;
+               }
+       }
+
        /* TODO: ht_extended_capabilities (now fully disabled) */
        /* TODO: tx_bf_capability_info (now fully disabled) */
        /* TODO: asel_capabilities (now fully disabled) */
@@ -83,6 +96,7 @@ u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid)
 {
        struct ieee80211_ht_operation *oper;
        u8 *pos = eid;
+       int *basic = hapd->conf->basic_ht_mcs;

        if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n ||
            is_6ghz_op_class(hapd->iconf->op_class))
@@ -103,6 +117,13 @@ u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid)
                oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW |
                        HT_INFO_HT_PARAM_STA_CHNL_WIDTH;

+       if (basic) {
+               while (*basic != -1) {
+                       oper->basic_mcs_set[*basic / 8] |= (1 << (*basic % 8));
+                       basic++;
+               }
+       }
+
        pos += sizeof(*oper);

        return pos;
--
2.17.1

________________________________
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non-infringement, merchantability and fitness for a particular purpose.
________________________________




More information about the Hostap mailing list