Add supplicant disconnect function
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 26 Feb 2008 07:39:36 +0000 (08:39 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 26 Feb 2008 07:39:36 +0000 (08:39 +0100)
plugins/supplicant.c
plugins/supplicant.h

index 3c02abd..b30b16c 100644 (file)
@@ -269,6 +269,9 @@ int __supplicant_connect(struct connman_iface *iface,
 
        exec_cmd(task, "DISABLE_NETWORK 0");
 
+       if (network == NULL)
+               return 0;
+
        sprintf(cmd, "SET_NETWORK 0 ssid \"%s\"", network);
        exec_cmd(task, cmd);
 
@@ -287,3 +290,18 @@ int __supplicant_connect(struct connman_iface *iface,
 
        return 0;
 }
+
+int __supplicant_disconnect(struct connman_iface *iface)
+{
+       struct supplicant_task *task;
+
+       task = find_task(iface->index);
+       if (task == NULL)
+               return -ENODEV;
+
+       printf("[SUPPLICANT] disconnect %s\n", task->ifname);
+
+       exec_cmd(task, "DISABLE_NETWORK 0");
+
+       return 0;
+}
index 9e5ebc6..dc015ed 100644 (file)
@@ -26,3 +26,4 @@ int __supplicant_stop(struct connman_iface *iface);
 
 int __supplicant_connect(struct connman_iface *iface,
                                const char *network, const char *passphrase);
+int __supplicant_disconnect(struct connman_iface *iface);