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@xxxxxxxxxxxxxxxx> --- 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 80e6b8b22..98ede4ac9 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 0ed9fa65e..fe9deb6e6 100644 --- a/src/common/proximity_ranging.h +++ b/src/common/proximity_ranging.h @@ -431,5 +431,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 ddc099572..16bd26097 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -6220,7 +6220,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; if (len < 24) { @@ -6237,9 +6236,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 8450ed571..b9fb60076 100644 --- a/wpa_supplicant/pr_supplicant.c +++ b/wpa_supplicant/pr_supplicant.c @@ -359,4 +359,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 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap