diff mbox series

wpa_supplicant: fix frequency config for vht/he cases

Message ID 20201014193115.47785-1-markus.theil@tu-ilmenau.de
State Accepted
Headers show
Series wpa_supplicant: fix frequency config for vht/he cases | expand

Commit Message

Markus Theil Oct. 14, 2020, 7:31 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 | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

Comments

Jouni Malinen Oct. 16, 2020, 8:08 p.m. UTC | #1
On Wed, Oct 14, 2020 at 09:31:15PM +0200, Markus Theil wrote:
> Fix compile without CONFIG_P2P and only set secondary channel seg idx
> if we use a mode supporting a sec channel for vht/he.

Thanks, applied.
diff mbox series

Patch

diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index bac79b2e4..9f4a2af51 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,24 +62,27 @@  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);
+	if (hostapd_get_oper_chwidth(conf) == CHANWIDTH_80P80MHZ) {
+		ieee80211_freq_to_chan(ssid->vht_center_freq2,
+				       &freq_seg_idx);
+		hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx);
+	}
 
 	if (!ssid->p2p_group) {
-		if (!ssid->vht_center_freq1 ||
-		    hostapd_get_oper_chwidth(conf) == CHANWIDTH_USE_HT)
+		if (!ssid->vht_center_freq1)
 			goto no_vht;
 		ieee80211_freq_to_chan(ssid->vht_center_freq1,
 				       &freq_seg_idx);
 		hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx);
-		wpa_printf(MSG_DEBUG, "VHT seg0 index %d for AP",
-			   hostapd_get_oper_centr_freq_seg0_idx(conf));
+
+		wpa_printf(MSG_DEBUG, "VHT seg0 index %d and seg1 index %d for AP",
+			   hostapd_get_oper_centr_freq_seg0_idx(conf),
+			   hostapd_get_oper_centr_freq_seg1_idx(conf));
 		return;
 	}
 
 #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);