]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Android: P2P: Fix restriction of GO channels on A-band aosp-kk
authorDmitry Shmidt <dimitrysh@google.com>
Tue, 8 Oct 2013 20:56:42 +0000 (13:56 -0700)
committerJouni Malinen <j@w1.fi>
Fri, 1 Nov 2013 14:36:34 +0000 (16:36 +0200)
Bug: 11105901

Change-Id: Ibe8e85f47e95177700deedccb408f1eec85b8f3d
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
src/p2p/p2p_go_neg.c
src/p2p/p2p_i.h
src/p2p/p2p_utils.c

index 17fb329382bf6ca7e3e28db6709e11918302995b..bd583be8346d0a71a328d3c4dffb2f7aed571109 100644 (file)
@@ -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;
index d28aae934e1c54546dbde7ff34a05a02155cc610..81e521ec1fbd0bac9c5cfa69f9b3cdc5f8fd843a 100644 (file)
@@ -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);
index 0769edebf1898cf0501e6a2cb8824e3ff9861ed4..a4c48f678e8b5030e30effe77f8b66eeb8420d37 100644 (file)
@@ -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)