From owner-freebsd-net@FreeBSD.ORG Tue Dec 28 01:11:59 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19D2F106566C; Tue, 28 Dec 2010 01:11:59 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com [209.85.218.54]) by mx1.freebsd.org (Postfix) with ESMTP id A493F8FC17; Tue, 28 Dec 2010 01:11:58 +0000 (UTC) Received: by yie19 with SMTP id 19so1851260yie.13 for ; Mon, 27 Dec 2010 17:11:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=lDi83k0Ckv52MwRkrN8423k59q7bl6vbn0TGK7CMZ1A=; b=lQhq3dkMO9AJJa2lF65WyyXku0OlOn+7kTNXci1tbE8ewZV+jGBeKZfhXwcDrx/v0U 73Y11h5nZgq1nHrhh6C4KCY/NBsVtQpz4JlGvWV0oos4yvVaMdT8arG1bP+EbugiT778 qob4zqF5FVPtIHcM7LxNqUYIkYWnbMJdoOEWE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=HWgJ0lqigujX7xnQhLUvEn8xb7Cdcu04XlqWVIZqaVyO+nU1WPYpyWWvJNRra5nSnx 02/Cp4jniw4BpTf+it7QASGvp2JGYftQOqafBX/q/y5lf4IB6o4VNxZbLPsQdRAYwf2g 9HocMCfgpet/9wApK+r++nH3ZtyfMCSBRAmuI= MIME-Version: 1.0 Received: by 10.236.102.179 with SMTP id d39mr10311049yhg.13.1293496899475; Mon, 27 Dec 2010 16:41:39 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.236.109.45 with HTTP; Mon, 27 Dec 2010 16:41:39 -0800 (PST) In-Reply-To: <201012272024.37110.bschmidt@freebsd.org> References: <201012272024.37110.bschmidt@freebsd.org> Date: Tue, 28 Dec 2010 01:41:39 +0100 X-Google-Sender-Auth: v5oXYwGR_H8MUjspDL4zL1LYiT4 Message-ID: From: Attilio Rao To: Bernhard Schmidt Content-Type: text/plain; charset=UTF-8 Cc: freebsd-net@freebsd.org, Adrian Chadd Subject: Re: CFT/CFR, possible fix for ifconfig scan hang X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Dec 2010 01:11:59 -0000 2010/12/27 Bernhard Schmidt : > Hi, > > I recently received some complains about the infamous 'ifconfig scan hang' > issue again. Finally looking into that I noticed a bunch of inconsistences, > the most obvious one is that ifconfig(8) is talking about doing a background > scan by default, which is simply not true according to the implementation. > > Anyways.. the generic use-case which triggers the 'hang' is, if 'ifconfig > scan' is called while a scan is already in progress, net80211 will not start a > new one which means that no scan flags are updated, though, ifconfig will loop > until it receives a notification about the scan being done. This does always > happen after an 'ifconfig up', because net80211 will move the VAP into scan > state by default, with the scan flags set in such a way that a scan is done > until there is something to connect to. This also means that no notifications > about the scan being done are sent to upper layers, because the scan is not > finished.. > > If we successfully moved from scan to run state, how so ever, and now want to > call 'ifconfig scan' we're faced with another issue. Doing a scan while being > associated means we have to move off our current channel, to do this without > loosing any imported frames/information, we make use of the power save > feature. Now if we want to send any traffic while doing the scan, the scan is > temporary suspended, frames are sent, then the scan is restarted after > receiving a beacon and there is no frame to send. For this to work though, we > need to actually request a background scan so appropriate flags are set and > the scan is actually restarted. Without this, we hang until the bgscan timer > fires of at that next bgscanintval. > > I have a patch available which addresses both of the issues. It requests a > background scan by default and also honors the return value of > start_scan_locked(): > - for head > http://techwires.net/~bschmidt/scan_hang_head.diff > - for 8-stable/8.2-*: > http://techwires.net/~bschmidt/scan_hang_stable.diff > > Please test and let me know if it works, or not. Bernard, thanks a lot for working on this. There is any receipt for easilly reproduce this type of bug, or I should just go with 'ifconfig scan' repeteadly? I recall I could trigger it, but not 100% of times, so if you have more hints about how this problem could be reproduced, I'd be glad to hear. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein