Patchwork P2P: clear WPS method when GO negotiation fails

login
register
mail settings
Submitter Johannes Berg
Date Nov. 7, 2011, 2:33 p.m.
Message ID <1320676428.3993.44.camel@jlt3.sipsolutions.net>
Download mbox | patch
Permalink /patch/124090/
State Accepted
Commit eb916eb899aca7ff9fc8eea88c74eef4e3ad02fa
Headers show

Comments

Johannes Berg - Nov. 7, 2011, 2:33 p.m.
From: Johannes Berg <johannes.berg@intel.com>

When GO negotation fails the WPS method is currently
not cleared, which can result in GO negotiation being
resumed when a GO negotiation request frame from is
received from the peer. That is unexpected as locally
we already gave up.

This manifests itself in getting

1319574733.955685: wlan0: P2P-GO-NEG-FAILURE status=-1
1319574733.955723: P2P: Removing pending group interface p2p-wlan0-0
...
1319574736.648378: wlan0: P2P: Starting GO Negotiation with previously authorized peer
...
1319574736.650115: wlan0: P2P: Sending GO Negotiation Response
...
1319574736.988038: wlan0: P2P-GO-NEG-SUCCESS
1319574736.988233: P2P: No pending group interface
1319574736.988268: P2P: Create a new interface p2p-wlan0-1 for the group

Clear the WPS method to avoid this situation. I wasn't
able to test this though, but given the log I can only
assume this is how the situation happened.

Reported-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-hostap: Johannes Berg <johannes.berg@intel.com>
---
 src/p2p/p2p.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Jouni Malinen - Nov. 18, 2011, 9:36 p.m.
On Mon, Nov 07, 2011 at 03:33:48PM +0100, Johannes Berg wrote:
> When GO negotation fails the WPS method is currently
> not cleared, which can result in GO negotiation being
> resumed when a GO negotiation request frame from is
> received from the peer. That is unexpected as locally
> we already gave up.

> Clear the WPS method to avoid this situation. I wasn't
> able to test this though, but given the log I can only
> assume this is how the situation happened.

Thanks, applied.

Patch

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 0f2a5d2..382e6b6 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -144,6 +144,8 @@  void p2p_go_neg_failed(struct p2p_data *p2p, struct p2p_device *peer,
 	struct p2p_go_neg_results res;
 	p2p_clear_timeout(p2p);
 	p2p_set_state(p2p, P2P_IDLE);
+	if (p2p->go_neg_peer)
+		p2p->go_neg_peer->wps_method = WPS_NOT_READY;
 	p2p->go_neg_peer = NULL;
 
 	os_memset(&res, 0, sizeof(res));