[RFC PATCH v2 20/23] PR: Extend PR_PASN_START ctrl iface with full ranging parameters
Peddolla Harshavardhan Reddy
peddolla.reddy at oss.qualcomm.com
Thu Apr 2 05:24:25 PDT 2026
Currently, the PR_PASN_START control interface command calls
wpas_pr_initiate_pasn_auth() directly with a small fixed set
of parameters, making it impossible to configure the ranging
session beyond basic PASN authentication.
Refactor wpas_ctrl_iface_pr_pasn_start() to build a
pr_pasn_ranging_params structure and route through
wpas_pr_pasn_trigger(), which performs capability validation
before initiating PASN. Extend the command to accept EDCA
burst parameters (burst_period, num_bursts_exp, ftms_per_burst,
ftmr_retries, burst_duration), NTB availability window settings
(min/max_time_between_meas, availability_window, nominal_time,
measurements_per_aw), proximity thresholds (ingress_threshold,
egress_threshold), lmr_feedback, pd_suppress_results, and a
continuous_session_time for session lifetime control.
Signed-off-by: Peddolla Harshavardhan Reddy <peddolla.reddy at oss.qualcomm.com>
---
wpa_supplicant/ctrl_iface.c | 93 +++++++++++++++++++++++++------------
1 file changed, 64 insertions(+), 29 deletions(-)
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 6412c5278..e971db3d6 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -11556,65 +11556,98 @@ static int wpas_ctrl_iface_pr_pasn_start(struct wpa_supplicant *wpa_s,
char *cmd)
{
char *token, *context = NULL;
- u8 addr[ETH_ALEN];
- int freq = 0, forced_pr_freq = 0;
- u8 ranging_type = 0, role = 0, auth_mode = 0;
+ struct pr_pasn_ranging_params params;
bool got_addr = false;
- u8 src_addr[ETH_ALEN], *p_src_addr = NULL;
- enum pr_pasn_role pasn_role = PR_ROLE_PASN_INITIATOR;
+
+ os_memset(¶ms, 0, sizeof(params));
+ params.action = PR_PASN_AND_RANGING;
while ((token = str_token(cmd, " ", &context))) {
if (os_strncmp(token, "addr=", 5) == 0) {
- if (hwaddr_aton(token + 5, addr))
+ if (hwaddr_aton(token + 5, params.peer_addr))
return -1;
got_addr = true;
} else if (os_strcmp(token, "role=ISTA") == 0) {
- role |= PR_ISTA_SUPPORT;
+ params.ranging_role |= PR_ISTA_SUPPORT;
} else if (os_strcmp(token, "role=RSTA") == 0) {
- role |= PR_RSTA_SUPPORT;
+ params.ranging_role |= PR_RSTA_SUPPORT;
} else if (os_strcmp(token, "ranging_type=EDCA") == 0) {
- ranging_type |= PR_EDCA_BASED_RANGING;
+ params.ranging_type |= PR_EDCA_BASED_RANGING;
} else if (os_strcmp(token, "ranging_type=NTB-OPEN-PHY") == 0) {
- ranging_type |= PR_NTB_OPEN_BASED_RANGING;
+ params.ranging_type |= PR_NTB_OPEN_BASED_RANGING;
} else if (os_strcmp(token, "ranging_type=NTB-SEC-PHY") == 0) {
- ranging_type |= PR_NTB_SECURE_LTF_BASED_RANGING;
+ params.ranging_type |= PR_NTB_SECURE_LTF_BASED_RANGING;
} else if (os_strncmp(token, "freq=", 5) == 0) {
- freq = atoi(token + 5);
+ params.freq = atoi(token + 5);
} else if (os_strncmp(token, "auth=", 5) == 0) {
- auth_mode = atoi(token + 5);
+ params.auth_mode = atoi(token + 5);
} else if (os_strncmp(token, "forced_pr_freq=", 15) == 0) {
- forced_pr_freq = atoi(token + 15);
+ params.forced_pr_freq = atoi(token + 15);
+ } else if (os_strncmp(token, "burst_period=", 13) == 0) {
+ params.burst_period = atoi(token + 13);
+ } else if (os_strncmp(token, "num_bursts_exp=", 15) == 0) {
+ params.num_bursts_exp = atoi(token + 15);
+ } else if (os_strncmp(token, "ftms_per_burst=", 15) == 0) {
+ params.ftms_per_burst = atoi(token + 15);
+ } else if (os_strncmp(token, "ftmr_retries=", 13) == 0) {
+ params.ftmr_retries = atoi(token + 13);
+ } else if (os_strncmp(token, "burst_duration=", 15) == 0) {
+ params.burst_duration = atoi(token + 15);
+ } else if (os_strncmp(token, "min_time_between_meas=", 22) == 0) {
+ params.min_time_between_measurements = atoi(token + 22);
+ } else if (os_strncmp(token, "max_time_between_meas=", 22) == 0) {
+ params.max_time_between_measurements = atoi(token + 22);
+ } else if (os_strncmp(token, "availability_window=", 20) == 0) {
+ params.availability_window = atoi(token + 20);
+ } else if (os_strncmp(token, "nominal_time=", 13) == 0) {
+ params.nominal_time = atoi(token + 13);
+ } else if (os_strncmp(token, "measurements_per_aw=", 20) == 0) {
+ params.measurements_per_aw = atoi(token + 20);
+ } else if (os_strcmp(token, "request_lci=1") == 0) {
+ params.request_lci = true;
+ } else if (os_strcmp(token, "request_civicloc=1") == 0) {
+ params.request_civicloc = true;
+ } else if (os_strncmp(token, "continuous_session_time=", 24) == 0) {
+ params.continuous_ranging_session_time = atoi(token + 24);
} else if (os_strncmp(token, "src_addr=", 9) == 0) {
- if (hwaddr_aton(token + 9, src_addr))
+ if (hwaddr_aton(token + 9, params.src_addr))
return -1;
- p_src_addr = src_addr;
} else if (os_strcmp(token, "pasn_role=INITIATOR") == 0) {
- pasn_role = PR_ROLE_PASN_INITIATOR;
+ params.pasn_role = PR_ROLE_PASN_INITIATOR;
} else if (os_strcmp(token, "pasn_role=RESPONDER") == 0) {
- pasn_role = PR_ROLE_PASN_RESPONDER;
+ params.pasn_role = PR_ROLE_PASN_RESPONDER;
+ } else if (os_strcmp(token, "lmr_feedback=1") == 0) {
+ params.lmr_feedback = true;
+ } else if (os_strncmp(token, "ingress_threshold=", 18) == 0) {
+ params.ingress_threshold = atoll(token + 18);
+ } else if (os_strncmp(token, "egress_threshold=", 17) == 0) {
+ params.egress_threshold = atoll(token + 17);
+ } else if (os_strcmp(token, "pd_suppress_results=1") == 0) {
+ params.pr_suppress_results = true;
} else {
wpa_printf(MSG_DEBUG,
- "CTRL: PASN invalid parameter: '%s'",
+ "CTRL: PR_PASN_START invalid parameter: '%s'",
token);
return -1;
}
}
- if (!got_addr || ranging_type == 0 || role == 0 || freq == 0) {
+ if (!got_addr || params.ranging_type == 0 || params.ranging_role == 0 ||
+ params.freq == 0) {
wpa_printf(MSG_DEBUG,
- "CTRL: Proximity Ranging PASN missing parameter");
+ "CTRL: PR_PASN_START missing parameter");
return -1;
}
wpa_printf(MSG_DEBUG,
- "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,
- p_src_addr, pasn_role);
+ "CTRL: PR_PASN_START params: ranging type=0x%x, role=0x%x,"
+ " auth_mode=%d, freq=%d, addr=" MACSTR " src_addr=" MACSTR " pasn_role=%d",
+ params.ranging_type, params.ranging_role, params.auth_mode,
+ params.freq, MAC2STR(params.peer_addr),
+ MAC2STR(params.src_addr), params.pasn_role);
+
+ wpas_pr_pasn_trigger(wpa_s, ¶ms);
+ return 0;
}
@@ -11669,6 +11702,8 @@ fail:
return ret;
}
+
+
#endif /* CONFIG_PR */
--
2.34.1
More information about the Hostap
mailing list