Fix reconnect case when ESSID or PSK changes
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 26 Feb 2008 07:48:13 +0000 (08:48 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 26 Feb 2008 07:48:13 +0000 (08:48 +0100)
plugins/80211.c

index 0434b8c..a3d5111 100644 (file)
@@ -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,