[PATCH v3 22/36] PR: Add support to handle PR PASN auth rx frame
Peddolla Harshavardhan Reddy
peddolla at qti.qualcomm.com
Thu Aug 28 08:42:57 PDT 2025
Add changes to handle to received PR PASN auth frame.
If proximity ranging IE is present in the PASN frame, it is processed
by proximity ranging API's.
Signed-off-by: Peddolla Harshavardhan Reddy <peddolla at qti.qualcomm.com>
---
src/common/proximity_ranging.c | 32 ++++++++++++++++++++++++++++++++
src/common/proximity_ranging.h | 2 ++
wpa_supplicant/events.c | 4 +++-
wpa_supplicant/pr_supplicant.c | 12 ++++++++++++
wpa_supplicant/pr_supplicant.h | 10 ++++++++++
5 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/src/common/proximity_ranging.c b/src/common/proximity_ranging.c
index 448aea4c7..b21cfc3bb 100644
--- a/src/common/proximity_ranging.c
+++ b/src/common/proximity_ranging.c
@@ -1495,4 +1495,36 @@ int pr_pasn_auth_tx_status(struct pr_data *pr, const u8 *data, size_t data_len,
return 0;
}
+
+int pr_pasn_auth_rx(struct pr_data *pr, const struct ieee80211_mgmt *mgmt,
+ size_t len, int freq)
+{
+ struct pr_device *dev;
+ u16 auth_alg;
+
+ dev = pr_get_device(pr, mgmt->sa);
+ if (!dev) {
+ wpa_printf(MSG_ERROR, "PR: Peer not found " MACSTR,
+ MAC2STR(mgmt->sa));
+ return -1;
+ }
+
+ if (os_memcmp(mgmt->da, pr->cfg->dev_addr, ETH_ALEN) != 0) {
+ wpa_printf(MSG_ERROR, "PR PASN: Not our frame");
+ return -1;
+ }
+
+ if (len < offsetof(struct ieee80211_mgmt, u.auth.variable))
+ return -1;
+
+ auth_alg = le_to_host16(mgmt->u.auth.auth_alg);
+ if (auth_alg != WLAN_AUTH_PASN) {
+ wpa_printf(MSG_ERROR,
+ "PR: Unexpected AUTH frame, auth_alg=%d", auth_alg);
+ return -1;
+ }
+
+ return 0;
+}
+
#endif /* CONFIG_PASN */
diff --git a/src/common/proximity_ranging.h b/src/common/proximity_ranging.h
index 81d95f2b4..6e6d1d00d 100644
--- a/src/common/proximity_ranging.h
+++ b/src/common/proximity_ranging.h
@@ -461,5 +461,7 @@ int pr_initiate_pasn_auth(struct pr_data *pr, const u8 *addr, int freq,
int forced_pr_freq);
int pr_pasn_auth_tx_status(struct pr_data *pr, const u8 *data, size_t data_len,
bool acked);
+int pr_pasn_auth_rx(struct pr_data *pr, const struct ieee80211_mgmt *mgmt,
+ size_t len, int freq);
#endif /* PROXIMITY_RANGING_H */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index afd5df18a..d52b22136 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -6227,7 +6227,6 @@ static int wpas_pasn_auth(struct wpa_supplicant *wpa_s,
const struct ieee80211_mgmt *mgmt, size_t len,
int freq)
{
-#ifdef CONFIG_P2P
struct ieee802_11_elems elems;
size_t auth_length;
@@ -6253,9 +6252,12 @@ static int wpas_pasn_auth(struct wpa_supplicant *wpa_s,
return -2;
}
+#ifdef CONFIG_P2P
if (elems.p2p2_ie && elems.p2p2_ie_len)
return wpas_p2p_pasn_auth_rx(wpa_s, mgmt, len, freq);
#endif /* CONFIG_P2P */
+ if (elems.proximity_ranging && elems.proximity_ranging_len)
+ return wpas_pr_pasn_auth_rx(wpa_s, mgmt, len, freq);
return wpas_pasn_auth_rx(wpa_s, mgmt, len);
}
diff --git a/wpa_supplicant/pr_supplicant.c b/wpa_supplicant/pr_supplicant.c
index 5dbe773de..db0d8aa47 100644
--- a/wpa_supplicant/pr_supplicant.c
+++ b/wpa_supplicant/pr_supplicant.c
@@ -525,4 +525,16 @@ int wpas_pr_pasn_auth_tx_status(struct wpa_supplicant *wpa_s, const u8 *data,
return pr_pasn_auth_tx_status(pr, data, data_len, acked);
}
+
+int wpas_pr_pasn_auth_rx(struct wpa_supplicant *wpa_s,
+ const struct ieee80211_mgmt *mgmt, size_t len,
+ int freq)
+{
+ struct pr_data *pr = wpa_s->global->pr;
+
+ if (!pr)
+ return -2;
+ return pr_pasn_auth_rx(pr, mgmt, len, freq);
+}
+
#endif /* CONFIG_PASN */
diff --git a/wpa_supplicant/pr_supplicant.h b/wpa_supplicant/pr_supplicant.h
index 3ec81cc8d..633de38b6 100644
--- a/wpa_supplicant/pr_supplicant.h
+++ b/wpa_supplicant/pr_supplicant.h
@@ -28,6 +28,9 @@ int wpas_pr_initiate_pasn_auth(struct wpa_supplicant *wpa_s,
int forced_pr_freq);
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,
+ const struct ieee80211_mgmt *mgmt, size_t len,
+ int freq);
#else /* CONFIG_PR */
static inline int wpas_pr_init(struct wpa_global *global,
struct wpa_supplicant *wpa_s)
@@ -71,6 +74,13 @@ static inline int wpas_pr_pasn_auth_tx_status(struct wpa_supplicant *wpa_s,
return 0;
}
+static inline int wpas_pr_pasn_auth_rx(struct wpa_supplicant *wpa_s,
+ const struct ieee80211_mgmt *mgmt,
+ size_t len, int freq)
+{
+ return 0;
+}
+
#endif /* CONFIG_PR */
#endif /*PR_SUPPLICANT_H */
--
2.34.1
More information about the Hostap
mailing list