diff options
author | sam <sam@FreeBSD.org> | 2005-07-08 16:33:52 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2005-07-08 16:33:52 +0000 |
commit | 070db914d46f28849dd0a9754727798b0071deb3 (patch) | |
tree | fafdc50dca2e066e3cc553beacadfd9c69e911ad /usr.sbin | |
parent | 0cb398882171aeb5d6dfa0d58e7fdca26e992e4b (diff) | |
download | FreeBSD-src-070db914d46f28849dd0a9754727798b0071deb3.zip FreeBSD-src-070db914d46f28849dd0a9754727798b0071deb3.tar.gz |
handle RTM_IFINFO events so we terminate when an interface is
marked down
Reviewed by: brooks, avatar
Approved by: re (scottl)
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/wpa/wpa_supplicant/driver_freebsd.c | 15 |
1 files changed, 14 insertions, 1 deletions
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; } } |