summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlan Peer <ilan.peer@intel.com>2015-09-08 12:46:09 +0300
committerJouni Malinen <j@w1.fi>2015-09-25 21:05:42 +0300
commitc6d7965d2527a48858d41648c8a9b9acee01e41c (patch)
tree7e7211270fb23410733fd6ecf67fba507b1a8da5
parent22264b3c619420276cabd74283d9791c0df880ab (diff)
downloadhostap-c6d7965d2527a48858d41648c8a9b9acee01e41c.tar.gz
P2P: Fix the calculation of group common freqs
Previously, the calculation allowed for the same frequency to appear several times in the result. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
-rw-r--r--src/p2p/p2p_utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/p2p/p2p_utils.c b/src/p2p/p2p_utils.c
index e139d03ea..2e2aa8ad0 100644
--- a/src/p2p/p2p_utils.c
+++ b/src/p2p/p2p_utils.c
@@ -459,12 +459,22 @@ int p2p_channels_to_freqs(const struct p2p_channels *channels, int *freq_list,
break;
for (j = 0; j < c->channels; j++) {
int freq;
+ unsigned int k;
+
if (idx + 1 == max_len)
break;
freq = p2p_channel_to_freq(c->reg_class,
c->channel[j]);
if (freq < 0)
continue;
+
+ for (k = 0; k < idx; k++) {
+ if (freq_list[k] == freq)
+ break;
+ }
+
+ if (k < idx)
+ continue;
freq_list[idx++] = freq;
}
}