Add changes to check if an ACK is received for transmitted PASN frame that contains Proximity Ranging IE's. Signed-off-by: Peddolla Harshavardhan Reddy <peddolla@xxxxxxxxxxxxxxxx> --- src/common/proximity_ranging.c | 35 ++++++++++++++++++++++++++++++++++ src/common/proximity_ranging.h | 2 ++ wpa_supplicant/events.c | 12 ++++++++++++ wpa_supplicant/pr_supplicant.c | 12 ++++++++++++ wpa_supplicant/pr_supplicant.h | 9 +++++++++ 5 files changed, 70 insertions(+) diff --git a/src/common/proximity_ranging.c b/src/common/proximity_ranging.c index 3d2c90222..80e6b8b22 100644 --- a/src/common/proximity_ranging.c +++ b/src/common/proximity_ranging.c @@ -1460,4 +1460,39 @@ out: return ret; } + +int pr_pasn_auth_tx_status(struct pr_data *pr, const u8 *data, size_t data_len, + bool acked) +{ + int ret = 0; + struct pr_device *dev; + struct pasn_data *pasn; + const struct ieee80211_mgmt *mgmt = + (const struct ieee80211_mgmt *) data; + + if (!pr) + return -1; + + dev = pr_get_device(pr, mgmt->da); + if (!dev || !dev->pasn) { + wpa_printf(MSG_DEBUG, "PR PASN: Peer not found " MACSTR, + MAC2STR(mgmt->da)); + return -1; + } + + pasn = dev->pasn; + wpa_printf(MSG_DEBUG, "PR PASN: ACK received From " MACSTR, + MAC2STR(mgmt->da)); + + ret = wpa_pasn_auth_tx_status(pasn, data, data_len, acked); + if (ret != 1 && !acked && pasn->frame) + return pasn->send_mgmt(pasn->cb_ctx, wpabuf_head(pasn->frame), + wpabuf_len(pasn->frame), 0, pasn->freq, + 1000); + wpabuf_free(pasn->frame); + pasn->frame = NULL; + + return 0; +} + #endif /* CONFIG_PASN */ diff --git a/src/common/proximity_ranging.h b/src/common/proximity_ranging.h index 498697828..0ed9fa65e 100644 --- a/src/common/proximity_ranging.h +++ b/src/common/proximity_ranging.h @@ -429,5 +429,7 @@ void pr_process_usd_elems(struct pr_data *pr, const u8 *ies, u16 ies_len, int pr_initiate_pasn_auth(struct pr_data *pr, const u8 *addr, int freq, u8 auth_mode, u8 ranging_role, u8 ranging_type, int forced_pr_freq); +int pr_pasn_auth_tx_status(struct pr_data *pr, const u8 *data, size_t data_len, + bool acked); #endif /* PROXIMITY_RANGING_H */ diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 00b733a1c..ddc099572 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -53,6 +53,7 @@ #include "wmm_ac.h" #include "nan_usd.h" #include "dpp_supplicant.h" +#include "pr_supplicant.h" #define MAX_OWE_TRANSITION_BSS_SELECT_COUNT 5 @@ -6485,6 +6486,17 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, data->tx_status.ack) == 0) break; #endif /* CONFIG_P2P */ +#ifdef CONFIG_PR + if (data->tx_status.type == WLAN_FC_TYPE_MGMT && + data->tx_status.stype == WLAN_FC_STYPE_AUTH && + !wpa_s->pasn_auth_work && + wpa_s->pr_pasn_auth_work && + wpas_pr_pasn_auth_tx_status(wpa_s, + data->tx_status.data, + data->tx_status.data_len, + data->tx_status.ack) == 0) + break; +#endif /* CONFIG_PR */ if (data->tx_status.type == WLAN_FC_TYPE_MGMT && data->tx_status.stype == WLAN_FC_STYPE_AUTH && wpas_pasn_auth_tx_status(wpa_s, data->tx_status.data, diff --git a/wpa_supplicant/pr_supplicant.c b/wpa_supplicant/pr_supplicant.c index 00ab9f341..8450ed571 100644 --- a/wpa_supplicant/pr_supplicant.c +++ b/wpa_supplicant/pr_supplicant.c @@ -347,4 +347,16 @@ int wpas_pr_initiate_pasn_auth(struct wpa_supplicant *wpa_s, return 0; } + +int wpas_pr_pasn_auth_tx_status(struct wpa_supplicant *wpa_s, const u8 *data, + size_t data_len, bool acked) +{ + struct pr_data *pr = wpa_s->global->pr; + + if (!wpa_s->pr_pasn_auth_work) + return -1; + + return pr_pasn_auth_tx_status(pr, data, data_len, acked); +} + #endif /* CONFIG_PASN */ diff --git a/wpa_supplicant/pr_supplicant.h b/wpa_supplicant/pr_supplicant.h index 499f640e9..3ec81cc8d 100644 --- a/wpa_supplicant/pr_supplicant.h +++ b/wpa_supplicant/pr_supplicant.h @@ -26,6 +26,8 @@ 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 wpas_pr_pasn_auth_tx_status(struct wpa_supplicant *wpa_s, const u8 *data, + size_t data_len, bool acked); #else /* CONFIG_PR */ static inline int wpas_pr_init(struct wpa_global *global, struct wpa_supplicant *wpa_s) @@ -62,6 +64,13 @@ static inline int wpas_pr_initiate_pasn_auth(struct wpa_supplicant *wpa_s, return 0; } +static inline int wpas_pr_pasn_auth_tx_status(struct wpa_supplicant *wpa_s, + const u8 *data, size_t data_len, + bool acked) +{ + return 0; +} + #endif /* CONFIG_PR */ #endif /*PR_SUPPLICANT_H */ -- 2.34.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap