]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
PR: Notify PR PASN result on initiator and responder
authorPeddolla Harshavardhan Reddy <peddolla@qti.qualcomm.com>
Sat, 26 Apr 2025 21:43:54 +0000 (03:13 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 17 Oct 2025 10:22:52 +0000 (13:22 +0300)
Add callbacks and changes to notify Proximity Ranging negotiation result
done as part of PASN.

Signed-off-by: Peddolla Harshavardhan Reddy <peddolla@qti.qualcomm.com>
src/common/proximity_ranging.c
src/common/proximity_ranging.h
src/common/wpa_ctrl.h
wpa_supplicant/notify.c
wpa_supplicant/notify.h
wpa_supplicant/pr_supplicant.c

index 25e66f76b43b881c106dc99a682fd2f5d866201f..fe36f27f49e48b6c9e6eb8eea9556b29d1342824 100644 (file)
@@ -1976,6 +1976,10 @@ int pr_pasn_auth_tx_status(struct pr_data *pr, const u8 *data, size_t data_len,
                   MAC2STR(mgmt->da), acked);
 
        ret = wpa_pasn_auth_tx_status(pasn, data, data_len, acked);
+       if (ret == 1 && acked && pr->cfg->pasn_result)
+               pr->cfg->pasn_result(pr->cfg->cb_ctx, dev->ranging_role,
+                                    dev->protocol_type, dev->final_op_class,
+                                    dev->final_op_channel, pr->cfg->country);
        wpabuf_free(pasn->frame);
        pasn->frame = NULL;
 
@@ -2402,6 +2406,11 @@ static int pr_pasn_handle_auth_3(struct pr_data *pr, struct pr_device *dev,
                wpa_printf(MSG_INFO, "PR PASN: Failed to handle Auth3");
                goto fail;
        }
+
+       if (pr->cfg->pasn_result)
+               pr->cfg->pasn_result(pr->cfg->cb_ctx, dev->ranging_role,
+                                    dev->protocol_type, dev->final_op_class,
+                                    dev->final_op_channel, pr->cfg->country);
        return 0;
 
 fail:
index 29a865ef818921893ea03d0c1a1ade1320a87d9d..22794cc1904ecd380cc8c2de4bca26c3574257b3 100644 (file)
@@ -425,6 +425,8 @@ struct pr_config {
        int (*pasn_send_mgmt)(void *ctx, const u8 *data, size_t data_len,
                              int noack, unsigned int freq, unsigned int wait);
 
+       void (*pasn_result)(void *ctx, u8 role, u8 protocol_type, u8 op_class,
+                           u8 op_channel, const char *country);
 
        void (*set_keys)(void *ctx, const u8 *own_addr, const u8 *peer_addr,
                         int cipher, int akmp, struct wpa_ptk *ptk);
index ae5711aa6b697435990b4f7b408b1cbaa49af96d..2cb81d3405bf7d444d88b224f52af6d0c39efda1 100644 (file)
@@ -471,6 +471,11 @@ extern "C" {
 /* PASN authentication status */
 #define PASN_AUTH_STATUS "PASN-AUTH-STATUS "
 
+/* Result of PASN performed for Proximity Ranging
+ * <result> role=<role> protocol=<protocol type> opclass=<op class> channel=<op channel> cc=<country>
+ */
+#define PR_PASN_RESULT "PR-PASN-RESULT "
+
 /* BSS command information masks */
 
 #define WPA_BSS_MASK_ALL               0xFFFDFFFF
index 0827e51dec990d98f6fd33db39fccc478647c4af..f5d80f877239a5521bf9e353a65ad2fbd07150c1 100644 (file)
@@ -1208,3 +1208,14 @@ void wpas_notify_nan_subscribe_terminated(struct wpa_supplicant *wpa_s,
 }
 
 #endif /* CONFIG_NAN_USD */
+
+
+void wpas_notify_pr_pasn_result(struct wpa_supplicant *wpa_s, u8 role,
+                               u8 protocol_type, u8 op_class, u8 op_channel,
+                               const char *country)
+{
+       wpa_msg_global(wpa_s, MSG_INFO, PR_PASN_RESULT
+                      "SUCCESS role=%u protocol=%u opclass=%u channel=%u cc=%c%c",
+                      role, protocol_type, op_class, op_channel,
+                      country[0], country[1]);
+}
index 9e5047c815e958dee4f8e90e48d6bb78a9ae008d..284a518abbf0b376aa5e698f5d9bdb0ab1b35433 100644 (file)
@@ -204,5 +204,8 @@ void wpas_notify_nan_publish_terminated(struct wpa_supplicant *wpa_s,
 void wpas_notify_nan_subscribe_terminated(struct wpa_supplicant *wpa_s,
                                          int subscribe_id,
                                          enum nan_de_reason reason);
+void wpas_notify_pr_pasn_result(struct wpa_supplicant *wpa_s, u8 role,
+                               u8 protocol_type, u8 op_class, u8 op_channel,
+                               const char *country);
 
 #endif /* NOTIFY_H */
index 539a3d9453e67415a1832e85ee57fc0713393e40..aa20cff010ed541eee184a61d5e35882be15f535 100644 (file)
@@ -15,6 +15,7 @@
 #include "p2p/p2p.h"
 #include "wpa_supplicant_i.h"
 #include "config.h"
+#include "notify.h"
 #include "driver_i.h"
 #include "pr_supplicant.h"
 
@@ -256,6 +257,16 @@ static int wpas_pr_pasn_send_mgmt(void *ctx, const u8 *data, size_t data_len,
 }
 
 
+static void wpas_pr_pasn_result(void *ctx, u8 role, u8 protocol_type,
+                               u8 op_class, u8 op_channel, const char *country)
+{
+       struct wpa_supplicant *wpa_s = ctx;
+
+       wpas_notify_pr_pasn_result(wpa_s, role, protocol_type, op_class,
+                                  op_channel, country);
+}
+
+
 static void wpas_pr_pasn_set_keys(void *ctx, const u8 *own_addr,
                                  const u8 *peer_addr, int cipher, int akmp,
                                  struct wpa_ptk *ptk)
@@ -345,6 +356,7 @@ int wpas_pr_init(struct wpa_global *global, struct wpa_supplicant *wpa_s,
        pr.support_6ghz = wpas_is_6ghz_supported(wpa_s, true);
 
        pr.pasn_send_mgmt = wpas_pr_pasn_send_mgmt;
+       pr.pasn_result = wpas_pr_pasn_result;
        pr.set_keys = wpas_pr_pasn_set_keys;
        pr.clear_keys = wpas_pr_pasn_clear_keys;