aboutsummaryrefslogtreecommitdiffstats
path: root/src/p2p
diff options
context:
space:
mode:
authorAhmad Kholaif <akholaif@qca.qualcomm.com>2015-07-24 00:39:45 +0000
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-04-01 16:45:45 +0530
commitbd6c7c78509c81e76873bf6bdbd38944fb2540b9 (patch)
treec56be966d5246c82390e404d5bf127fd11bdd325 /src/p2p
parent9fe2590f82a6e74d8f4502ba562e339caebdd288 (diff)
downloadandroid_external_wpa_supplicant_8-bd6c7c78509c81e76873bf6bdbd38944fb2540b9.tar.gz
android_external_wpa_supplicant_8-bd6c7c78509c81e76873bf6bdbd38944fb2540b9.tar.bz2
android_external_wpa_supplicant_8-bd6c7c78509c81e76873bf6bdbd38944fb2540b9.zip
P2P: Add preferred frequency list extension to GO Neg Req
When sending a GO Negotiation Request, advertise the preferred frequency list in a new vendor specific IE. This can be used to extend the standard P2P behavior where a single preferred channel can be advertised by allowing a priority list of channels to be indicated. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Git-commit: b841cf2fa6886de7749477ad71e3f8b6dc3f8bb9 Git-repo : git://w1.fi/srv/git/hostap.git Change-Id: I0657fe4e8ebf7cf51a2127450130ae6718a12d98 CRs-fixed: 842468
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/p2p_build.c39
-rw-r--r--src/p2p/p2p_go_neg.c3
-rw-r--r--src/p2p/p2p_i.h2
3 files changed, 44 insertions, 0 deletions
diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c
index c733543c..793d28ba 100644
--- a/src/p2p/p2p_build.c
+++ b/src/p2p/p2p_build.c
@@ -10,6 +10,7 @@
#include "common.h"
#include "common/ieee802_11_defs.h"
+#include "common/qca-vendor.h"
#include "wps/wps_i.h"
#include "p2p_i.h"
@@ -109,6 +110,44 @@ void p2p_buf_add_operating_channel(struct wpabuf *buf, const char *country,
}
+void p2p_buf_add_pref_channel_list(struct wpabuf *buf,
+ const u32 *preferred_freq_list,
+ unsigned int size)
+{
+ unsigned int i, count = 0;
+ u8 op_class, op_channel;
+
+ if (!size)
+ return;
+
+ /*
+ * First, determine the number of P2P supported channels in the
+ * pref_freq_list returned from driver. This is needed for calculations
+ * of the vendor IE size.
+ */
+ for (i = 0; i < size; i++) {
+ if (p2p_freq_to_channel(preferred_freq_list[i], &op_class,
+ &op_channel) == 0)
+ count++;
+ }
+
+ wpabuf_put_u8(buf, WLAN_EID_VENDOR_SPECIFIC);
+ wpabuf_put_u8(buf, 4 + count * sizeof(u16));
+ wpabuf_put_be24(buf, OUI_QCA);
+ wpabuf_put_u8(buf, QCA_VENDOR_ELEM_P2P_PREF_CHAN_LIST);
+ for (i = 0; i < size; i++) {
+ if (p2p_freq_to_channel(preferred_freq_list[i], &op_class,
+ &op_channel) < 0) {
+ wpa_printf(MSG_DEBUG, "Unsupported frequency %u MHz",
+ preferred_freq_list[i]);
+ continue;
+ }
+ wpabuf_put_u8(buf, op_class);
+ wpabuf_put_u8(buf, op_channel);
+ }
+}
+
+
void p2p_buf_add_channel_list(struct wpabuf *buf, const char *country,
struct p2p_channels *chan)
{
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index 19f1daaf..d47763ac 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -185,6 +185,9 @@ static struct wpabuf * p2p_build_go_neg_req(struct p2p_data *p2p,
p2p->op_reg_class, p2p->op_channel);
p2p_buf_update_ie_hdr(buf, len);
+ p2p_buf_add_pref_channel_list(buf, p2p->pref_freq_list,
+ p2p->num_pref_freq);
+
/* WPS IE with Device Password ID attribute */
pw_id = p2p_wps_method_pw_id(peer->wps_method);
if (peer->oob_pw_id)
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index 407316fc..216f3989 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -768,6 +768,8 @@ void p2p_buf_add_persistent_group_info(struct wpabuf *buf, const u8 *dev_addr,
const u8 *ssid, size_t ssid_len);
int p2p_build_wps_ie(struct p2p_data *p2p, struct wpabuf *buf, int pw_id,
int all_attr);
+void p2p_buf_add_pref_channel_list(struct wpabuf *buf,
+ const u32 *preferred_freq_list, u32 size);
/* p2p_sd.c */
struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,