hostapd: prevent spurious 20/40 mhz channel bandwidth switches if noscan is enabled
[openwrt.git] / package / network / services / hostapd / patches / 300-noscan.patch
1 --- a/hostapd/config_file.c
2 +++ b/hostapd/config_file.c
3 @@ -2639,6 +2639,8 @@ static int hostapd_config_fill(struct ho
4                 }
5  #endif /* CONFIG_IEEE80211W */
6  #ifdef CONFIG_IEEE80211N
7 +       } else if (os_strcmp(buf, "noscan") == 0) {
8 +               conf->noscan = atoi(pos);
9         } else if (os_strcmp(buf, "ieee80211n") == 0) {
10                 conf->ieee80211n = atoi(pos);
11         } else if (os_strcmp(buf, "ht_capab") == 0) {
12 --- a/src/ap/ap_config.h
13 +++ b/src/ap/ap_config.h
14 @@ -576,6 +576,7 @@ struct hostapd_config {
15  
16         int ht_op_mode_fixed;
17         u16 ht_capab;
18 +       int noscan;
19         int ieee80211n;
20         int secondary_channel;
21         int require_ht;
22 --- a/src/ap/hw_features.c
23 +++ b/src/ap/hw_features.c
24 @@ -690,7 +690,7 @@ static int ieee80211n_check_40mhz(struct
25         struct wpa_driver_scan_params params;
26         int ret;
27  
28 -       if (!iface->conf->secondary_channel)
29 +       if (!iface->conf->secondary_channel || iface->conf->noscan)
30                 return 0; /* HT40 not used */
31  
32         hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
33 --- a/src/ap/ieee802_11_ht.c
34 +++ b/src/ap/ieee802_11_ht.c
35 @@ -221,6 +221,9 @@ void hostapd_2040_coex_action(struct hos
36         if (!(iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
37                 return;
38  
39 +       if (iface->conf->noscan)
40 +               return;
41 +
42         hdr_len = data - (u8 *) mgmt;
43         if (hdr_len > len)
44                 return;
45 @@ -319,6 +322,9 @@ void ht40_intolerant_add(struct hostapd_
46         if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
47                 return;
48  
49 +       if (iface->conf->noscan)
50 +               return;
51 +
52         wpa_printf(MSG_INFO, "HT: Forty MHz Intolerant is set by STA " MACSTR
53                    " in Association Request", MAC2STR(sta->addr));
54