From 7b7ce8aa139ff712562e3e4bad308deb241fba15 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 16 Jul 2011 16:57:11 +0300 Subject: [PATCH] Deauthenticate on reconfiguration This makes sure that the old connection is not maintained if the new configuration does not allow it anymore. In addition, it is better to use wpa_supplicant_clear_connection() instead of just clearing wpa_s->current_ssid here to keep things in sync. --- wpa_supplicant/wpa_supplicant.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index f303b4079..8f835eb1e 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -684,7 +684,6 @@ void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s) int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s) { struct wpa_config *conf; - struct wpa_ssid *old_ssid; int reconf_ctrl; int old_ap_scan; @@ -709,10 +708,10 @@ int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s) } eapol_sm_invalidate_cached_session(wpa_s->eapol); - old_ssid = wpa_s->current_ssid; - wpa_s->current_ssid = NULL; - if (old_ssid != wpa_s->current_ssid) - wpas_notify_network_changed(wpa_s); + if (wpa_s->current_ssid) { + wpa_supplicant_deauthenticate(wpa_s, + WLAN_REASON_DEAUTH_LEAVING); + } /* * TODO: should notify EAPOL SM about changes in opensc_engine_path,