From 234aa775f8046dc823a0ce72267f62045d81ee08 Mon Sep 17 00:00:00 2001 From: Harshitha Prem Date: Wed, 6 Jul 2022 17:03:52 +0530 Subject: [PATCH] hostapd: Add config to truncate ext capabilities Certain legacy clients are not able to scan 11ax vaps due to extended capabilities which are more than 8bytes in length. Hence added a work around to trucate the ext caps to 8bytes based on the hostapd config ext_cap_len. Legacy clients are able to scan and connect if hostapd config as ext_cap_len=8, ieee80211ac=1, ieee80211ax=0 Signed-off-by: Harshitha Prem --- hostapd/config_file.c | 2 ++ src/ap/ap_config.h | 1 + src/ap/ieee802_11_shared.c | 3 +++ 3 files changed, 6 insertions(+) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index ede28a7..d91f3fc 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -2358,6 +2358,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, conf->country[2] = strtol(pos, NULL, 16); } else if (os_strcmp(buf, "ieee80211d") == 0) { conf->ieee80211d = atoi(pos); + } else if (os_strcmp(buf, "ext_cap_len") == 0) { + conf->ext_cap_len = atoi(pos); } else if (os_strcmp(buf, "ieee80211h") == 0) { conf->ieee80211h = atoi(pos); } else if (os_strcmp(buf, "dfs_test_mode") == 0) { diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 5d12cf5..5b14a7f 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -1059,6 +1059,7 @@ struct hostapd_config { /* Use driver-generated interface addresses when adding multiple BSSs */ u8 use_driver_iface_addr; u8 skip_unii1_dfs_switch; + u8 ext_cap_len; #ifdef CONFIG_FST struct fst_iface_cfg fst_cfg; diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c index 9536747..98be1ec 100644 --- a/src/ap/ieee802_11_shared.c +++ b/src/ap/ieee802_11_shared.c @@ -456,6 +456,9 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid) if (len < hapd->iface->extended_capa_len) len = hapd->iface->extended_capa_len; + if (hapd->iconf->ext_cap_len > 0 && hapd->iconf->ext_cap_len < len) + len = hapd->iconf->ext_cap_len; + *pos++ = WLAN_EID_EXT_CAPAB; *pos++ = len; for (i = 0; i < len; i++, pos++) { -- 2.17.1