[PATCH] For P2P_EVENT_PROV_DISC_SHOW_PIN, store the generated PIN.

Jithu Jance jithu
Mon Nov 21 02:08:06 PST 2011


If p2p_connect join is issued with pin display option, the p2p_connect context generates a pin and stores it. In addition to this PIN, 
Provision discovery response also generates another PIN which is different from the original PIN. This patch avoids generating a new
pin, if the PIN is already set. If PIN is not present, then it uses the newly generated pin and stores it.


Signed-hostap: Jithu Jance <jithu at broadcom.com>

---
 wpa_supplicant/p2p_supplicant.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index c6484af..7a2bd4f 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -1670,8 +1670,13 @@ static void wpas_prov_disc_local_display(struct wpa_supplicant *wpa_s,
 					 const u8 *peer, const char *params,
 					 unsigned int generated_pin)
 {
-	wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_SHOW_PIN MACSTR " %08d%s",
-		MAC2STR(peer), generated_pin, params);
+	if(wpa_s->p2p_pin[0] == '\0') {
+		/* If PIN hasn't been generated in the p2p_connect context, set it now. */
+		os_snprintf(wpa_s->p2p_pin, sizeof(wpa_s->p2p_pin), " %08d", generated_pin);
+	}
+
+	wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_SHOW_PIN MACSTR " %s%s",
+			MAC2STR(peer), wpa_s->p2p_pin, params);
 }
 
 
-- 
1.7.4.1




-- Jithu Jance



More information about the Hostap mailing list