DPP2: Check channel 6 validity before adding it to chirp channel list

Check if the 2.4 GHz channel 6 is in the list of available channels
advertised by the driver before adding in to the chirping frequency
list. This fixes issues, e.g., with a 5 GHz only interface.

Signed-off-by: Disha Das <dishad@codeaurora.org>
This commit is contained in:
Disha Das 2020-09-11 10:13:52 +05:30 committed by Jouni Malinen
parent d049aeb0c6
commit 8e5739c3ac

View file

@ -3449,6 +3449,7 @@ static void wpas_dpp_chirp_scan_res_handler(struct wpa_supplicant *wpa_s,
struct hostapd_hw_modes *mode;
int c;
struct wpa_bss *bss;
bool chan6;
if (!bi && !wpa_s->dpp_reconfig_ssid)
return;
@ -3466,6 +3467,21 @@ static void wpas_dpp_chirp_scan_res_handler(struct wpa_supplicant *wpa_s,
}
/* Preferred chirping channels */
mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes,
HOSTAPD_MODE_IEEE80211G, 0);
chan6 = mode == NULL;
if (mode) {
for (c = 0; c < mode->num_channels; c++) {
struct hostapd_channel_data *chan = &mode->channels[c];
if ((chan->flag & HOSTAPD_CHAN_DISABLED) ||
chan->freq != 2437)
continue;
chan6 = true;
break;
}
}
if (chan6)
int_array_add_unique(&wpa_s->dpp_chirp_freqs, 2437);
mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes,