[RFC PATCH 09/23] PR: Extend PR_PASN_START ctrl iface with src_addr and role

Peddolla Harshavardhan Reddy peddolla.reddy at oss.qualcomm.com
Tue Mar 31 22:26:59 PDT 2026


The PR_PASN_START control interface command had no way to
specify a source MAC address for the dedicated PR interface
or to select the PASN role.

Extend wpas_ctrl_iface_pr_pasn_start() to parse two new
optional parameters. The src_addr parameter accepts a MAC
address that is passed to wpas_pr_initiate_pasn_auth() for
use when creating the dedicated PR interface. The pasn_role
parameter accepts INITIATOR or RESPONDER and selects the
corresponding pr_pasn_role value, defaulting to INITIATOR
when omitted.

Signed-off-by: Peddolla Harshavardhan Reddy <peddolla.reddy at oss.qualcomm.com>
---
 wpa_supplicant/ctrl_iface.c    | 22 ++++++++++++++++++----
 wpa_supplicant/pr_supplicant.c |  3 ++-
 wpa_supplicant/pr_supplicant.h |  9 +++++++--
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 4dfcd73ac..6412c5278 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -11560,6 +11560,8 @@ static int wpas_ctrl_iface_pr_pasn_start(struct wpa_supplicant *wpa_s,
 	int freq = 0, forced_pr_freq = 0;
 	u8 ranging_type = 0, role = 0, auth_mode = 0;
 	bool got_addr = false;
+	u8 src_addr[ETH_ALEN], *p_src_addr = NULL;
+	enum pr_pasn_role pasn_role = PR_ROLE_PASN_INITIATOR;
 
 	while ((token = str_token(cmd, " ", &context))) {
 		if (os_strncmp(token, "addr=", 5) == 0) {
@@ -11582,6 +11584,14 @@ static int wpas_ctrl_iface_pr_pasn_start(struct wpa_supplicant *wpa_s,
 			auth_mode = atoi(token + 5);
 		} else if (os_strncmp(token, "forced_pr_freq=", 15) == 0) {
 			forced_pr_freq = atoi(token + 15);
+		} else if (os_strncmp(token, "src_addr=", 9) == 0) {
+			if (hwaddr_aton(token + 9, src_addr))
+				return -1;
+			p_src_addr = src_addr;
+		} else if (os_strcmp(token, "pasn_role=INITIATOR") == 0) {
+			pasn_role = PR_ROLE_PASN_INITIATOR;
+		} else if (os_strcmp(token, "pasn_role=RESPONDER") == 0) {
+			pasn_role = PR_ROLE_PASN_RESPONDER;
 		} else {
 			wpa_printf(MSG_DEBUG,
 				   "CTRL: PASN invalid parameter: '%s'",
@@ -11595,12 +11605,16 @@ static int wpas_ctrl_iface_pr_pasn_start(struct wpa_supplicant *wpa_s,
 			   "CTRL: Proximity Ranging PASN missing parameter");
 		return -1;
 	}
+
 	wpa_printf(MSG_DEBUG,
-		   "CTRL: PR PASN params: ranging type=0x%x, role=0x%x, auth_mode=%d, forced pr freq=%d, addr=" MACSTR,
-		   ranging_type, role, auth_mode, forced_pr_freq,
-		   MAC2STR(addr));
+		   "CTRL: PR PASN params: ranging type=0x%x, role=0x%x, "
+		   "pasn_role=%d, auth_mode=%d, forced pr freq=%d, addr="
+		   MACSTR " src_addr=" MACSTR,
+		   ranging_type, role, pasn_role, auth_mode, forced_pr_freq,
+		   MAC2STR(addr), MAC2STR(p_src_addr ? p_src_addr : addr));
 	return wpas_pr_initiate_pasn_auth(wpa_s, addr, freq, auth_mode, role,
-					  ranging_type, forced_pr_freq);
+					  ranging_type, forced_pr_freq,
+					  p_src_addr, pasn_role);
 }
 
 
diff --git a/wpa_supplicant/pr_supplicant.c b/wpa_supplicant/pr_supplicant.c
index d48fefed1..aa21ff9d2 100644
--- a/wpa_supplicant/pr_supplicant.c
+++ b/wpa_supplicant/pr_supplicant.c
@@ -596,7 +596,8 @@ fail:
 int wpas_pr_initiate_pasn_auth(struct wpa_supplicant *wpa_s,
 			       const u8 *peer_addr, int freq, u8 auth_mode,
 			       u8 ranging_role, u8 ranging_type,
-			       int forced_pr_freq)
+			       int forced_pr_freq, const u8 *src_addr,
+			       enum pr_pasn_role pasn_role)
 {
 	struct wpa_pr_pasn_auth_work *awork;
 
diff --git a/wpa_supplicant/pr_supplicant.h b/wpa_supplicant/pr_supplicant.h
index 24c369e30..ee40a9251 100644
--- a/wpa_supplicant/pr_supplicant.h
+++ b/wpa_supplicant/pr_supplicant.h
@@ -9,6 +9,8 @@
 #ifndef PR_SUPPLICANT_H
 #define PR_SUPPLICANT_H
 
+#include "common/proximity_ranging.h"
+
 #ifdef CONFIG_PR
 
 int wpas_pr_init(struct wpa_global *global, struct wpa_supplicant *wpa_s,
@@ -27,7 +29,8 @@ void wpas_pr_process_usd_elems(struct wpa_supplicant *wpa_s, const u8 *buf,
 int wpas_pr_initiate_pasn_auth(struct wpa_supplicant *wpa_s,
 			       const u8 *peer_addr, int freq, u8 auth_mode,
 			       u8 ranging_role, u8 ranging_type,
-			       int forced_pr_freq);
+			       int forced_pr_freq, const u8 *src_addr,
+			       enum pr_pasn_role pasn_role);
 int wpas_pr_pasn_auth_tx_status(struct wpa_supplicant *wpa_s, const u8 *data,
 				size_t data_len, bool acked);
 int wpas_pr_pasn_auth_rx(struct wpa_supplicant *wpa_s,
@@ -74,7 +77,9 @@ static inline int wpas_pr_initiate_pasn_auth(struct wpa_supplicant *wpa_s,
 					     const u8 *peer_addr, int freq,
 					     u8 auth_mode, u8 ranging_role,
 					     u8 ranging_type,
-					     int forced_pr_freq)
+					     int forced_pr_freq,
+					     const u8 *src_addr,
+					     enum pr_pasn_role pasn_role)
 {
 	return 0;
 }
-- 
2.34.1




More information about the Hostap mailing list