From b9e6c6d781096f754bb65e993c260008f40e460a Mon Sep 17 00:00:00 2001 From: sam Date: Fri, 29 Jul 2005 05:58:35 +0000 Subject: [PATCH] terminate when all interfaces have been removed; since we do not do interface discovery there's no point in sticking around MFC after: 3 days --- contrib/wpa_supplicant/wpa_supplicant.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/contrib/wpa_supplicant/wpa_supplicant.c b/contrib/wpa_supplicant/wpa_supplicant.c index 0c57143f826e..a1524ab90737 100644 --- a/contrib/wpa_supplicant/wpa_supplicant.c +++ b/contrib/wpa_supplicant/wpa_supplicant.c @@ -10,6 +10,8 @@ * license. * * See README and COPYING for more details. + * + * $FreeBSD$ */ #include @@ -871,6 +873,15 @@ static void wpa_supplicant_associnfo(struct wpa_supplicant *wpa_s, } +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; +} void wpa_supplicant_event(struct wpa_supplicant *wpa_s, wpa_event_type event, union wpa_event_data *data) @@ -1001,6 +1012,9 @@ void wpa_supplicant_event(struct wpa_supplicant *wpa_s, wpa_event_type event, wpa_supplicant_mark_disassoc(wpa_s); l2_packet_deinit(wpa_s->l2); wpa_s->l2 = NULL; + /* check if last interface */ + if (!any_interfaces(wpa_s->head)) + eloop_terminate(); break; } break;