From: Shivani Baranwal Date: Sun, 4 Aug 2024 21:13:59 +0000 (+0530) Subject: P2P2: PASN Authentication frame TX status handling X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e061a909080aee5610a088681c66cbf94aa26eb;p=thirdparty%2Fhostap.git P2P2: PASN Authentication frame TX status handling Handle PASN Authentication frame TX status in cases where this is for the P2P2 specific use of PASN. Signed-off-by: Shivani Baranwal --- diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 3415e96dd..e109e320c 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -6419,6 +6419,46 @@ out: } +int p2p_pasn_auth_tx_status(struct p2p_data *p2p, const u8 *data, + size_t data_len, bool acked) +{ + int ret = 0; + struct p2p_device *dev; + struct pasn_data *pasn; + const struct ieee80211_mgmt *mgmt = + (const struct ieee80211_mgmt *) data; + + if (!p2p) + return -1; + + dev = p2p_get_device(p2p, mgmt->da); + if (!dev || !dev->pasn) { + p2p_dbg(p2p, "P2P PASN: Peer not found " MACSTR, + MAC2STR(mgmt->da)); + return -1; + } + + pasn = dev->pasn; + + 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; + + if (ret != 1) + return ret; + + if (dev == p2p->go_neg_peer) + p2p_go_complete(p2p, dev); + + return 0; +} + + static int p2p_handle_pasn_auth(struct p2p_data *p2p, struct p2p_device *dev, const struct ieee80211_mgmt *mgmt, size_t len, int freq) diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 480515f16..56b80d89e 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -2580,5 +2580,7 @@ int p2p_initiate_pasn_auth(struct p2p_data *p2p, const u8 *addr, int freq); int p2p_pasn_auth_rx(struct p2p_data *p2p, const struct ieee80211_mgmt *mgmt, size_t len, int freq); int p2p_prepare_data_element(struct p2p_data *p2p, const u8 *peer_addr); +int p2p_pasn_auth_tx_status(struct p2p_data *p2p, const u8 *data, + size_t data_len, bool acked); #endif /* P2P_H */ diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index d09d26129..7947b6f08 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -6362,6 +6362,17 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, break; #endif /* CONFIG_WNM */ #ifdef CONFIG_PASN +#ifdef CONFIG_P2P + if (data->tx_status.type == WLAN_FC_TYPE_MGMT && + data->tx_status.stype == WLAN_FC_STYPE_AUTH && + !wpa_s->pasn_auth_work && + wpa_s->p2p_pasn_auth_work && + wpas_p2p_pasn_auth_tx_status(wpa_s, + data->tx_status.data, + data->tx_status.data_len, + data->tx_status.ack) == 0) + break; +#endif /* CONFIG_P2P */ 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/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 3418aa512..1e9d480d5 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -10493,6 +10493,7 @@ void wpas_p2p_process_usd_elems(struct wpa_supplicant *wpa_s, const u8 *buf, #ifdef CONFIG_PASN + int wpas_p2p_pasn_auth_rx(struct wpa_supplicant *wpa_s, const struct ieee80211_mgmt *mgmt, size_t len, int freq) @@ -10503,4 +10504,14 @@ int wpas_p2p_pasn_auth_rx(struct wpa_supplicant *wpa_s, return -2; return p2p_pasn_auth_rx(p2p, mgmt, len, freq); } + + +int wpas_p2p_pasn_auth_tx_status(struct wpa_supplicant *wpa_s, const u8 *data, + size_t data_len, bool acked) +{ + struct p2p_data *p2p = wpa_s->global->p2p; + + return p2p_pasn_auth_tx_status(p2p, data, data_len, acked); +} + #endif /* CONFIG_PASN */ diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index 0488de46b..7a07ab0b6 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -182,6 +182,8 @@ int wpas_p2p_try_edmg_channel(struct wpa_supplicant *wpa_s, void wpas_p2p_process_usd_elems(struct wpa_supplicant *wpa_s, const u8 *buf, u16 buf_len, const u8 *peer_addr, unsigned int freq); +int wpas_p2p_pasn_auth_tx_status(struct wpa_supplicant *wpa_s, const u8 *data, + size_t data_len, bool acked); #ifdef CONFIG_P2P