]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P2: Indicate bootstrapping comeback response to upper layers
authorVinay Gannevaram <quic_vganneva@quicinc.com>
Thu, 20 Feb 2025 09:58:08 +0000 (15:28 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 6 Mar 2025 21:29:30 +0000 (23:29 +0200)
The bootstrapping comeback response is managed by wpa_supplicant and is
not communicated to the upper layers. However, it is essential for the
upper layers to be aware of the status of ongoing bootstrapping requests.

Notify the upper layers of the bootstrapping comeback response. Modify
the D-Bus interface for bootstrapping indications (instead of providing
a new signal such for this new extended purpose) as this has not yet
been used and is a recently added parameter.

Signed-off-by: Vinay Gannevaram <quic_vganneva@quicinc.com>
doc/dbus.doxygen
src/p2p/p2p.h
src/p2p/p2p_pd.c
wpa_supplicant/dbus/dbus_new.c
wpa_supplicant/dbus/dbus_new.h
wpa_supplicant/notify.c
wpa_supplicant/notify.h
wpa_supplicant/p2p_supplicant.c

index ea5ea56fa37b54e2cd0af18fcb89d534f55ab549..473603a1f01224fedf2e4f33b0abaa6673ccdf8e 100644 (file)
@@ -2340,7 +2340,7 @@ Interface for performing P2P (Wi-Fi Peer-to-Peer) P2P Device operations.
   </li>
 
   <li>
-    <h3>BootstrappingCompleted ( o : path, i : status )</h3>
+    <h3>BootstrappingResponse ( o : path, i : status, q : bootstrap_method )</h3>
   </li>
 
 \section dbus_bss fi.w1.wpa_supplicant1.BSS
index e7658311ea61bf6fbdf71b9b03d155f040b602f0..d0ecbd8fb845559819bd7a83c2cb64f852bddc57 100644 (file)
@@ -1357,17 +1357,19 @@ struct p2p_config {
                                 u16 bootstrap_method);
 
        /**
-        * bootstrap_completed - Indicate bootstrapping completed with P2P peer
+        * bootstrap_rsp_rx - Indicate bootstrapping response from a P2P peer
         * @ctx: Callback context from cb_ctx
         * @addr: P2P device address with which bootstrapping is completed
         * @status: P2P Status Code of bootstrapping handshake
         * @freq: Frequency in which bootstrapping is done
+        * @bootstrap_method: Bootstrapping method by the peer device
         *
         * This function can be used to notify the status of bootstrapping
         * handshake.
         */
-       void (*bootstrap_completed)(void *ctx, const u8 *addr,
-                                   enum p2p_status_code status, int freq);
+       void (*bootstrap_rsp_rx)(void *ctx, const u8 *addr,
+                                enum p2p_status_code status, int freq,
+                                u16 bootstrap_method);
 
        /**
         * validate_dira - Indicate reception of DIRA to be validated against a
index 8e0a7e49e03f9486b9b2b78ed0315f4c1aec6575..f08fa0e10909d15801f4db4db9b6da8a0d01aa6d 100644 (file)
@@ -1643,6 +1643,7 @@ static void p2p_process_prov_disc_bootstrap_resp(struct p2p_data *p2p,
        size_t cookie_len = 0;
        const u8 *pos, *cookie;
        u16 comeback_after;
+       u16 bootstrap = 0;
 
        /* Parse the P2P status present */
        if (msg->status)
@@ -1709,16 +1710,24 @@ static void p2p_process_prov_disc_bootstrap_resp(struct p2p_data *p2p,
                p2p->cfg->register_bootstrap_comeback(p2p->cfg->cb_ctx, sa,
                                                      comeback_after);
                p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
+
+               if (p2p->cfg->bootstrap_rsp_rx)
+                       p2p->cfg->bootstrap_rsp_rx(p2p->cfg->cb_ctx, sa, status,
+                                                  rx_freq, bootstrap);
                return;
        }
 
+       /* PBMA response */
+       if (msg->pbma_info_len >= 2)
+               bootstrap = WPA_GET_LE16(msg->pbma_info);
+
        p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
        if (dev->flags & P2P_DEV_PD_BEFORE_GO_NEG)
                dev->flags &= ~P2P_DEV_PD_BEFORE_GO_NEG;
 
-       if (p2p->cfg->bootstrap_completed)
-               p2p->cfg->bootstrap_completed(p2p->cfg->cb_ctx, sa, status,
-                                             rx_freq);
+       if (p2p->cfg->bootstrap_rsp_rx)
+               p2p->cfg->bootstrap_rsp_rx(p2p->cfg->cb_ctx, sa, status,
+                                          rx_freq, bootstrap);
 }
 
 
index 4269454e18ba35896ae26f9823d2cd86b9642c4b..7893f35614ba0da9d08a9f2da23192472dfe470c 100644 (file)
@@ -2386,17 +2386,18 @@ void wpas_dbus_signal_p2p_bootstrap_req(struct wpa_supplicant *wpa_s,
 
 
 /**
- * wpas_dbus_signal_p2p_bootstrap_completed - Signals BootstrappingCompleted event
- * event
+ * wpas_dbus_signal_p2p_bootstrap_rsp - Signals BootstrappingResponse event
  * @wpa_s: %wpa_supplicant network interface data
  * @src: Source address of the peer with which bootstrapping is done
  * @status: Status of Bootstrapping handshake
+ * @bootstrap_method: Peer's bootstrap method if status is success
  *
  * Sends a signal to notify that a peer P2P Device is requesting bootstrapping
  * negotiation with us.
  */
-void wpas_dbus_signal_p2p_bootstrap_completed(struct wpa_supplicant *wpa_s,
-                                             const u8 *src, int status)
+void wpas_dbus_signal_p2p_bootstrap_rsp(struct wpa_supplicant *wpa_s,
+                                       const u8 *src, int status,
+                                       u16 bootstrap_method)
 {
        DBusMessage *msg;
        DBusMessageIter iter;
@@ -2430,7 +2431,9 @@ void wpas_dbus_signal_p2p_bootstrap_completed(struct wpa_supplicant *wpa_s,
        if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
                                            &path) ||
            !dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32,
-                                           &status))
+                                           &status) ||
+           !dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT16,
+                                           &bootstrap_method))
                wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
        else
                dbus_connection_send(iface->con, msg, NULL);
index f9ff636420acd893266d9c5b0c37abf53cd2f197..d648435688d3efc808d8de86141e1eca729479be 100644 (file)
@@ -268,8 +268,9 @@ void wpas_dbus_signal_p2p_invitation_received(struct wpa_supplicant *wpa_s,
                                              int op_freq);
 void wpas_dbus_signal_p2p_bootstrap_req(struct wpa_supplicant *wpa_s,
                                        const u8 *src, u16 bootstrap_method);
-void wpas_dbus_signal_p2p_bootstrap_completed(struct wpa_supplicant *wpa_s,
-                                             const u8 *src, int status);
+void wpas_dbus_signal_p2p_bootstrap_rsp(struct wpa_supplicant *wpa_s,
+                                       const u8 *src, int status,
+                                       u16 bootstrap_method);
 void wpas_dbus_signal_mesh_group_started(struct wpa_supplicant *wpa_s,
                                         struct wpa_ssid *ssid);
 void wpas_dbus_signal_mesh_group_removed(struct wpa_supplicant *wpa_s,
@@ -650,8 +651,9 @@ void wpas_dbus_signal_p2p_bootstrap_req(struct wpa_supplicant *wpa_s,
 }
 
 static inline
-void wpas_dbus_signal_p2p_bootstrap_completed(struct wpa_supplicant *wpa_s,
-                                             const u8 *src, int status)
+void wpas_dbus_signal_p2p_bootstrap_rsp(struct wpa_supplicant *wpa_s,
+                                       const u8 *src, int status,
+                                       u16 bootstrap_method)
 {
 }
 
index 06e006963ea4985308b0fea7d0ece535c63965ac..fd8783d25924b0282782a771511d435fbf2c6df0 100644 (file)
@@ -805,10 +805,12 @@ void wpas_notify_p2p_bootstrap_req(struct wpa_supplicant *wpa_s,
        wpas_dbus_signal_p2p_bootstrap_req(wpa_s, src, bootstrap_method);
 }
 
-void wpas_notify_p2p_bootstrap_completed(struct wpa_supplicant *wpa_s,
-                                        const u8 *src, int status)
+void wpas_notify_p2p_bootstrap_rsp(struct wpa_supplicant *wpa_s,
+                                  const u8 *src, int status,
+                                  u16 bootstrap_method)
 {
-       wpas_dbus_signal_p2p_bootstrap_completed(wpa_s, src, status);
+       wpas_dbus_signal_p2p_bootstrap_rsp(wpa_s, src, status,
+                                          bootstrap_method);
 }
 
 #endif /* CONFIG_P2P */
index 7f6c345d2db42a6516e9ed0fec3638c68a4f327e..9e5047c815e958dee4f8e90e48d6bb78a9ae008d 100644 (file)
@@ -158,8 +158,9 @@ void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
                                         const u8 *bssid, int id, int op_freq);
 void wpas_notify_p2p_bootstrap_req(struct wpa_supplicant *wpa_s,
                                   const u8 *src, u16 bootstrap_method);
-void wpas_notify_p2p_bootstrap_completed(struct wpa_supplicant *wpa_s,
-                                        const u8 *src, int status);
+void wpas_notify_p2p_bootstrap_rsp(struct wpa_supplicant *wpa_s,
+                                  const u8 *src, int status,
+                                  u16 bootstrap_method);
 void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
                                    struct wpa_ssid *ssid);
 void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
index 834c1d534f9e1d9872a48aecbb01a954b4fd7528..d4b69645e139439b561172a83bb13b0de3bfcc2c 100644 (file)
@@ -5499,12 +5499,13 @@ static void wpas_bootstrap_req_rx(void *ctx, const u8 *addr,
 }
 
 
-static void wpas_bootstrap_completed(void *ctx, const u8 *addr,
-                                    enum p2p_status_code status, int freq)
+static void wpas_bootstrap_rsp_rx(void *ctx, const u8 *addr,
+                                 enum p2p_status_code status, int freq,
+                                 u16 bootstrap_method)
 {
        struct wpa_supplicant *wpa_s = ctx;
 
-       wpas_notify_p2p_bootstrap_completed(wpa_s, addr, status);
+       wpas_notify_p2p_bootstrap_rsp(wpa_s, addr, status, bootstrap_method);
 
        if (status) {
                wpa_msg_global(wpa_s, MSG_INFO,
@@ -5794,7 +5795,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
        p2p.p2p_6ghz_disable = wpa_s->conf->p2p_6ghz_disable;
        p2p.register_bootstrap_comeback = wpas_p2p_register_bootstrap_comeback;
        p2p.bootstrap_req_rx = wpas_bootstrap_req_rx;
-       p2p.bootstrap_completed = wpas_bootstrap_completed;
+       p2p.bootstrap_rsp_rx = wpas_bootstrap_rsp_rx;
        p2p.validate_dira = wpas_validate_dira;
 #ifdef CONFIG_PASN
        p2p.pasn_send_mgmt = wpas_p2p_pasn_send_mgmt;