[PATCH] P2P: p2p_dev_address appended to AP-STA-DISCONNECTED event for P2P connections.

Jithu Jance jithu
Fri Dec 9 05:19:16 PST 2011


For AP-STA-CONNECTED event during P2P connection, the "dev_addr=" print is modified to "p2p_dev_addr=" for better readability. 
This patch also appends "p2p_dev_addr" to AP-STA-DISCONNECTED event [For P2P Connections]. Kindly see whether the patch is okay.


Signed-hostap: Jithu Jance <jithu at broadcom.com>
---
 src/ap/sta_info.c |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index a9981cc..cc7ffe8 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -771,37 +771,48 @@ void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
 void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
 			   int authorized)
 {
+	const u8 *dev_addr = NULL;
 	if (!!authorized == !!(sta->flags & WLAN_STA_AUTHORIZED))
 		return;
 
-	if (authorized) {
-		const u8 *dev_addr = NULL;
 #ifdef CONFIG_P2P
-		dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr);
+	dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr);
 #endif /* CONFIG_P2P */
+
+	if (authorized) {
 		if (dev_addr)
 			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED
-				MACSTR " dev_addr=" MACSTR,
+				MACSTR " p2p_dev_addr=" MACSTR,
 				MAC2STR(sta->addr), MAC2STR(dev_addr));
 		else
 			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED
 				MACSTR, MAC2STR(sta->addr));
 		if (hapd->msg_ctx_parent &&
-		    hapd->msg_ctx_parent != hapd->msg_ctx && dev_addr)
+			hapd->msg_ctx_parent != hapd->msg_ctx && dev_addr)
 			wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
-				AP_STA_CONNECTED MACSTR " dev_addr=" MACSTR,
+				AP_STA_CONNECTED MACSTR " p2p_dev_addr=" MACSTR,
 				MAC2STR(sta->addr), MAC2STR(dev_addr));
 		else if (hapd->msg_ctx_parent &&
-			 hapd->msg_ctx_parent != hapd->msg_ctx)
+			hapd->msg_ctx_parent != hapd->msg_ctx)
 			wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
 				AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
 
 		sta->flags |= WLAN_STA_AUTHORIZED;
 	} else {
-		wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
-			MAC2STR(sta->addr));
+		if(dev_addr)
+			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED
+				MACSTR " p2p_dev_addr=" MACSTR,
+				MAC2STR(sta->addr), MAC2STR(dev_addr));
+		else
+			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
+				MAC2STR(sta->addr));
 		if (hapd->msg_ctx_parent &&
-		    hapd->msg_ctx_parent != hapd->msg_ctx)
+			hapd->msg_ctx_parent != hapd->msg_ctx && dev_addr)
+			wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
+				AP_STA_DISCONNECTED MACSTR " p2p_dev_addr=" MACSTR,
+				MAC2STR(sta->addr), MAC2STR(dev_addr));
+		else if (hapd->msg_ctx_parent &&
+			hapd->msg_ctx_parent != hapd->msg_ctx)
 			wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
 				AP_STA_DISCONNECTED MACSTR,
 				MAC2STR(sta->addr));
-- 
1.7.4.1


- Jithu Jance
-------------- next part --------------
A non-text attachment was scrubbed...
Name: append_p2p_dev_addr
Type: application/octet-stream
Size: 2786 bytes
Desc: append_p2p_dev_addr
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20111209/e0b9f3cf/attachment.obj 



More information about the Hostap mailing list