From: Nicolas Cavallari Date: Wed, 15 Feb 2023 17:02:52 +0000 (+0100) Subject: Fix creating 6 GHz IBSS/mesh on 5/6 GHz-capable PHYs X-Git-Tag: hostap_2_11~1292 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f91f971bdeca0680bb2084644f45dfdc8ad79d7b;p=thirdparty%2Fhostap.git Fix creating 6 GHz IBSS/mesh on 5/6 GHz-capable PHYs If the PHY supports both 5 GHz and 6 GHz bands, 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 --- diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 8a4da7115..ca78684d2 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3003,7 +3003,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; }