https://github.com/ivkos/hostap-force-ht40/commit/8526009738bd63af37ec4f7bff7c29755777dec8 --- hostapd-2.9/hostapd/config_file.c +++ hostapd-2.9/hostapd/config_file.c @@ -3419,6 +3419,8 @@ line); return 1; } + } else if (os_strcmp(buf, "force_ht40") == 0) { + conf->force_ht40 = atoi(pos); } else if (os_strcmp(buf, "require_ht") == 0) { conf->require_ht = atoi(pos); } else if (os_strcmp(buf, "obss_interval") == 0) { --- hostapd-2.9/hostapd/hostapd.conf +++ hostapd-2.9/hostapd/hostapd.conf @@ -594,6 +594,12 @@ # L-SIG TXOP protection support: [LSIG-TXOP-PROT] (disabled if not set) #ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40] +# Skip checks for 40 MHz intolerance or overlapping stations and force +# 40 MHz channel width +# 0 = disabled (default) +# 1 = enabled +#force_ht40=0 + # Require stations to support HT PHY (reject association if they do not) #require_ht=1 --- hostapd-2.9/src/ap/ap_config.c +++ hostapd-2.9/src/ap/ap_config.c @@ -225,6 +225,8 @@ conf->ht_capab = HT_CAP_INFO_SMPS_DISABLED; + conf->force_ht40 = 0; + conf->ap_table_max_size = 255; conf->ap_table_expiration_time = 60; conf->track_sta_max_age = 180; --- hostapd-2.9/src/ap/ap_config.h +++ hostapd-2.9/src/ap/ap_config.h @@ -932,6 +932,7 @@ int ht_op_mode_fixed; u16 ht_capab; + int force_ht40; int ieee80211n; int secondary_channel; int no_pri_sec_switch; --- hostapd-2.9/src/ap/hw_features.c +++ hostapd-2.9/src/ap/hw_features.c @@ -310,7 +310,7 @@ wpa_scan_results_free(scan_res); iface->secondary_ch = iface->conf->secondary_channel; - if (!oper40) { + if (!iface->conf->force_ht40 && !oper40) { wpa_printf(MSG_INFO, "20/40 MHz operation not permitted on " "channel pri=%d sec=%d based on overlapping BSSes", iface->conf->channel, --- hostapd-2.9/src/ap/ieee802_11_ht.c +++ hostapd-2.9/src/ap/ieee802_11_ht.c @@ -207,6 +207,9 @@ if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) return 1; + if (iface->conf->force_ht40) + return 1; + pri_freq = hostapd_hw_get_freq(iface->bss[0], iface->conf->channel); if (iface->conf->secondary_channel > 0) @@ -299,7 +302,7 @@ HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_DEBUG, "20 MHz BSS width request bit is set in BSS coexistence information field"); - is_ht40_allowed = 0; + is_ht40_allowed = iface->conf->force_ht40; } if (bc_ie->coex_param & WLAN_20_40_BSS_COEX_40MHZ_INTOL) { @@ -309,7 +312,7 @@ HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_DEBUG, "40 MHz intolerant bit is set in BSS coexistence information field"); - is_ht40_allowed = 0; + is_ht40_allowed = iface->conf->force_ht40; } /* 20/40 BSS Intolerant Channel Report element (zero or more times) */ @@ -341,7 +344,7 @@ HOSTAPD_LEVEL_DEBUG, "20_40_INTOLERANT channel %d reported", chan); - is_ht40_allowed = 0; + is_ht40_allowed = iface->conf->force_ht40; } data += 2 + ielen;