hostapd: add switch to disable neigborhood scan

this may violate regulatory rules because 40Mhz channels should disabled
if there are other networks but nearly every commercial router ignore this.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
Arne Fitzenreiter
2018-10-27 09:55:19 +02:00
parent 4d0b63baf6
commit d823d5f072
5 changed files with 88 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
diff -Naur hostapd-2.6.org/hostapd/config_file.c hostapd-2.6/hostapd/config_file.c
--- hostapd-2.6.org/hostapd/config_file.c 2016-10-02 20:51:11.000000000 +0200
+++ hostapd-2.6/hostapd/config_file.c 2018-10-26 09:16:34.393456086 +0200
@@ -2863,6 +2863,10 @@
}
#endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_IEEE80211N
+ } else if (os_strcmp(buf, "noscan") == 0) {
+ conf->noscan = atoi(pos);
+ } else if (os_strcmp(buf, "ht_coex") == 0) {
+ conf->no_ht_coex = !atoi(pos);
} else if (os_strcmp(buf, "ieee80211n") == 0) {
conf->ieee80211n = atoi(pos);
} else if (os_strcmp(buf, "ht_capab") == 0) {
diff -Naur hostapd-2.6.org/src/ap/ap_config.h hostapd-2.6/src/ap/ap_config.h
--- hostapd-2.6.org/src/ap/ap_config.h 2016-10-02 20:51:11.000000000 +0200
+++ hostapd-2.6/src/ap/ap_config.h 2018-10-26 09:16:34.393456086 +0200
@@ -664,6 +664,8 @@
int ht_op_mode_fixed;
u16 ht_capab;
+ int noscan;
+ int no_ht_coex;
int ieee80211n;
int secondary_channel;
int no_pri_sec_switch;
diff -Naur hostapd-2.6.org/src/ap/hw_features.c hostapd-2.6/src/ap/hw_features.c
--- hostapd-2.6.org/src/ap/hw_features.c 2016-10-02 20:51:11.000000000 +0200
+++ hostapd-2.6/src/ap/hw_features.c 2018-10-26 09:16:34.393456086 +0200
@@ -474,7 +474,8 @@
int ret;
/* Check that HT40 is used and PRI / SEC switch is allowed */
- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
+ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch ||
+ iface->conf->noscan)
return 0;
hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
diff -Naur hostapd-2.6.org/src/ap/ieee802_11_ht.c hostapd-2.6/src/ap/ieee802_11_ht.c
--- hostapd-2.6.org/src/ap/ieee802_11_ht.c 2016-10-02 20:51:11.000000000 +0200
+++ hostapd-2.6/src/ap/ieee802_11_ht.c 2018-10-26 09:17:42.976793198 +0200
@@ -244,6 +244,9 @@
if (!(iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
return;
+ if (iface->conf->noscan || iface->conf->no_ht_coex)
+ return;
+
if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie))
return;
@@ -368,6 +371,9 @@
if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
return;
+ if (iface->conf->noscan || iface->conf->no_ht_coex)
+ return;
+
wpa_printf(MSG_INFO, "HT: Forty MHz Intolerant is set by STA " MACSTR
" in Association Request", MAC2STR(sta->addr));