diff mbox

[2/8] bgscan_learn: avoid redundant frequencies

Message ID 1387447410-8101-2-git-send-email-arik@wizery.com
State Accepted
Headers show

Commit Message

Arik Nemtsov Dec. 19, 2013, 10:03 a.m. UTC
From: Eliad Peller <eliad@wizery.com>

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 | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jouni Malinen Dec. 24, 2013, 7:48 a.m. UTC | #1
On Thu, Dec 19, 2013 at 12:03:24PM +0200, Arik Nemtsov wrote:
> 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.

Thanks, applied.
diff mbox

Patch

diff --git a/wpa_supplicant/bgscan_learn.c b/wpa_supplicant/bgscan_learn.c
index 07d31e4..92ec55c 100644
--- a/wpa_supplicant/bgscan_learn.c
+++ b/wpa_supplicant/bgscan_learn.c
@@ -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;