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); wpa_s = wpa_supplicant_get_iface(global, cmd);
if (wpa_s == NULL) if (wpa_s == NULL)
return -1; 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); wpa_s = get_iface_by_dbus_path(global, path);
if (wpa_s == NULL) if (wpa_s == NULL)
reply = wpas_dbus_error_iface_unknown(message); 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( reply = wpas_dbus_error_unknown_error(
message, "wpa_supplicant couldn't remove this " message, "wpa_supplicant couldn't remove this "
"interface."); "interface.");

View File

@ -229,7 +229,7 @@ DBusMessage * wpas_dbus_global_remove_interface(DBusMessage *message,
goto out; 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); reply = wpas_dbus_new_success_reply(message);
} else { } else {
reply = dbus_message_new_error(message, 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; global = wpa_s->global;
ifname = os_strdup(wpa_s->ifname); ifname = os_strdup(wpa_s->ifname);
type = wpas_p2p_if_type(wpa_s->p2p_group_interface); 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; wpa_s = global->ifaces;
if (wpa_s && ifname) if (wpa_s && ifname)
wpa_drv_if_remove(wpa_s, type, ifname); wpa_drv_if_remove(wpa_s, type, ifname);
@ -2449,7 +2449,7 @@ void wpas_p2p_deinit_global(struct wpa_global *global)
break; break;
ifname = os_strdup(tmp->ifname); ifname = os_strdup(tmp->ifname);
type = wpas_p2p_if_type(tmp->p2p_group_interface); type = wpas_p2p_if_type(tmp->p2p_group_interface);
wpa_supplicant_remove_iface(global, tmp); wpa_supplicant_remove_iface(global, tmp, 0);
if (ifname) if (ifname)
wpa_drv_if_remove(wpa_s, type, ifname); wpa_drv_if_remove(wpa_s, type, ifname);
os_free(ifname); os_free(ifname);

View File

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