aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2013-10-08 20:56:42 (GMT)
committerJouni Malinen <j@w1.fi>2013-11-01 14:36:34 (GMT)
commit6b8b8632d0aef270743a31804fc2ea1ae9149de0 (patch)
tree2f3039d8ffe3c743f2b3ae13469feafa5dc9b7cd
parent33cdef741472bca83aa5c8582dd1187788e3e3b9 (diff)
downloadhostap-aosp-kk.zip
hostap-aosp-kk.tar.gz
hostap-aosp-kk.tar.bz2
Android: P2P: Fix restriction of GO channels on A-bandaosp-kk
Bug: 11105901 Change-Id: Ibe8e85f47e95177700deedccb408f1eec85b8f3d Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--src/p2p/p2p_go_neg.c6
-rw-r--r--src/p2p/p2p_i.h3
-rw-r--r--src/p2p/p2p_utils.c27
3 files changed, 35 insertions, 1 deletions
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index 17fb329..bd583be 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -418,7 +418,13 @@ void p2p_reselect_channel(struct p2p_data *p2p,
/* Prefer a 5 GHz channel */
for (i = 0; i < intersection->reg_classes; i++) {
+#ifdef ANDROID_P2P
+ struct p2p_reg_class prc;
+ struct p2p_reg_class *c = &prc;
+ p2p_copy_reg_class(c, &intersection->reg_class[i]);
+#else
struct p2p_reg_class *c = &intersection->reg_class[i];
+#endif
if ((c->reg_class == 115 || c->reg_class == 124) &&
c->channels) {
unsigned int r;
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index d28aae9..81e521e 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -572,6 +572,9 @@ void p2p_channels_intersect(const struct p2p_channels *a,
struct p2p_channels *res);
int p2p_channels_includes(const struct p2p_channels *channels, u8 reg_class,
u8 channel);
+#ifdef ANDROID_P2P
+size_t p2p_copy_reg_class(struct p2p_reg_class *dc, struct p2p_reg_class *sc);
+#endif
/* p2p_parse.c */
int p2p_parse_p2p_ie(const struct wpabuf *buf, struct p2p_message *msg);
diff --git a/src/p2p/p2p_utils.c b/src/p2p/p2p_utils.c
index 0769ede..a4c48f6 100644
--- a/src/p2p/p2p_utils.c
+++ b/src/p2p/p2p_utils.c
@@ -244,12 +244,37 @@ int p2p_channels_includes_freq(const struct p2p_channels *channels,
}
+#ifdef ANDROID_P2P
+static int p2p_block_op_freq(unsigned int freq)
+{
+ return (freq >= 5170 && freq < 5745);
+}
+
+
+size_t p2p_copy_reg_class(struct p2p_reg_class *dc, struct p2p_reg_class *sc)
+{
+ unsigned int i;
+
+ dc->reg_class = sc->reg_class;
+ dc->channels = 0;
+ for (i=0; i < sc->channels; i++) {
+ if (!p2p_block_op_freq(p2p_channel_to_freq(sc->reg_class,
+ sc->channel[i]))) {
+ dc->channel[dc->channels] = sc->channel[i];
+ dc->channels++;
+ }
+ }
+ return dc->channels;
+}
+#endif
+
+
int p2p_supported_freq(struct p2p_data *p2p, unsigned int freq)
{
u8 op_reg_class, op_channel;
#ifdef ANDROID_P2P
- if (freq >= 5170 && freq < 5745)
+ if (p2p_block_op_freq(freq))
return 0;
#endif
if (p2p_freq_to_channel(freq, &op_reg_class, &op_channel) < 0)