From b9ff5385d914dbfde5543675569ee8b32c5d5a85 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 26 Feb 2008 08:48:13 +0100 Subject: [PATCH] Fix reconnect case when ESSID or PSK changes --- plugins/80211.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/80211.c b/plugins/80211.c index 0434b8c..a3d5111 100644 --- a/plugins/80211.c +++ b/plugins/80211.c @@ -272,7 +272,8 @@ static int iface_connect(struct connman_iface *iface, __supplicant_start(iface); - __supplicant_connect(iface, data->network, data->passphrase); + if (data->network != NULL) + __supplicant_connect(iface, data->network, data->passphrase); return 0; } @@ -283,6 +284,9 @@ static int iface_disconnect(struct connman_iface *iface) printf("[802.11] disconnect %s\n", data->ifname); + if (data->network != NULL) + __supplicant_disconnect(iface); + __supplicant_stop(iface); return 0; @@ -295,9 +299,15 @@ static void iface_set_network(struct connman_iface *iface, printf("[802.11] set network %s\n", data->ifname); + if (data->network != NULL) + __supplicant_disconnect(iface); + g_free(data->network); data->network = g_strdup(network); + + if (data->network != NULL) + __supplicant_connect(iface, data->network, data->passphrase); } static void iface_set_passphrase(struct connman_iface *iface, @@ -307,9 +317,15 @@ static void iface_set_passphrase(struct connman_iface *iface, printf("[802.11] set passphrase %s\n", data->ifname); + if (data->network != NULL) + __supplicant_disconnect(iface); + g_free(data->passphrase); data->passphrase = g_strdup(passphrase); + + if (data->network != NULL) + __supplicant_connect(iface, data->network, data->passphrase); } static void parse_genie(struct station_data *station, -- 2.7.4