From d55fc03ef65e798c9f18f9aec3d1ed34ad534f48 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 7 Feb 2014 16:26:59 +0200 Subject: [PATCH] P2P: Handle unexpected GO Neg Req reject message more cleanly The mechanism of using Status attribute in GO Negotiation Request was used in some early specification drafts, but it is not compliant with the current P2P specification where GO Negotiation Request is used only for the purpose of initiating a new GO Negotiation. However, some deployed devices use it to indicate rejection of GO Negotiation in a case where they have sent out GO Negotiation Response with status 1. The P2P specification explicitly disallows this. To avoid unnecessary interoperability issues and extra frames, mark the pending negotiation as failed and do not reply to this GO Negotiation Request frame. Previously, GO Negotiation Response frame with status=4 was sent back as an indication of the GO Negotiation Request frame being invalid. This response is not sent anymore and the status code for the P2P-GO-NEG-FAILURE event is changed from 4 (invalid parameters) to 11 (rejected by user) for this specific workaround case. Signed-hostap: Jouni Malinen --- src/p2p/p2p_go_neg.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c index e28f93ea2..2e40db10e 100644 --- a/src/p2p/p2p_go_neg.c +++ b/src/p2p/p2p_go_neg.c @@ -594,6 +594,25 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa, if (msg.status && *msg.status) { p2p_dbg(p2p, "Unexpected Status attribute (%d) in GO Negotiation Request", *msg.status); + if (dev && p2p->go_neg_peer == dev && + *msg.status == P2P_SC_FAIL_REJECTED_BY_USER) { + /* + * This mechanism for using Status attribute in GO + * Negotiation Request is not compliant with the P2P + * specification, but some deployed devices use it to + * indicate rejection of GO Negotiation in a case where + * they have sent out GO Negotiation Response with + * status 1. The P2P specification explicitly disallows + * this. To avoid unnecessary interoperability issues + * and extra frames, mark the pending negotiation as + * failed and do not reply to this GO Negotiation + * Request frame. + */ + p2p->cfg->send_action_done(p2p->cfg->cb_ctx); + p2p_go_neg_failed(p2p, dev, *msg.status); + p2p_parse_free(&msg); + return; + } goto fail; }