P2P: Use the same Dialog Token value for every GO Negotiation retry
authorSunil Dutt <duttus@codeaurora.org>
Wed, 9 Jan 2013 14:05:18 +0000 (16:05 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 12 Jan 2013 15:51:54 +0000 (17:51 +0200)
Each GO Negotiation Request is (re)tried with an unique dialog token and
a GO Negotiation Response / Confirmation from the peer with a mismatched
dialog token is ignored which could result in a failure in this group
formation attempt. Thus, the P2P device would continue retrying the GO
Negotiation Request frames till the GO Negotiation Response frame with a
matching dialog token is received. To avoid the failures due to the
dialog token mismatch in retry cases if the peer is too slow to reply
within the timeout, the same dialog token value is used for every retry
in the same group formation handshake.

It should be noted that this can result in different contents of the GO
Negotiation Request frame being sent with the same dialog token value
since the tie breaker bit in GO Intent is still toggled for each
attempt. The specification is not very clear on what would be the
correct behavior here. Tie breaker bit is not updated on
"retransmissions", but that is more likely referring to the layer 2
retransmission and not the retry at higher layer using a new MMPDU.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/p2p/p2p.c
src/p2p/p2p_go_neg.c

index b994a44..a217816 100644 (file)
@@ -1319,8 +1319,16 @@ int p2p_connect(struct p2p_data *p2p, const u8 *peer_addr,
        dev->flags &= ~P2P_DEV_WAIT_GO_NEG_CONFIRM;
        if (pd_before_go_neg)
                dev->flags |= P2P_DEV_PD_BEFORE_GO_NEG;
-       else
+       else {
                dev->flags &= ~P2P_DEV_PD_BEFORE_GO_NEG;
+               /*
+                * Assign dialog token here to use the same value in each
+                * retry within the same GO Negotiation exchange.
+                */
+               dev->dialog_token++;
+               if (dev->dialog_token == 0)
+                       dev->dialog_token = 1;
+       }
        dev->connect_reqs = 0;
        dev->go_neg_req_sent = 0;
        dev->go_state = UNKNOWN_GO;
index 2fdc47f..38d4275 100644 (file)
@@ -145,9 +145,6 @@ static struct wpabuf * p2p_build_go_neg_req(struct p2p_data *p2p,
        if (buf == NULL)
                return NULL;
 
-       peer->dialog_token++;
-       if (peer->dialog_token == 0)
-               peer->dialog_token = 1;
        p2p_buf_add_public_action_hdr(buf, P2P_GO_NEG_REQ, peer->dialog_token);
 
        len = p2p_buf_add_ie_hdr(buf);