Accumulative patch from commit d5b559b6418c2bd09663e0d09e93a6592357fdce

d5b559b WNM: Add disassociation timeout processing for ESS_DISASSOC
f65f539 GAS: Reduce query timeout to two seconds
7a56af5 GAS: Assign new dialog token even if previous one is free
9e1ecab GAS: Ignore replays if previous frag_id without dropping GAS session
fa7ae95 Add test code for fetching the last configured GTK
576bce9 P2P: Direct global ctrl_iface commands automatically for P2P
c4bf83a P2P: No duplicate AP-STA-CONNECTED/DISCONNECTED as global event
7793c95 Clean up AP-STA-CONNECTED/DISCONNECTED prints
92c4465 P2P: Mark P2P events global (not specific to interface)
ed496f1 P2P: Clean up debug prints
710ae9a P2P: Move p2p_find stopped event message into p2p_supplicant.c
47bfe49 Add wpa_msg_global() for global events
214e428 Allow global ctrl_iface monitors
89c7ac5 wpa_cli: Set buffer length the same as in wpa_supplicant_ctrl_iface_process()
faf9a85 Add band option (2.4 vs. 5) for filtering scans
b83b1b2 Android: Clarify keystore include directories
6f1127c Android: Add a top level Android.mk
d2a9e2c Abstract and Android sockets for global ctrl_iface
6fd5cea wpa_cli: Allow global interface to be used in interactive mode
2925756 wpa_supplicant: Add -G argument to specify global ctrl group
cf3bebf Allow global ctrl_iface to be used for per-interface commands
058c863 FT RRB: Fix a memory leak on error path

Change-Id: I32a4afb43894167a30c4b0df18fd4846a2945c7c
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c
index 852ddf5..15e7622 100644
--- a/src/p2p/p2p_group.c
+++ b/src/p2p/p2p_group.c
@@ -378,8 +378,8 @@
 	} else {
 		WPA_PUT_BE16(len, (u8 *) wpabuf_put(wfd_subelems, 0) - len -
 			     2);
-		wpa_printf(MSG_DEBUG, "WFD: WFD Session Info: %u descriptors",
-			   count);
+		p2p_dbg(group->p2p, "WFD: WFD Session Info: %u descriptors",
+			count);
 	}
 
 	wfd_ie = wifi_display_encaps(wfd_subelems);
@@ -588,7 +588,7 @@
 	m->next = group->members;
 	group->members = m;
 	group->num_members++;
-	wpa_msg(group->p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Add client " MACSTR
+	p2p_dbg(group->p2p,  "Add client " MACSTR
 		" to group (p2p=%d wfd=%d client_info=%d); num_members=%u/%u",
 		MAC2STR(addr), m->p2p_ie ? 1 : 0, m->wfd_ie ? 1 : 0,
 		m->client_info ? 1 : 0,
@@ -641,8 +641,8 @@
 void p2p_group_notif_disassoc(struct p2p_group *group, const u8 *addr)
 {
 	if (p2p_group_remove_member(group, addr)) {
-		wpa_msg(group->p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Remove "
-			"client " MACSTR " from group; num_members=%u/%u",
+		p2p_dbg(group->p2p, "Remove client " MACSTR
+			" from group; num_members=%u/%u",
 			MAC2STR(addr), group->num_members,
 			group->cfg->max_clients);
 		if (group->num_members == group->cfg->max_clients - 1)
@@ -854,20 +854,18 @@
 
 	m = p2p_group_get_client(group, dev_id);
 	if (m == NULL || m->client_info == NULL) {
-		wpa_printf(MSG_DEBUG, "P2P: Requested client was not in this "
-			   "group " MACSTR,
-			   MAC2STR(group->cfg->interface_addr));
+		p2p_dbg(group->p2p, "Requested client was not in this group "
+			MACSTR, MAC2STR(group->cfg->interface_addr));
 		return -1;
 	}
 
 	if (!(m->dev_capab & P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY)) {
-		wpa_printf(MSG_DEBUG, "P2P: Requested client does not support "
-			   "client discoverability");
+		p2p_dbg(group->p2p, "Requested client does not support client discoverability");
 		return -1;
 	}
 
-	wpa_printf(MSG_DEBUG, "P2P: Schedule GO Discoverability Request to be "
-		   "sent to " MACSTR, MAC2STR(dev_id));
+	p2p_dbg(group->p2p, "Schedule GO Discoverability Request to be sent to "
+		MACSTR, MAC2STR(dev_id));
 
 	req = p2p_build_go_disc_req();
 	if (req == NULL)
@@ -882,8 +880,7 @@
 				  group->cfg->interface_addr,
 				  wpabuf_head(req), wpabuf_len(req), 200) < 0)
 	{
-		wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
-			"P2P: Failed to send Action frame");
+		p2p_dbg(p2p, "Failed to send Action frame");
 	}
 
 	wpabuf_free(req);
@@ -908,7 +905,7 @@
 
 	m = p2p_group_get_client_iface(group, client_interface_addr);
 	if (m == NULL || m->client_info == NULL) {
-		wpa_printf(MSG_DEBUG, "P2P: Client was not in this group");
+		p2p_dbg(group->p2p, "Client was not in this group");
 		return P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE;
 	}
 
@@ -921,9 +918,9 @@
 	else
 		curr_noa_len = -1;
 	if (curr_noa_len < 0)
-		wpa_printf(MSG_DEBUG, "P2P: Failed to fetch current NoA");
+		p2p_dbg(group->p2p, "Failed to fetch current NoA");
 	else if (curr_noa_len == 0)
-		wpa_printf(MSG_DEBUG, "P2P: No NoA being advertized");
+		p2p_dbg(group->p2p, "No NoA being advertized");
 	else
 		wpa_hexdump(MSG_DEBUG, "P2P: Current NoA", curr_noa,
 			    curr_noa_len);