[PATCH]: enable 'REMOVE_NETWORK all' ctrl_iface command

Kel Modderman kel
Sun Jan 13 01:57:26 PST 2008


Allow 'REMOVE_NETWORK all' ctrl_iface command to remove all networks in
current configuration.

Signed-off-by: Kel Modderman <kel at otaku42.de>
---
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -747,7 +747,23 @@
 	int id;
 	struct wpa_ssid *ssid;
 
-	/* cmd: "<network id>" */
+	/* cmd: "<network id>" or "all" */
+	if (os_strcmp(cmd, "all") == 0) {
+		wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_NETWORK all");
+		ssid = wpa_s->conf->ssid;
+		while (ssid) {
+			id = ssid->id;
+			ssid = ssid->next;
+			wpa_config_remove_network(wpa_s->conf, id);
+		}
+		if (wpa_s->current_ssid) {
+			eapol_sm_invalidate_cached_session(wpa_s->eapol);
+			wpa_supplicant_disassociate(wpa_s,
+				                    WLAN_REASON_DEAUTH_LEAVING);
+		}
+		return 0;
+	}
+
 	id = atoi(cmd);
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_NETWORK id=%d", id);
 
---



More information about the Hostap mailing list