From 070db914d46f28849dd0a9754727798b0071deb3 Mon Sep 17 00:00:00 2001 From: sam Date: Fri, 8 Jul 2005 16:33:52 +0000 Subject: handle RTM_IFINFO events so we terminate when an interface is marked down Reviewed by: brooks, avatar Approved by: re (scottl) --- usr.sbin/wpa/wpa_supplicant/driver_freebsd.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'usr.sbin') diff --git a/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c b/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c index 6fbe00f..ed85fa2 100644 --- a/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c +++ b/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c @@ -422,6 +422,7 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx) { char buf[2048]; struct if_announcemsghdr *ifan; + struct if_msghdr *ifm; struct rt_msghdr *rtm; union wpa_event_data event; struct ieee80211_michael_event *mic; @@ -440,9 +441,9 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx) "understood\n", rtm->rtm_version); return; } - ifan = (struct if_announcemsghdr *) rtm; switch (rtm->rtm_type) { case RTM_IFANNOUNCE: + ifan = (struct if_announcemsghdr *) rtm; memset(&event, 0, sizeof(event)); /* XXX name buffer must be >= IFNAMSIZ */ /* XXX check return value */ @@ -463,6 +464,7 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx) wpa_supplicant_event(ctx, EVENT_INTERFACE_STATUS, &event); break; case RTM_IEEE80211: + ifan = (struct if_announcemsghdr *) rtm; switch (ifan->ifan_what) { case RTM_IEEE80211_ASSOC: case RTM_IEEE80211_REASSOC: @@ -492,6 +494,17 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx) break; } break; + case RTM_IFINFO: + ifm = (struct if_msghdr *) rtm; + if ((rtm->rtm_flags & RTF_UP) == 0) { + if_indextoname(ifm->ifm_index, + event.interface_status.ifname); + event.interface_status.ievent = EVENT_INTERFACE_REMOVED; + wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' DOWN", + event.interface_status.ifname); + wpa_supplicant_event(ctx, EVENT_INTERFACE_STATUS, &event); + } + break; } } -- cgit v1.1