]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Call normal SD query callback on RX/TX race
authorBenjamin Berg <benjamin.berg@intel.com>
Wed, 17 Apr 2024 12:45:24 +0000 (15:45 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 21 Apr 2024 08:55:53 +0000 (11:55 +0300)
If the TX success response races with the RX frame then the state
machine was simply move to P2P_SD_DURING_FIND to continue the operation.
However, this does not take into account broadcast queries where the
callback handler updates the peer's sd_pending_bcast_queries.

Fix this by exporting the callback and calling it directly. This is
fine, as the operation is cancelled immediately afterwards, ensuring
that the callback is not called a second time.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
src/p2p/p2p.c
src/p2p/p2p_i.h
src/p2p/p2p_sd.c

index bb1938dc31b92e73dd5e7c1be79e3a88329e7d5b..8e0fc35dfbf0bf9241033a2189a79ee02b200235 100644 (file)
@@ -3332,7 +3332,7 @@ skip_sd:
 }
 
 
-static void p2p_sd_cb(struct p2p_data *p2p, int success)
+void p2p_sd_query_cb(struct p2p_data *p2p, int success)
 {
        p2p_dbg(p2p, "Service Discovery Query TX callback: success=%d",
                success);
@@ -3835,7 +3835,7 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
                p2p_go_neg_conf_cb(p2p, result);
                break;
        case P2P_PENDING_SD:
-               p2p_sd_cb(p2p, success);
+               p2p_sd_query_cb(p2p, success);
                break;
        case P2P_PENDING_PD:
                p2p_prov_disc_cb(p2p, success);
index 2612be5ad3f2cbf192535374ad50caf3d82e268a..0a487e031627bf1311ae44e81e75814bc432522d 100644 (file)
@@ -899,6 +899,9 @@ void p2p_pref_channel_filter(const struct p2p_channels *a,
                             const struct weighted_pcl *freq_list,
                             unsigned int num_channels,
                             struct p2p_channels *res, bool go);
+
+void p2p_sd_query_cb(struct p2p_data *p2p, int success);
+
 void p2p_dbg(struct p2p_data *p2p, const char *fmt, ...)
 PRINTF_FORMAT(2, 3);
 void p2p_info(struct p2p_data *p2p, const char *fmt, ...)
index d6882e4a324101d7d53cfbbac92a142d607966f6..5537a6eaaf76f3b42a26cec44de9d47a7f0fef80 100644 (file)
@@ -502,7 +502,7 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
                 * received. */
                p2p_dbg(p2p,
                        "GAS Initial Request had not yet received TX status - process the response anyway");
-               p2p_set_state(p2p, P2P_SD_DURING_FIND);
+               p2p_sd_query_cb(p2p, 1);
        }
        p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
        p2p_clear_timeout(p2p);