Let wpa_supplicant_deinit_iface() know that process is terminating

This will be needed to be able to move ctrl_iface TERMINATING event to
the end of interface removal.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
Dmitry Shmidt 2012-01-29 20:15:48 +02:00 committed by Jouni Malinen
parent ad612c2ace
commit df509539d4
6 changed files with 14 additions and 12 deletions

View file

@ -3883,7 +3883,7 @@ static int wpa_supplicant_global_iface_remove(struct wpa_global *global,
wpa_s = wpa_supplicant_get_iface(global, cmd);
if (wpa_s == NULL)
return -1;
return wpa_supplicant_remove_iface(global, wpa_s);
return wpa_supplicant_remove_iface(global, wpa_s, 0);
}

View file

@ -576,7 +576,7 @@ DBusMessage * wpas_dbus_handler_remove_interface(DBusMessage *message,
wpa_s = get_iface_by_dbus_path(global, path);
if (wpa_s == NULL)
reply = wpas_dbus_error_iface_unknown(message);
else if (wpa_supplicant_remove_iface(global, wpa_s)) {
else if (wpa_supplicant_remove_iface(global, wpa_s, 0)) {
reply = wpas_dbus_error_unknown_error(
message, "wpa_supplicant couldn't remove this "
"interface.");

View file

@ -229,7 +229,7 @@ DBusMessage * wpas_dbus_global_remove_interface(DBusMessage *message,
goto out;
}
if (!wpa_supplicant_remove_iface(global, wpa_s)) {
if (!wpa_supplicant_remove_iface(global, wpa_s, 0)) {
reply = wpas_dbus_new_success_reply(message);
} else {
reply = dbus_message_new_error(message,

View file

@ -280,7 +280,7 @@ static void wpas_p2p_group_delete(struct wpa_supplicant *wpa_s)
global = wpa_s->global;
ifname = os_strdup(wpa_s->ifname);
type = wpas_p2p_if_type(wpa_s->p2p_group_interface);
wpa_supplicant_remove_iface(wpa_s->global, wpa_s);
wpa_supplicant_remove_iface(wpa_s->global, wpa_s, 0);
wpa_s = global->ifaces;
if (wpa_s && ifname)
wpa_drv_if_remove(wpa_s, type, ifname);
@ -2449,7 +2449,7 @@ void wpas_p2p_deinit_global(struct wpa_global *global)
break;
ifname = os_strdup(tmp->ifname);
type = wpas_p2p_if_type(tmp->p2p_group_interface);
wpa_supplicant_remove_iface(global, tmp);
wpa_supplicant_remove_iface(global, tmp, 0);
if (ifname)
wpa_drv_if_remove(wpa_s, type, ifname);
os_free(ifname);

View file

@ -2402,7 +2402,7 @@ next_driver:
static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s,
int notify)
int notify, int terminate)
{
if (wpa_s->drv_priv) {
wpa_supplicant_deauthenticate(wpa_s,
@ -2468,14 +2468,14 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
if (wpa_supplicant_init_iface(wpa_s, &t_iface)) {
wpa_printf(MSG_DEBUG, "Failed to add interface %s",
iface->ifname);
wpa_supplicant_deinit_iface(wpa_s, 0);
wpa_supplicant_deinit_iface(wpa_s, 0, 0);
os_free(wpa_s);
return NULL;
}
/* Notify the control interfaces about new iface */
if (wpas_notify_iface_added(wpa_s)) {
wpa_supplicant_deinit_iface(wpa_s, 1);
wpa_supplicant_deinit_iface(wpa_s, 1, 0);
os_free(wpa_s);
return NULL;
}
@ -2504,7 +2504,8 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
* %wpa_supplicant is terminated.
*/
int wpa_supplicant_remove_iface(struct wpa_global *global,
struct wpa_supplicant *wpa_s)
struct wpa_supplicant *wpa_s,
int terminate)
{
struct wpa_supplicant *prev;
@ -2524,7 +2525,7 @@ int wpa_supplicant_remove_iface(struct wpa_global *global,
if (global->p2p_group_formation == wpa_s)
global->p2p_group_formation = NULL;
wpa_supplicant_deinit_iface(wpa_s, 1);
wpa_supplicant_deinit_iface(wpa_s, 1, terminate);
os_free(wpa_s);
return 0;
@ -2740,7 +2741,7 @@ void wpa_supplicant_deinit(struct wpa_global *global)
#endif /* CONFIG_P2P */
while (global->ifaces)
wpa_supplicant_remove_iface(global, global->ifaces);
wpa_supplicant_remove_iface(global, global->ifaces, 1);
if (global->ctrl_iface)
wpa_supplicant_global_ctrl_iface_deinit(global->ctrl_iface);

View file

@ -578,7 +578,8 @@ void wpa_show_license(void);
struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
struct wpa_interface *iface);
int wpa_supplicant_remove_iface(struct wpa_global *global,
struct wpa_supplicant *wpa_s);
struct wpa_supplicant *wpa_s,
int terminate);
struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
const char *ifname);
struct wpa_global * wpa_supplicant_init(struct wpa_params *params);