]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Check channel 6 validity before adding it to chirp channel list
authorDisha Das <dishad@codeaurora.org>
Fri, 11 Sep 2020 04:43:52 +0000 (10:13 +0530)
committerJouni Malinen <j@w1.fi>
Tue, 6 Oct 2020 20:44:06 +0000 (23:44 +0300)
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>
wpa_supplicant/dpp_supplicant.c

index 28404b8d769dd4d69c94de2b9d77225d1c073050..023895072cb72f90e14cb0a3138fabe03e8850b0 100644 (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,7 +3467,22 @@ static void wpas_dpp_chirp_scan_res_handler(struct wpa_supplicant *wpa_s,
        }
 
        /* Preferred chirping channels */
-       int_array_add_unique(&wpa_s->dpp_chirp_freqs, 2437);
+       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,
                        HOSTAPD_MODE_IEEE80211A, 0);