From 90e0ec14c1ad619915e23f15246665a5f9f99178 Mon Sep 17 00:00:00 2001 From: Bernhard Schmidt Date: Sun, 30 Jan 2011 14:22:45 +0000 Subject: [PATCH] Fix the 'scan hang' issue. When requesting a scan and one is already in progess, e.g. while in scan state, we happily wait for a scan done notification. Though, this notification might never be sent, e.g. if we are trying to find a network to associate to and there is none. Instead of always waiting for a notification just do so if a new scan has been started. For both cases the scan cache is used to report available networks even if the content might not be fresh. MFC after: 1 month --- sbin/ifconfig/ifieee80211.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index 0250f1675e6e..2104e0d79b34 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -3230,8 +3230,12 @@ scan_and_wait(int s) ireq.i_data = &sr; ireq.i_len = sizeof(sr); - /* NB: only root can trigger a scan so ignore errors */ - if (ioctl(s, SIOCS80211, &ireq) >= 0) { + /* + * NB: only root can trigger a scan so ignore errors. Also ignore + * possible errors from net80211, even if no new scan could be + * started there might still be a valid scan cache. + */ + if (ioctl(s, SIOCS80211, &ireq) == 0) { char buf[2048]; struct if_announcemsghdr *ifan; struct rt_msghdr *rtm;