diff options
author | Kalle Valo <kalle.valo@canonical.com> | 2010-10-27 21:49:31 +0300 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-11-02 12:40:06 +0100 |
commit | a61d6dacbf4d143e0ec0d1e69037d88d8d31b787 (patch) | |
tree | d106514a01919d8bd6eff611a204a366611b7621 /gsupplicant | |
parent | 9ecfa4914a5e86bfa6d6d3cc3e4d605ac8ccd9bc (diff) | |
download | connman-a61d6dacbf4d143e0ec0d1e69037d88d8d31b787.tar.gz connman-a61d6dacbf4d143e0ec0d1e69037d88d8d31b787.tar.bz2 connman-a61d6dacbf4d143e0ec0d1e69037d88d8d31b787.zip |
gsupplicant: Remove network from wpa_s when disconnecting
gsupplicant adds networks to wpasupplicant but never removes them. So
after a time wpasupplicant will contain a lot of disabled networks. This
doesn't seem to create any problems, but it's still better to make sure
that wpasupplicant configuration is clean.
Diffstat (limited to 'gsupplicant')
-rw-r--r-- | gsupplicant/supplicant.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index a2501b94..2a1021ff 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -2344,7 +2344,7 @@ int g_supplicant_interface_connect(GSupplicantInterface *interface, return -EINPROGRESS; } -static void interface_disconnect_result(const char *error, +static void network_remove_result(const char *error, DBusMessageIter *iter, void *user_data) { struct interface_data *data = user_data; @@ -2361,6 +2361,42 @@ static void interface_disconnect_result(const char *error, dbus_free(data); } +static void network_remove_params(DBusMessageIter *iter, void *user_data) +{ + struct interface_data *data = user_data; + const char *path = data->interface->network_path; + + SUPPLICANT_DBG("path %s", path); + + dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path); +} + +static int network_remove(struct interface_data *data) +{ + GSupplicantInterface *interface = data->interface; + + SUPPLICANT_DBG(""); + + return supplicant_dbus_method_call(interface->path, + SUPPLICANT_INTERFACE ".Interface", "RemoveNetwork", + network_remove_params, network_remove_result, data); +} + +static void interface_disconnect_result(const char *error, + DBusMessageIter *iter, void *user_data) +{ + struct interface_data *data = user_data; + + SUPPLICANT_DBG(""); + + if (error != NULL && data->callback != NULL) { + data->callback(-EIO, data->interface, data->user_data); + return; + } + + network_remove(data); +} + int g_supplicant_interface_disconnect(GSupplicantInterface *interface, GSupplicantInterfaceCallback callback, void *user_data) |