e8682af6443c19cdd78253bbbe40ee1d93f62851
[openwrt/staging/ynezz.git] / package / network / services / hostapd / patches / 004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch
1 From 7f7325dae1d03a3964d4e91940d8369f3fed7b43 Mon Sep 17 00:00:00 2001
2 From: Markus Theil <markus.theil@tu-ilmenau.de>
3 Date: Tue, 30 Jun 2020 13:53:20 +0200
4 Subject: [PATCH 04/19] wpa_supplicant: fix frequency config for non p2p vht/he
5 cases
6
7 Fix compile without CONFIG_P2P and only set secondary channel seg idx
8 if we use a mode supporting a sec channel for vht/he.
9
10 Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
11 ---
12 wpa_supplicant/ap.c | 23 +++++++++++++----------
13 1 file changed, 13 insertions(+), 10 deletions(-)
14
15 --- a/wpa_supplicant/ap.c
16 +++ b/wpa_supplicant/ap.c
17 @@ -52,8 +52,8 @@ static void wpas_conf_ap_vht(struct wpa_
18 #ifdef CONFIG_P2P
19 u8 center_chan = 0;
20 u8 channel = conf->channel;
21 - u8 freq_seg_idx;
22 #endif /* CONFIG_P2P */
23 + u8 freq_seg_idx;
24
25 if (!conf->secondary_channel)
26 goto no_vht;
27 @@ -62,24 +62,27 @@ static void wpas_conf_ap_vht(struct wpa_
28 if (ssid->max_oper_chwidth)
29 hostapd_set_oper_chwidth(conf, ssid->max_oper_chwidth);
30
31 - ieee80211_freq_to_chan(ssid->vht_center_freq2,
32 - &freq_seg_idx);
33 - hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx);
34 -
35 if (!ssid->p2p_group) {
36 - if (!ssid->vht_center_freq1 ||
37 - hostapd_get_oper_chwidth(conf) == CHANWIDTH_USE_HT)
38 + if (!ssid->vht_center_freq1)
39 goto no_vht;
40 ieee80211_freq_to_chan(ssid->vht_center_freq1,
41 &freq_seg_idx);
42 hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx);
43 - wpa_printf(MSG_DEBUG, "VHT seg0 index %d for AP",
44 - hostapd_get_oper_centr_freq_seg0_idx(conf));
45 +
46 + if (hostapd_get_oper_chwidth(conf) == CHANWIDTH_80P80MHZ) {
47 + ieee80211_freq_to_chan(ssid->vht_center_freq2,
48 + &freq_seg_idx);
49 + hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx);
50 + }
51 +
52 + wpa_printf(MSG_DEBUG, "VHT seg0 index %d and seg1 index %d for AP",
53 + hostapd_get_oper_centr_freq_seg0_idx(conf),
54 + hostapd_get_oper_centr_freq_seg1_idx(conf));
55 return;
56 }
57
58 #ifdef CONFIG_P2P
59 - switch (conf->vht_oper_chwidth) {
60 + switch (hostapd_get_oper_chwidth(conf)) {
61 case CHANWIDTH_80MHZ:
62 case CHANWIDTH_80P80MHZ:
63 center_chan = wpas_p2p_get_vht80_center(wpa_s, mode, channel);