]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P2: Command to remove all P2P2 identity keys
authorShivani Baranwal <quic_shivbara@quicinc.com>
Mon, 5 Aug 2024 06:33:44 +0000 (12:03 +0530)
committerJouni Malinen <j@w1.fi>
Tue, 19 Nov 2024 22:28:00 +0000 (00:28 +0200)
Add a control interface command to allow all P2P2 identity keys to be
removed from configuration.

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

index 62532641181853c762ab67d33f59bd91c225ee57..2ac34df7e47c94ae611465d7370ac32582f79efb 100644 (file)
@@ -13014,6 +13014,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
        } else if (os_strcmp(buf, "P2P_LO_STOP") == 0) {
                if (wpas_p2p_lo_stop(wpa_s))
                        reply_len = -1;
+       } else if (os_strcmp(buf, "P2P_REMOVE_IDENTITY") == 0) {
+               if (wpas_p2p_remove_all_identity(wpa_s))
+                       reply_len = -1;
 #endif /* CONFIG_P2P */
 #ifdef CONFIG_WIFI_DISPLAY
        } else if (os_strncmp(buf, "WFD_SUBELEM_SET ", 16) == 0) {
index 042fc2cbc466c69c255d4bffe4c7e9989186a040..114fd55457b28c217a3d9ff62cbb7953e12a15a1 100644 (file)
@@ -1397,6 +1397,22 @@ static void wpas_p2p_group_started(struct wpa_supplicant *wpa_s,
 }
 
 
+int wpas_p2p_remove_all_identity(struct wpa_supplicant *wpa_s)
+{
+       struct wpa_dev_ik *ik;
+
+       for (ik = wpa_s->conf->identity; ik; ik = ik->next)
+               wpa_config_remove_identity(wpa_s->conf, ik->id);
+
+       if (wpa_s->conf->update_config &&
+           wpa_config_write(wpa_s->confname, wpa_s->conf)) {
+               wpa_printf(MSG_DEBUG, "P2P: Failed to update configuration");
+               return -1;
+       }
+       return 0;
+}
+
+
 static void wpas_p2p_store_identity(struct wpa_supplicant *wpa_s, u8 cipher,
                                    const u8 *dik_data, size_t dik_len,
                                    const u8 *pmk, size_t pmk_len,
index 24e742b5ed077cfa4bb7b84ed1b7b429adfd1a52..4337e25088e6f63cdbccb5cb8a4b8c3cd29468e4 100644 (file)
@@ -188,6 +188,7 @@ void wpas_p2p_process_usd_elems(struct wpa_supplicant *wpa_s, const u8 *buf,
                                unsigned int freq);
 int wpas_p2p_pasn_auth_tx_status(struct wpa_supplicant *wpa_s, const u8 *data,
                                 size_t data_len, bool acked);
+int wpas_p2p_remove_all_identity(struct wpa_supplicant *wpa_s);
 
 #ifdef CONFIG_P2P