Browse Source

P2P: Add Device Password ID to GO Neg Request RX event

This event indicates the Device Password ID that the peer tried
to use in GO Negotiation. For example:
P2P-GO-NEG-REQUEST 02:40:61:c2:f3:b7 dev_passwd_id=4
Jouni Malinen 14 years ago
parent
commit
3dfda83d9c

+ 1 - 1
doc/ctrl_iface.doxygen

@@ -913,7 +913,7 @@ P2P_EVENT_GO_NEG_REQUEST: A P2P device requested GO negotiation, but we
 were not ready to start the negotiation.
 
 \verbatim
-P2P-GO-NEG-REQUEST 02:40:61:c2:f3:b7
+P2P-GO-NEG-REQUEST 02:40:61:c2:f3:b7 dev_passwd_id=4
 \endverbatim
 
 \subsection ctrl_iface_event_P2P_EVENT_GO_NEG_SUCCESS P2P-GO-NEG-SUCCESS

+ 2 - 1
src/p2p/p2p.h

@@ -398,6 +398,7 @@ struct p2p_config {
 	 * go_neg_req_rx - Notification of a receive GO Negotiation Request
 	 * @ctx: Callback context from cb_ctx
 	 * @src: Source address of the message triggering this notification
+	 * @dev_passwd_id: WPS Device Password ID
 	 *
 	 * This callback is used to notify that a P2P Device is requesting
 	 * group owner negotiation with us, but we do not have all the
@@ -406,7 +407,7 @@ struct p2p_config {
 	 * PIN or PBC button press. This information can be provided with a
 	 * call to p2p_connect().
 	 */
-	void (*go_neg_req_rx)(void *ctx, const u8 *src);
+	void (*go_neg_req_rx)(void *ctx, const u8 *src, u16 dev_passwd_id);
 
 	/**
 	 * go_neg_completed - Notification of GO Negotiation results

+ 2 - 1
src/p2p/p2p_go_neg.c

@@ -395,7 +395,8 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
 		status = P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE;
 		if (dev)
 			dev->flags |= P2P_DEV_PEER_WAITING_RESPONSE;
-		p2p->cfg->go_neg_req_rx(p2p->cfg->cb_ctx, sa);
+		p2p->cfg->go_neg_req_rx(p2p->cfg->cb_ctx, sa,
+					msg.dev_password_id);
 	} else if (p2p->go_neg_peer && p2p->go_neg_peer != dev) {
 		wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
 			"P2P: Already in Group Formation with another peer");

+ 3 - 3
wpa_supplicant/p2p_supplicant.c

@@ -978,11 +978,11 @@ void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res)
 }
 
 
-void wpas_go_neg_req_rx(void *ctx, const u8 *src)
+void wpas_go_neg_req_rx(void *ctx, const u8 *src, u16 dev_passwd_id)
 {
 	struct wpa_supplicant *wpa_s = ctx;
-	wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_GO_NEG_REQUEST MACSTR,
-		MAC2STR(src));
+	wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_GO_NEG_REQUEST MACSTR
+		" dev_passwd_id=%u", MAC2STR(src), dev_passwd_id);
 }
 
 

+ 1 - 1
wpa_supplicant/p2p_supplicant.h

@@ -63,7 +63,7 @@ void wpas_dev_found(void *ctx, const u8 *addr, const u8 *dev_addr,
 		    const u8 *pri_dev_type, const char *dev_name,
 		    u16 config_methods, u8 dev_capab, u8 group_capab);
 void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res);
-void wpas_go_neg_req_rx(void *ctx, const u8 *src);
+void wpas_go_neg_req_rx(void *ctx, const u8 *src, u16 dev_passwd_id);
 void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
 			const u8 *dev_addr, const u8 *pri_dev_type,
 			const char *dev_name, u16 supp_config_methods,