<br>For P2P, the p2p_connect takes in device address argument to make a
connection. However the connected event [AP-STA-CONNECTED] comes<br>
with interface address. The application listening on events would find
it difficult to map interface address to the p2p device address which is
provided for connection.<br>
<br>
This patch appends P2P device address to AP-STA-CONNECTED event for P2P Client connection.<br>
This will help applications to easily map the P2P interface address to
P2P device address on CONNECTED event. For NON-P2P case, it will just
print the usual STA mac<br>
address alone.<br>
<br>
Kindly see whether the patch is okay.<br>
<br>
---<br>
src/ap/ieee802_1x.c | 16 +++++++++++++---<br>
src/p2p/p2p_group.c | 11 +++++++++++<br>
src/p2p/p2p_i.h | 1 +<br>
3 files changed, 25 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c<br>
index d163ce6..97587f4 100644<br>
--- a/src/ap/ieee802_1x.c<br>
+++ b/src/ap/ieee802_1x.c<br>
@@ -36,6 +36,7 @@<br>
#include "ap_config.h"<br>
#include "ap_drv_ops.h"<br>
#include "ieee802_1x.h"<br>
+#include "p2p/p2p_i.h"<br>
<br>
<br>
static void ieee802_1x_finished(struct hostapd_data *hapd,<br>
@@ -84,14 +85,23 @@ void ieee802_1x_set_sta_authorized(<div id=":10r">struct hostapd_data *hapd,<br>
struct sta_info *sta, int authorized)<br>
{<br>
int res;<br>
+ const u8 *dev_addr = NULL;<br>
<br>
if (sta->flags & WLAN_STA_PREAUTH)<br>
return;<br>
<br>
if (authorized) {<br>
- if (!ap_sta_is_authorized(sta))<br>
- wpa_msg(hapd->msg_ctx, MSG_INFO,<br>
- AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));<br>
+ if (!ap_sta_is_authorized(sta)) {<br>
+#if defined(CONFIG_P2P)<br>
+ if((dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr)))<br>
+ wpa_msg(hapd->msg_ctx, MSG_INFO,<br>
+ AP_STA_CONNECTED MACSTR " dev_addr="MACSTR, MAC2STR(sta->addr), MAC2STR(dev_addr));<br>
+ else<br>
+#endif /* CONFIG_P2P */<br>
+ wpa_msg(hapd->msg_ctx, MSG_INFO,<br>
+ AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));<br>
+ }<br>
+<br>
ap_sta_set_authorized(hapd, sta, 1);<br>
res = hostapd_set_authorized(hapd, sta, 1);<br>
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,<br>
diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c<br>
index cc2542d..1735cb2 100644<br>
--- a/src/p2p/p2p_group.c<br>
+++ b/src/p2p/p2p_group.c<br>
@@ -542,6 +542,17 @@ static struct p2p_group_member * p2p_group_get_client_iface(<br>
return NULL;<br>
}<br>
<br>
+const u8* p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr)<br>
+{<br>
+ struct p2p_group_member *m;<br>
+<br>
+ m = p2p_group_get_client_iface(group, addr);<br>
+<br>
+ if(m)<br>
+ return m->dev_addr;<br>
+ else<br>
+ return NULL;<br>
+}<br>
<br>
static struct wpabuf * p2p_build_go_disc_req(void)<br>
{<br>
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h<br>
index 0e73136..3c13c3c 100644<br>
--- a/src/p2p/p2p_i.h<br>
+++ b/src/p2p/p2p_i.h<br>
@@ -537,6 +537,7 @@ struct p2p_noa_desc {<br>
<br>
/* p2p_group.c */<br>
const u8 * p2p_group_get_interface_addr(struct p2p_group *group);<br>
+const u8* p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr);<br>
u8 p2p_group_presence_req(struct p2p_group *group,<br>
const u8 *client_interface_addr,<br>
const u8 *noa, size_t noa_len);<br>
<font color="#888888">--<br>
1.7.4.1<br>
<br>
<br>
<br>
- Jithu Jance.</font></div><br>