[PATCH 3/3] P2P: p2p connect request fail if already connected.

Avichal Agarwal avichal.a
Mon Aug 3 04:10:17 PDT 2015


From: Avichal Agarwal <avichal.a at samsung.com>
Date: Mon, 3 Aug 2015 16:17:49 +0530
Subject: [PATCH 3/3] P2P: p2p connect request fail if already connected.

According to spcs if p2p is already connected then connection request can not be done.
So if p2p is connected , it will return FAIL.

Signed-off-by: Avichal Agarwal <avichal.a at samsung.com>
---
 wpa_supplicant/p2p_supplicant.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 04db856..f17dd68 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -4986,6 +4986,11 @@ int wpas_p2p_connect(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
 
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
 		return -1;
+	
+	if(wpa_s->wpa_state == WPA_COMPLETED) {
+		wpa_printf(MSG_INFO, "P2P: Already connected \n");
+		return -1;
+	}
 
 	if (persistent_id >= 0) {
 		ssid = wpa_config_get_network(wpa_s->conf, persistent_id);
-- 
1.7.9.5



More information about the Hostap mailing list