diff mbox series

[v3,4/4] wpa_supplicant: fix frequency config for non p2p vht/he cases

Message ID 20200619123317.92081-5-markus.theil@tu-ilmenau.de
State New
Headers show
Series Fix and unify wpa_supplicant AP/mesh frequency setup | expand

Commit Message

Markus Theil June 19, 2020, 12:33 p.m. UTC
Fix compile without CONFIG_P2P and only set secondary channel seg idx
if we use a mode supporting a sec channel for vht/he.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
 wpa_supplicant/ap.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

--
2.27.0
diff mbox series

Patch

diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index e57b1b5a2..b6b1aaae8 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -52,8 +52,8 @@  static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s,
 #ifdef CONFIG_P2P
 	u8 center_chan = 0;
 	u8 channel = conf->channel;
-	u8 freq_seg_idx;
 #endif /* CONFIG_P2P */
+	u8 freq_seg_idx;

 	if (!conf->secondary_channel)
 		goto no_vht;
@@ -62,9 +62,14 @@  static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s,
 	if (ssid->max_oper_chwidth)
 		hostapd_set_oper_chwidth(conf, ssid->max_oper_chwidth);

-	ieee80211_freq_to_chan(ssid->vht_center_freq2,
-			       &freq_seg_idx);
-	hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx);
+	switch (hostapd_get_oper_chwidth(conf)) {
+	case CHANWIDTH_80P80MHZ:
+	case CHANWIDTH_160MHZ:
+		ieee80211_freq_to_chan(ssid->vht_center_freq2,
+				       &freq_seg_idx);
+		hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx);
+		break;
+	}

 	if (!ssid->p2p_group) {
 		if (!ssid->vht_center_freq1 ||
@@ -79,7 +84,7 @@  static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s,
 	}

 #ifdef CONFIG_P2P
-	switch (conf->vht_oper_chwidth) {
+	switch (hostapd_get_oper_chwidth(conf)) {
 	case CHANWIDTH_80MHZ:
 	case CHANWIDTH_80P80MHZ:
 		center_chan = wpas_p2p_get_vht80_center(wpa_s, mode, channel);