diff mbox

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

Message ID 6C370B347C3FE8438C9692873287D2E1195AE35D64@SJEXCHCCR01.corp.ad.broadcom.com
State Accepted
Commit 10cc6c883e1ecf4b6f4c6fc9430ff09ab227bafc
Headers show

Commit Message

Jithu Jance Dec. 9, 2011, 1:19 p.m. UTC
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@broadcom.com>
---
 src/ap/sta_info.c |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

Comments

Jouni Malinen Dec. 10, 2011, 10:30 a.m. UTC | #1
On Fri, Dec 09, 2011 at 05:19:16AM -0800, Jithu Jance wrote:
> For AP-STA-CONNECTED event during P2P connection, the "dev_addr=" print is modified to "p2p_dev_addr=" for better readability. 

In general, this type of changes in an interface used by external
programs are not preferred. However, I did apply this now since
p2p_dev_addr is more consistent with other events and I'm not aware of
any program using the old parameter (based on a quick look, Android ICS
did not seem to be using this even).

> This patch also appends "p2p_dev_addr" to AP-STA-DISCONNECTED event [For P2P Connections]. Kindly see whether the patch is okay.

Thanks, applied.
Jithu Jance Dec. 12, 2011, 4:29 a.m. UTC | #2
> In general, this type of changes in an interface used by external
> programs are not preferred. However, I did apply this now since
> p2p_dev_addr is more consistent with other events and I'm not aware of
> any program using the old parameter (based on a quick look, Android ICS
> did not seem to be using this even).

Thanks for taking in this change. I also had the same thought on whether it
would break
any external programs. But since this is relatively new patch, i had a gut
feeling that applications
might not have started using it and thought of updating it before it gets
too late. :)





-- Jithu Jance
*
*

On Sat, Dec 10, 2011 at 4:00 PM, Jouni Malinen <j@w1.fi> wrote:

> In general, this type of changes in an interface used by external
> programs are not preferred. However, I did apply this now since
> p2p_dev_addr is more consistent with other events and I'm not aware of
> any program using the old parameter (based on a quick look, Android ICS
> did not seem to be using this even).
>
diff mbox

Patch

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));