[RFC PATCH 27/34] Add support to notify PR PASN result on initiator and responder

Peddolla Harshavardhan Reddy peddolla at qti.qualcomm.com
Thu May 15 00:17:50 PDT 2025


Signed-off-by: Peddolla Harshavardhan Reddy <peddolla at qti.qualcomm.com>
---
 src/common/proximity_ranging.c |  9 +++++++++
 src/common/proximity_ranging.h |  2 ++
 src/common/wpa_ctrl.h          |  5 +++++
 wpa_supplicant/notify.c        | 10 ++++++++++
 wpa_supplicant/notify.h        |  4 +++-
 wpa_supplicant/pr_supplicant.c | 11 +++++++++++
 6 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/src/common/proximity_ranging.c b/src/common/proximity_ranging.c
index 8a4abbfd4..16544c6ae 100644
--- a/src/common/proximity_ranging.c
+++ b/src/common/proximity_ranging.c
@@ -1926,6 +1926,10 @@ int pr_pasn_auth_tx_status(struct pr_data *pr, const u8 *data, size_t data_len,
 		return pasn->send_mgmt(pasn->cb_ctx, wpabuf_head(pasn->frame),
 				       wpabuf_len(pasn->frame), 0, pasn->freq,
 				       1000);
+	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;
 
@@ -2332,6 +2336,11 @@ static int pr_pasn_handle_auth_3(struct pr_data *pr, struct pr_device *dev,
 		wpa_printf(MSG_ERROR, "PR PASN: Handle Auth3 failed");
 		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:
 
diff --git a/src/common/proximity_ranging.h b/src/common/proximity_ranging.h
index f0c6387a7..93ec99960 100644
--- a/src/common/proximity_ranging.h
+++ b/src/common/proximity_ranging.h
@@ -360,6 +360,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);
diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
index 90c67490d..9799cf8d3 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
@@ -467,6 +467,11 @@ extern "C" {
 /* PASN authentication status */
 #define PASN_AUTH_STATUS "PASN-AUTH-STATUS "
 
+/* Result of PASN performed for Proximity Ranging
+ * <role> <protocol type> <op class> <op channel>
+ */
+#define PR_PASN_RESULT "PR-PASN-RESULT "
+
 /* BSS command information masks */
 
 #define WPA_BSS_MASK_ALL		0xFFFDFFFF
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index fd8783d25..bac25c111 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -1208,3 +1208,13 @@ 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=%s",
+	       role, protocol_type, op_class, op_channel, country);
+}
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index 9e5047c81..ea27875f5 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -204,5 +204,7 @@ 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 */
diff --git a/wpa_supplicant/pr_supplicant.c b/wpa_supplicant/pr_supplicant.c
index f0ddb5fcc..ab5ac853d 100644
--- a/wpa_supplicant/pr_supplicant.c
+++ b/wpa_supplicant/pr_supplicant.c
@@ -85,6 +85,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)
@@ -171,6 +181,7 @@ int wpas_pr_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
 	pr.support_6ghz = false;
 
 	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;
 
-- 
2.34.1




More information about the Hostap mailing list