]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix after_scan_tx processing during ongoing operations
authorJouni Malinen <j@w1.fi>
Tue, 23 Apr 2013 18:12:04 +0000 (21:12 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 23 Apr 2013 18:15:54 +0000 (21:15 +0300)
When Action frame TX is postponed until a pending p2p_scan completes,
there may be additional operations that need to be continued after the
postponed Action frame TX operation completes. Fix this by starting
pending operation (if any) from TX status event for after_scan_tx
frames.

This fixes common errors seen with the test_discovery hwsim test case.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/p2p/p2p.c
src/p2p/p2p_i.h

index 4418bb32b280c56975210536fd0836dc51644bbb..65f34120f88aa9fed00adadb3ffe2c8feaf0fb8d 100644 (file)
@@ -941,8 +941,7 @@ static int p2p_run_after_scan(struct p2p_data *p2p)
        enum p2p_after_scan op;
 
        if (p2p->after_scan_tx) {
-               /* TODO: schedule p2p_run_after_scan to be called from TX
-                * status callback(?) */
+               p2p->after_scan_tx_in_progress = 1;
                wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Send pending "
                        "Action frame at p2p_scan completion");
                p2p->cfg->send_action(p2p->cfg->cb_ctx,
@@ -3050,6 +3049,18 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
        p2p->pending_action_state = P2P_NO_PENDING_ACTION;
        switch (state) {
        case P2P_NO_PENDING_ACTION:
+               if (p2p->after_scan_tx_in_progress) {
+                       p2p->after_scan_tx_in_progress = 0;
+                       if (p2p->start_after_scan != P2P_AFTER_SCAN_NOTHING &&
+                           p2p_run_after_scan(p2p))
+                               break;
+                       if (p2p->state == P2P_SEARCH) {
+                               wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
+                                       "P2P: Continue find after "
+                                       "after_scan_tx completion");
+                               p2p_continue_find(p2p);
+                       }
+               }
                break;
        case P2P_PENDING_GO_NEG_REQUEST:
                p2p_go_neg_req_cb(p2p, success);
@@ -3085,6 +3096,8 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
                p2p_go_disc_req_cb(p2p, success);
                break;
        }
+
+       p2p->after_scan_tx_in_progress = 0;
 }
 
 
index dff226ada5594305a37725f60d6ae659b3df22fa..c428c202728019e3e82ed811745874340a4758e5 100644 (file)
@@ -385,6 +385,7 @@ struct p2p_data {
        } start_after_scan;
        u8 after_scan_peer[ETH_ALEN];
        struct p2p_pending_action_tx *after_scan_tx;
+       unsigned int after_scan_tx_in_progress:1;
 
        /* Requested device types for find/search */
        unsigned int num_req_dev_types;