From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 14:22:46 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0993A1065672; Sun, 30 Jan 2011 14:22:46 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EDFE68FC16; Sun, 30 Jan 2011 14:22:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UEMjV6074516; Sun, 30 Jan 2011 14:22:45 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UEMjnj074514; Sun, 30 Jan 2011 14:22:45 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201101301422.p0UEMjnj074514@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 30 Jan 2011 14:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218093 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 14:22:46 -0000 Author: bschmidt Date: Sun Jan 30 14:22:45 2011 New Revision: 218093 URL: http://svn.freebsd.org/changeset/base/218093 Log: 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 Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Sun Jan 30 14:05:21 2011 (r218092) +++ head/sbin/ifconfig/ifieee80211.c Sun Jan 30 14:22:45 2011 (r218093) @@ -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;