]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
bgscan_learn: Avoid redundant frequencies
authorEliad Peller <eliad@wizery.com>
Thu, 19 Dec 2013 10:03:24 +0000 (12:03 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 24 Dec 2013 04:49:26 +0000 (06:49 +0200)
Some hw modes (e.g., 11b and 11g) contain the same frequencies,
causing the supp_freqs array to be populated with redundant entries.

Check for the existence of the freq before adding it.

Signed-hostap: Eliad Peller <eliad@wizery.com>

wpa_supplicant/bgscan_learn.c

index 07d31e4cb623c613c931894df10c98c674e86223..92ec55c6d5c2f787a60d443c8ec316106aa64c40 100644 (file)
@@ -363,6 +363,9 @@ static int * bgscan_learn_get_supp_freqs(struct wpa_supplicant *wpa_s)
                for (j = 0; j < modes[i].num_channels; j++) {
                        if (modes[i].channels[j].flag & HOSTAPD_CHAN_DISABLED)
                                continue;
+                       /* some hw modes (e.g. 11b & 11g) contain same freqs */
+                       if (in_array(freqs, modes[i].channels[j].freq))
+                               continue;
                        n = os_realloc_array(freqs, count + 2, sizeof(int));
                        if (n == NULL)
                                continue;