P2P: Clear pending_listen_freq when starting GO Neg/Invite
authorJouni Malinen <j@w1.fi>
Sat, 27 Sep 2014 10:15:47 +0000 (13:15 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 27 Sep 2014 13:12:41 +0000 (16:12 +0300)
Previously, it was possible for the p2p->pending_listen_freq to be left
at non-zero value if Probe Request frame was received from a peer with
which we were waiting to start GO Negotiation/Invite process. That could
result in the following Listen operation getting blocked in some
operation sequences if the peer did not acknowledge the following P2P
Public Action frame.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/p2p/p2p.c

index e746310..c4676ed 100644 (file)
@@ -1825,6 +1825,10 @@ static void p2p_go_neg_start(void *eloop_ctx, void *timeout_ctx)
        struct p2p_data *p2p = eloop_ctx;
        if (p2p->go_neg_peer == NULL)
                return;
+       if (p2p->pending_listen_freq) {
+               p2p_dbg(p2p, "Clear pending_listen_freq for p2p_go_neg_start");
+               p2p->pending_listen_freq = 0;
+       }
        p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
        p2p->go_neg_peer->status = P2P_SC_SUCCESS;
        p2p_connect_send(p2p, p2p->go_neg_peer);
@@ -1836,6 +1840,10 @@ static void p2p_invite_start(void *eloop_ctx, void *timeout_ctx)
        struct p2p_data *p2p = eloop_ctx;
        if (p2p->invite_peer == NULL)
                return;
+       if (p2p->pending_listen_freq) {
+               p2p_dbg(p2p, "Clear pending_listen_freq for p2p_invite_start");
+               p2p->pending_listen_freq = 0;
+       }
        p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
        p2p_invite_send(p2p, p2p->invite_peer, p2p->invite_go_dev_addr,
                        p2p->invite_dev_pw_id);