]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P2: Store WPA3 connection credentials in the configuration
authorShivani Baranwal <quic_shivbara@quicinc.com>
Mon, 18 Nov 2024 06:00:26 +0000 (11:30 +0530)
committerJouni Malinen <j@w1.fi>
Tue, 19 Nov 2024 21:46:22 +0000 (23:46 +0200)
Persistent connection details were stored only for WPA2-PSK mode. Enable
the storage of WPA3 sae_password, authentication algorithm, key
management, and protocol type. Also, allow credentials without
sae_password for the pmk_valid case.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
wpa_supplicant/config_file.c
wpa_supplicant/p2p_supplicant.c

index b250eabb7556aaeec4bd723fc2df8f2211276554..5d60af04adb2b7e6b7d52477fbb2b04059850e86 100644 (file)
@@ -1818,7 +1818,8 @@ int wpa_config_write(const char *name, struct wpa_config *config)
                    !ssid->psk_set && !ssid->passphrase)
                        continue; /* do not save invalid network */
                if (wpa_key_mgmt_sae(ssid->key_mgmt) &&
-                   !ssid->passphrase && !ssid->sae_password)
+                   !ssid->passphrase && !ssid->sae_password &&
+                   !ssid->pmk_valid)
                        continue; /* do not save invalid network */
                fprintf(f, "\nnetwork={\n");
                wpa_config_write_network(f, ssid);
index 8125b04693d19d85bbce8d33ba4aba50491092ef..079a91034c25af1663d101a107056e07b95888fe 100644 (file)
@@ -1228,12 +1228,18 @@ static int wpas_p2p_store_persistent_group(struct wpa_supplicant *wpa_s,
        s->bssid_set = 1;
        os_memcpy(s->bssid, go_dev_addr, ETH_ALEN);
        s->mode = ssid->mode;
-       s->auth_alg = WPA_AUTH_ALG_OPEN;
-       s->key_mgmt = WPA_KEY_MGMT_PSK;
-       s->proto = WPA_PROTO_RSN;
+       s->auth_alg = ssid->auth_alg;
+       s->key_mgmt = ssid->key_mgmt;
+       s->proto = ssid->proto;
        s->pbss = ssid->pbss;
+       s->pmk_valid = ssid->pmk_valid;
        s->pairwise_cipher = ssid->pbss ? WPA_CIPHER_GCMP : WPA_CIPHER_CCMP;
        s->export_keys = 1;
+
+       if (ssid->sae_password) {
+               os_free(s->sae_password);
+               s->sae_password = os_strdup(ssid->sae_password);
+       }
        if (ssid->passphrase) {
                os_free(s->passphrase);
                s->passphrase = os_strdup(ssid->passphrase);