From d9bb2821e7ceeb55978d5c9c338b3fd85f6bace4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 8 Jan 2014 16:14:30 +0200 Subject: [PATCH] Clear configuration blobs on FLUSH command All te network blocks and credentials were already cleared, but configurations blobs should also be cleared here, e.g., to get more consistent behavior test cases using EAP-FAST PACs. Signed-hostap: Jouni Malinen --- wpa_supplicant/config.c | 29 +++++++++++++++++------------ wpa_supplicant/config.h | 1 + wpa_supplicant/ctrl_iface.c | 1 + 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 5301ed715..884acf6c8 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -1926,6 +1926,22 @@ void wpa_config_free_cred(struct wpa_cred *cred) } +void wpa_config_flush_blobs(struct wpa_config *config) +{ +#ifndef CONFIG_NO_CONFIG_BLOBS + struct wpa_config_blob *blob, *prev; + + blob = config->blobs; + config->blobs = NULL; + while (blob) { + prev = blob; + blob = blob->next; + wpa_config_free_blob(prev); + } +#endif /* CONFIG_NO_CONFIG_BLOBS */ +} + + /** * wpa_config_free - Free configuration data * @config: Configuration data from wpa_config_read() @@ -1935,9 +1951,6 @@ void wpa_config_free_cred(struct wpa_cred *cred) */ void wpa_config_free(struct wpa_config *config) { -#ifndef CONFIG_NO_CONFIG_BLOBS - struct wpa_config_blob *blob, *prevblob; -#endif /* CONFIG_NO_CONFIG_BLOBS */ struct wpa_ssid *ssid, *prev = NULL; struct wpa_cred *cred, *cprev; @@ -1955,15 +1968,7 @@ void wpa_config_free(struct wpa_config *config) wpa_config_free_cred(cprev); } -#ifndef CONFIG_NO_CONFIG_BLOBS - blob = config->blobs; - prevblob = NULL; - while (blob) { - prevblob = blob; - blob = blob->next; - wpa_config_free_blob(prevblob); - } -#endif /* CONFIG_NO_CONFIG_BLOBS */ + wpa_config_flush_blobs(config); wpabuf_free(config->wps_vendor_ext_m1); os_free(config->ctrl_interface); diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index e24772d11..a98a5aa53 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -979,6 +979,7 @@ void wpa_config_set_blob(struct wpa_config *config, struct wpa_config_blob *blob); void wpa_config_free_blob(struct wpa_config_blob *blob); int wpa_config_remove_blob(struct wpa_config *config, const char *name); +void wpa_config_flush_blobs(struct wpa_config *config); struct wpa_cred * wpa_config_get_cred(struct wpa_config *config, int id); struct wpa_cred * wpa_config_add_cred(struct wpa_config *config); diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 32941aedd..b4dcb39c5 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -5296,6 +5296,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) wpa_s->extra_blacklist_count = 0; wpa_supplicant_ctrl_iface_remove_network(wpa_s, "all"); wpa_supplicant_ctrl_iface_remove_cred(wpa_s, "all"); + wpa_config_flush_blobs(wpa_s->conf); wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_LIFETIME, 43200); wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_REAUTH_THRESHOLD, 70);