diff mbox series

[3/4] wpa_supplicant: Fix creating 6GHz ibss/mesh on 5/6 GHz-capable phys

Message ID 20230215170253.13949-3-nicolas.cavallari@green-communications.fr
State Accepted
Headers show
Series [1/4] wpasupplicant: Split ibss_mesh_setup_freq() into multiple functions | expand

Commit Message

Nicolas Cavallari Feb. 15, 2023, 5:02 p.m. UTC
If the phy supports both 5 GHz and 6 GHz bands, then there will be two
different struct hostapd_hw_modes with mode HOSTAPD_MODE_IEEE80211A,
one for each band, with potentially different capabilities.

Check that the struct hostapd_hw_modes actually contains the frequency
before selecting it.

Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
---
 wpa_supplicant/wpa_supplicant.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 6dc581ad8..9ed79abab 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2996,7 +2996,9 @@  void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
 
 	hw_mode = ieee80211_freq_to_chan(freq->freq, &channel);
 	for (i = 0; wpa_s->hw.modes && i < wpa_s->hw.num_modes; i++) {
-		if (wpa_s->hw.modes[i].mode == hw_mode) {
+		if (wpa_s->hw.modes[i].mode == hw_mode &&
+		    hw_mode_get_channel(&wpa_s->hw.modes[i], freq->freq,
+					NULL) != NULL) {
 			mode = &wpa_s->hw.modes[i];
 			break;
 		}