]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P2: Enable PASN on a P2P GO
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 29 Oct 2024 22:08:21 +0000 (00:08 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 31 Oct 2024 19:44:06 +0000 (21:44 +0200)
Allow the AP SME in user space case to process PASN Authentication
frames for P2P GO.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/ap/ieee802_11.c
wpa_supplicant/p2p_supplicant.c

index 8115b68cce08d7784358447cbaaf08e59df45345..9dccdb3700b7c6c006e118dab9e5e61fcdd767a8 100644 (file)
@@ -2834,6 +2834,30 @@ static void handle_auth_pasn(struct hostapd_data *hapd, struct sta_info *sta,
                             u16 trans_seq, u16 status)
 {
        int ret;
+#ifdef CONFIG_P2P
+       struct ieee802_11_elems elems;
+
+       if (len < 24) {
+               wpa_printf(MSG_DEBUG, "PASN: Too short Management frame");
+               return;
+       }
+
+       if (ieee802_11_parse_elems(mgmt->u.auth.variable,
+                                  len - offsetof(struct ieee80211_mgmt,
+                                                 u.auth.variable),
+                                  &elems, 1) == ParseFailed) {
+               wpa_printf(MSG_DEBUG,
+                          "PASN: Failed parsing Authentication frame");
+               return;
+       }
+
+       if ((hapd->conf->p2p & (P2P_ENABLED | P2P_GROUP_OWNER)) ==
+           (P2P_ENABLED | P2P_GROUP_OWNER) &&
+           hapd->p2p && elems.p2p2_ie && elems.p2p2_ie_len) {
+               p2p_pasn_auth_rx(hapd->p2p, mgmt, len, hapd->iface->freq);
+               return;
+       }
+#endif /* CONFIG_P2P */
 
        if (hapd->conf->wpa != WPA_PROTO_RSN) {
                wpa_printf(MSG_INFO, "PASN: RSN is not configured");
index f746c338be2ffd9a554fe068fee8fa535f219750..0f3512d6f92396e1e9fb77586fb6c0ca48cbb778 100644 (file)
@@ -2380,7 +2380,7 @@ static void wpas_start_go(struct wpa_supplicant *wpa_s,
                else
                        ssid->auth_alg |= WPA_AUTH_ALG_SAE;
 
-               ssid->key_mgmt = WPA_KEY_MGMT_SAE;
+               ssid->key_mgmt = WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_PASN;
                ssid->sae_password = os_strdup(params->sae_password);
                ssid->ieee80211w = MGMT_FRAME_PROTECTION_REQUIRED;
                ssid->sae_pwe = SAE_PWE_HASH_TO_ELEMENT;
@@ -7629,7 +7629,7 @@ static int wpas_start_p2p_client(struct wpa_supplicant *wpa_s,
        }
 
        if (p2p2) {
-               ssid->key_mgmt = WPA_KEY_MGMT_SAE;
+               ssid->key_mgmt = WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_PASN;
                ssid->auth_alg = WPA_AUTH_ALG_OPEN;
                ssid->sae_pwe = SAE_PWE_HASH_TO_ELEMENT;
                ssid->ieee80211w = MGMT_FRAME_PROTECTION_REQUIRED;