Add build option CONFIG_TERMINATE_ONLASTIF

This makes wpa_supplicant terminate automatically if the configured
interface(s) disappear.
This commit is contained in:
Sam Leffler 2009-03-02 21:57:00 +02:00 committed by Jouni Malinen
parent daa70d49de
commit a83d9c9652

View file

@ -1017,6 +1017,19 @@ wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s,
} }
#ifdef CONFIG_TERMINATE_ONLASTIF
static int any_interfaces(struct wpa_supplicant *head)
{
struct wpa_supplicant *wpa_s;
for (wpa_s = head; wpa_s != NULL; wpa_s = wpa_s->next)
if (!wpa_s->interface_removed)
return 1;
return 0;
}
#endif /* CONFIG_TERMINATE_ONLASTIF */
static void static void
wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s, wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
union wpa_event_data *data) union wpa_event_data *data)
@ -1041,6 +1054,11 @@ wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
wpa_supplicant_mark_disassoc(wpa_s); wpa_supplicant_mark_disassoc(wpa_s);
l2_packet_deinit(wpa_s->l2); l2_packet_deinit(wpa_s->l2);
wpa_s->l2 = NULL; wpa_s->l2 = NULL;
#ifdef CONFIG_TERMINATE_ONLASTIF
/* check if last interface */
if (!any_interfaces(wpa_s->global->ifaces))
eloop_terminate();
#endif /* CONFIG_TERMINATE_ONLASTIF */
break; break;
} }
} }