]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Set P2P_DEV_PEER_WAITING_RESPONSE from TX status callback
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 26 Apr 2013 09:54:27 +0000 (12:54 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 26 Apr 2013 09:57:52 +0000 (12:57 +0300)
Commit fb8984fd6f4b49d9178dd87a880dd7add514b7d1 added a mechanism to
skip the Listen state when the peer is expected to be waiting for us to
initiate a new GO Negotiation. However, this flag was set when building
the GO Negotiation Response frame with status 1 regardless of whether we
managed to send that frame or peer receive it. This could result in GO
Negotiation failures in cases where the peer did not receive the
response and Listen channels of the devices were different. Fix this by
setting the flag only after TX status indicating success has been
received.

This fixes frequent failures shown for the test_grpform_pbc hwsim test
case.

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

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

index 65f34120f88aa9fed00adadb3ffe2c8feaf0fb8d..bb9b1ad3a2a235dd0d56c0f5073ef8a4f366b3be 100644 (file)
@@ -2982,7 +2982,8 @@ static void p2p_go_neg_resp_cb(struct p2p_data *p2p, int success)
 }
 
 
-static void p2p_go_neg_resp_failure_cb(struct p2p_data *p2p, int success)
+static void p2p_go_neg_resp_failure_cb(struct p2p_data *p2p, int success,
+                                      const u8 *addr)
 {
        wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
                "P2P: GO Negotiation Response (failure) TX callback: "
@@ -2990,6 +2991,12 @@ static void p2p_go_neg_resp_failure_cb(struct p2p_data *p2p, int success)
        if (p2p->go_neg_peer && p2p->go_neg_peer->status != P2P_SC_SUCCESS) {
                p2p_go_neg_failed(p2p, p2p->go_neg_peer,
                                  p2p->go_neg_peer->status);
+       } else if (success) {
+               struct p2p_device *dev;
+               dev = p2p_get_device(p2p, addr);
+               if (dev &&
+                   dev->status == P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE)
+                       dev->flags |= P2P_DEV_PEER_WAITING_RESPONSE;
        }
 }
 
@@ -3069,7 +3076,7 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
                p2p_go_neg_resp_cb(p2p, success);
                break;
        case P2P_PENDING_GO_NEG_RESPONSE_FAILURE:
-               p2p_go_neg_resp_failure_cb(p2p, success);
+               p2p_go_neg_resp_failure_cb(p2p, success, dst);
                break;
        case P2P_PENDING_GO_NEG_CONFIRM:
                p2p_go_neg_conf_cb(p2p, result);
index 805bf6934aef6d37e0ff6c933cf8c42fad07ee5b..bf973e8183f2f6668cb97094b5d7e5e52ae2ec08 100644 (file)
@@ -619,8 +619,6 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
                        "P2P: Not ready for GO negotiation with " MACSTR,
                        MAC2STR(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,
                                        msg.dev_password_id);
        } else if (p2p->go_neg_peer && p2p->go_neg_peer != dev) {