aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2011-09-27 19:29:26 (GMT)
committerJouni Malinen <j@w1.fi>2013-11-24 20:46:38 (GMT)
commit85368139dfd5b53793f618d957559905a16cd088 (patch)
tree6ba431cb7c060aa4fb754992442d9430feb5368c
parent6d674628d459a73b82ca34e9cbd30564d5acf426 (diff)
downloadhostap-85368139dfd5b53793f618d957559905a16cd088.zip
hostap-85368139dfd5b53793f618d957559905a16cd088.tar.gz
hostap-85368139dfd5b53793f618d957559905a16cd088.tar.bz2
nl80211: Add set_noa, set_p2p_powersave, set_ap_wps_ie
Fix WFD and WPS certification problem for GO (BRCM) Change-Id: I5bbac818aad7c0a14fddb3beb88a6a2d87c07ea0 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--src/drivers/android_drv.h2
-rw-r--r--src/drivers/driver_nl80211.c78
2 files changed, 76 insertions, 4 deletions
diff --git a/src/drivers/android_drv.h b/src/drivers/android_drv.h
index 5906527..2a3daec 100644
--- a/src/drivers/android_drv.h
+++ b/src/drivers/android_drv.h
@@ -19,6 +19,8 @@
#define MAX_DRV_CMD_SIZE 248
#define DRV_NUMBER_SEQUENTIAL_ERRORS 4
+#define MAX_WPSP2PIE_CMD_SIZE 384
+
#define WEXT_PNOSETUP_HEADER "PNOSETUP "
#define WEXT_PNOSETUP_HEADER_SIZE 9
#define WEXT_PNO_TLV_PREFIX 'S'
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index f8a661f..c214440 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -60,6 +60,8 @@
#ifdef ANDROID
#include "android_drv.h"
+static int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
+ size_t buf_len);
#endif /* ANDROID */
#ifdef CONFIG_LIBNL20
/* libnl 2.0 compatibility code */
@@ -364,12 +366,8 @@ static int android_pno_start(struct i802_bss *bss,
static int android_pno_stop(struct i802_bss *bss);
#endif /* ANDROID */
#ifdef ANDROID_P2P
-int wpa_driver_set_p2p_noa(void *priv, u8 count, int start, int duration);
int wpa_driver_get_p2p_noa(void *priv, u8 *buf, size_t len);
int wpa_driver_set_p2p_ps(void *priv, int legacy_ps, int opp_ps, int ctwindow);
-int wpa_driver_set_ap_wps_p2p_ie(void *priv, const struct wpabuf *beacon,
- const struct wpabuf *proberesp,
- const struct wpabuf *assocresp);
#endif /* ANDROID_P2P */
static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx);
@@ -10637,6 +10635,15 @@ nla_put_failure:
static int nl80211_set_p2p_powersave(void *priv, int legacy_ps, int opp_ps,
int ctwindow)
{
+#ifdef ANDROID_P2P
+ char buf[MAX_DRV_CMD_SIZE];
+
+ memset(buf, 0, sizeof(buf));
+ wpa_printf(MSG_DEBUG, "%s: Entry", __func__);
+ os_snprintf(buf, sizeof(buf), "P2P_SET_PS %d %d %d", legacy_ps, opp_ps,
+ ctwindow);
+ return wpa_driver_nl80211_driver_cmd(priv, buf, buf, strlen(buf) + 1);
+#else /* ANDROID_P2P */
struct i802_bss *bss = priv;
wpa_printf(MSG_DEBUG, "nl80211: set_p2p_powersave (legacy_ps=%d "
@@ -10656,6 +10663,7 @@ static int nl80211_set_p2p_powersave(void *priv, int legacy_ps, int opp_ps,
return -1; /* Not yet supported */
return nl80211_set_power_save(bss, legacy_ps);
+#endif /* ANDROID_P2P */
}
@@ -11089,6 +11097,68 @@ static int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
return ret;
}
+#ifdef ANDROID_P2P
+
+static int wpa_driver_set_p2p_noa(void *priv, u8 count, int start,
+ int duration)
+{
+ char buf[MAX_DRV_CMD_SIZE];
+
+ memset(buf, 0, sizeof(buf));
+ wpa_printf(MSG_DEBUG, "%s: Entry", __func__);
+ os_snprintf(buf, sizeof(buf), "P2P_SET_NOA %d %d %d", count, start,
+ duration);
+ return wpa_driver_nl80211_driver_cmd(priv, buf, buf, strlen(buf) + 1);
+}
+
+
+static int wpa_driver_set_ap_wps_p2p_ie(void *priv,
+ const struct wpabuf *beacon,
+ const struct wpabuf *proberesp,
+ const struct wpabuf *assocresp)
+{
+ char buf[MAX_WPSP2PIE_CMD_SIZE];
+ struct wpabuf *ap_wps_p2p_ie = NULL;
+ char *_cmd = "SET_AP_WPS_P2P_IE";
+ char *pbuf;
+ int ret = 0;
+ int i;
+ struct cmd_desc {
+ int cmd;
+ const struct wpabuf *src;
+ } cmd_arr[] = {
+ {0x1, beacon},
+ {0x2, proberesp},
+ {0x4, assocresp},
+ {-1, NULL}
+ };
+
+ wpa_printf(MSG_DEBUG, "%s: Entry", __func__);
+ for (i = 0; cmd_arr[i].cmd != -1; i++) {
+ os_memset(buf, 0, sizeof(buf));
+ pbuf = buf;
+ pbuf += sprintf(pbuf, "%s %d", _cmd, cmd_arr[i].cmd);
+ *pbuf++ = '\0';
+ ap_wps_p2p_ie = cmd_arr[i].src ?
+ wpabuf_dup(cmd_arr[i].src) : NULL;
+ if (ap_wps_p2p_ie) {
+ os_memcpy(pbuf, wpabuf_head(ap_wps_p2p_ie),
+ wpabuf_len(ap_wps_p2p_ie));
+ ret = wpa_driver_nl80211_driver_cmd(
+ priv, buf, buf,
+ os_strlen(_cmd) + 3 +
+ wpabuf_len(ap_wps_p2p_ie));
+ wpabuf_free(ap_wps_p2p_ie);
+ if (ret < 0)
+ break;
+ }
+ }
+
+ return ret;
+}
+
+#endif /* ANDROID_P2P */
+
#endif /* ANDROID */