aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2011-09-06 11:17:33 -0700
committerDmitry Shmidt <dimitrysh@google.com>2011-09-06 12:29:59 -0700
commitdca3979ccdf869f140f096b83df322a0efc84f22 (patch)
tree91db6dbbc2439954f0aecddd6ec2d18388dc2257
parentc97d8bf1d6959387a528c901eaf9c0bff47da853 (diff)
downloadandroid_external_wpa_supplicant_8-dca3979ccdf869f140f096b83df322a0efc84f22.tar.gz
android_external_wpa_supplicant_8-dca3979ccdf869f140f096b83df322a0efc84f22.tar.bz2
android_external_wpa_supplicant_8-dca3979ccdf869f140f096b83df322a0efc84f22.zip
P2P fixes for BRCM
1. Fix for stopping any on-going P2P-FIND, while doing a P2P-GROUP-ADD. 2. Fix for Supplicant crash. The crash was due to socket being closed during P2P-GROUP-REMOVE. 3. Append P2P DEV ADDR during AP-STA-CONNECTED Event for P2P Devices. For legacy STA, the event format would remain the same. BUG: b/5262575 Change-Id: I8faf2159d35538fd07e42dba82d367b581cf2164 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--src/ap/ieee802_1x.c29
-rw-r--r--src/p2p/p2p.h10
-rw-r--r--src/p2p/p2p_group.c13
-rw-r--r--wpa_supplicant/p2p_supplicant.c6
4 files changed, 53 insertions, 5 deletions
diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c
index 8737455d..49eba69a 100644
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -36,6 +36,9 @@
#include "ap_config.h"
#include "ap_drv_ops.h"
#include "ieee802_1x.h"
+#ifdef ANDROID_BRCM_P2P_PATCH
+#include "p2p/p2p_i.h"
+#endif
static void ieee802_1x_finished(struct hostapd_data *hapd,
@@ -84,21 +87,37 @@ void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd,
struct sta_info *sta, int authorized)
{
int res;
+#ifdef ANDROID_BRCM_P2P_PATCH
+ u8 *dev_addr = NULL;
+#endif
if (sta->flags & WLAN_STA_PREAUTH)
return;
if (authorized) {
if (!ap_sta_is_authorized(sta)) {
- wpa_msg(hapd->msg_ctx, MSG_INFO,
- AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
+#if defined(ANDROID_BRCM_P2P_PATCH) && defined(CONFIG_P2P)
+ if((dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr)))
+ wpa_msg(hapd->msg_ctx, MSG_INFO,
+ AP_STA_CONNECTED MACSTR " dev_addr="MACSTR, MAC2STR(sta->addr), MAC2STR(dev_addr));
+ else
+#endif /*ANDROID_BRCM_P2P_PATCH*/
+ wpa_msg(hapd->msg_ctx, MSG_INFO,
+ AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
+
#ifdef ANDROID_BRCM_P2P_PATCH
/* Sending the event to parent is required as SSL listens on parent ctrl iface */
- if(hapd->msg_ctx_parent)
- wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
- AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
+ if(hapd->msg_ctx_parent) {
+ if(dev_addr)
+ wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
+ AP_STA_CONNECTED MACSTR " dev_addr="MACSTR, MAC2STR(sta->addr), MAC2STR(dev_addr));
+ else
+ wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
+ AP_STA_CONNECTED MACSTR , MAC2STR(sta->addr));
+ }
#endif /* ANDROID_BRCM_P2P_PATCH */
}
+
ap_sta_set_authorized(hapd, sta, 1);
res = hostapd_set_authorized(hapd, sta, 1);
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 81ebe9b6..72c90b10 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -1244,6 +1244,16 @@ void p2p_group_deinit(struct p2p_group *group);
*/
int p2p_group_notif_assoc(struct p2p_group *group, const u8 *addr,
const u8 *ie, size_t len);
+#ifdef ANDROID_BRCM_P2P_PATCH
+/**
+ * p2p_group_get_dev_addr - Retreive the device address of an assocated P2P
+ * client.
+ * @group: P2P group context from p2p_group_init()
+ * @addr: Interface address of the P2P client
+ * Returns: P2P dev_addr on success, NULL on failure
+ */
+u8 *p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr);
+#endif /*ANDROID_BRCM_P2P_PATCH */
/**
* p2p_group_assoc_resp_ie - Build P2P IE for (re)association response
diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c
index 169985fd..9fb9f00f 100644
--- a/src/p2p/p2p_group.c
+++ b/src/p2p/p2p_group.c
@@ -547,6 +547,19 @@ static struct p2p_group_member * p2p_group_get_client_iface(
return NULL;
}
+#ifdef ANDROID_BRCM_P2P_PATCH
+u8 * p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr)
+{
+ struct p2p_group_member *m;
+
+ m = p2p_group_get_client_iface(group, addr);
+
+ if (m)
+ return m->dev_addr;
+ else
+ return NULL;
+}
+#endif /* ANDROID_BRCM_P2P_PATCH */
static struct wpabuf * p2p_build_go_disc_req(void)
{
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index d8b2e16f..12dae342 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3294,6 +3294,12 @@ int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group,
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
return -1;
+#ifdef ANDROID_BRCM_P2P_PATCH
+ /* Make sure we are not running find during connection establishment */
+ wpa_printf(MSG_DEBUG, "P2P: Stopping P2P FIND, if any");
+ wpas_p2p_stop_find(wpa_s);
+#endif
+
if (freq == 2) {
wpa_printf(MSG_DEBUG, "P2P: Request to start GO on 2.4 GHz "
"band");