hostapd: fix typo and indentation in ap_sta_support.patch
[librecmc/librecmc.git] / package / network / services / hostapd / patches / 002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch
1 From: Masashi Honma <masashi.honma@gmail.com>
2 Date: Tue, 26 Jul 2016 11:45:40 +0900
3 Subject: [PATCH] mesh: Set correct secondary channel offset if HT40 is
4  disabled
5
6 Previously, secondary channel offset could be non zero even though
7 disable_ht40=1. This patch fixes it.
8
9 Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
10 ---
11
12 --- a/wpa_supplicant/wpa_supplicant.c
13 +++ b/wpa_supplicant/wpa_supplicant.c
14 @@ -1901,20 +1901,27 @@ void ibss_mesh_setup_freq(struct wpa_sup
15                         break;
16                 }
17         }
18 +#ifdef CONFIG_HT_OVERRIDES
19 +       if (ssid->disable_ht40)
20 +               ht40 = 0;
21 +#endif /* CONFIG_HT_OVERRIDES */
22  
23 -       /* Find secondary channel */
24 -       for (i = 0; i < mode->num_channels; i++) {
25 -               sec_chan = &mode->channels[i];
26 -               if (sec_chan->chan == channel + ht40 * 4)
27 -                       break;
28 -               sec_chan = NULL;
29 -       }
30 -       if (!sec_chan)
31 -               return;
32 +       if (ht40) {
33 +               /* Find secondary channel */
34 +               for (i = 0; i < mode->num_channels; i++) {
35 +                       sec_chan = &mode->channels[i];
36 +                       if (sec_chan->chan == channel + ht40 * 4)
37 +                               break;
38 +                       sec_chan = NULL;
39 +               }
40 +               if (!sec_chan)
41 +                       return;
42  
43 -       /* Check secondary channel flags */
44 -       if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
45 -               return;
46 +               /* Check secondary channel flags */
47 +               if (sec_chan->flag &
48 +                   (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
49 +                       return;
50 +       }
51  
52         freq->channel = pri_chan->chan;
53  
54 @@ -1930,6 +1937,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
55                 freq->sec_channel_offset = 1;
56                 break;
57         default:
58 +               freq->sec_channel_offset = 0;
59                 break;
60         }
61