]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P2: PASN Authentication frame TX status handling
authorShivani Baranwal <quic_shivbara@quicinc.com>
Sun, 4 Aug 2024 21:13:59 +0000 (02:43 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 27 Sep 2024 09:44:30 +0000 (12:44 +0300)
Handle PASN Authentication frame TX status in cases where this is for
the P2P2 specific use of PASN.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
src/p2p/p2p.c
src/p2p/p2p.h
wpa_supplicant/events.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/p2p_supplicant.h

index 3415e96dd0aa96e3e19822f5377804255214495b..e109e320ca8e6e19d0a7a7221a10c7fdd04b9005 100644 (file)
@@ -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)
index 480515f164f1f27d07d8ad02b11d4288e6cc8144..56b80d89eb484b15ad30611ead4a77df687d3f8b 100644 (file)
@@ -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 */
index d09d2612904aa8192f6cfa580244ad21b9aa7a61..7947b6f089d3c4c81ef8920d6597a61c9c56341b 100644 (file)
@@ -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,
index 3418aa5128a2c912436faf407557c1ff45058785..1e9d480d51f94ef5fb0cf6388e1e63e117bee904 100644 (file)
@@ -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 */
index 0488de46b93d7228c49c1f9cbec05a2b16b344e0..7a07ab0b6a62d49e1f12f77da939ced640028774 100644 (file)
@@ -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