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 <nicolas.cavallari@green-communications.fr>
This commit is contained in:
Nicolas Cavallari 2023-02-15 18:02:52 +01:00 committed by Jouni Malinen
parent c623cee421
commit f91f971bde

View file

@ -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;
}