From owner-freebsd-net@FreeBSD.ORG Tue Jan 4 09:05:58 2011 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 C06411065672; Tue, 4 Jan 2011 09:05:58 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 348538FC1C; Tue, 4 Jan 2011 09:05:57 +0000 (UTC) Received: by fxm16 with SMTP id 16so13746441fxm.13 for ; Tue, 04 Jan 2011 01:05:57 -0800 (PST) Received: by 10.223.96.138 with SMTP id h10mr1278893fan.120.1294131957046; Tue, 04 Jan 2011 01:05:57 -0800 (PST) Received: from jessie.localnet (p5B2EC5A5.dip0.t-ipconnect.de [91.46.197.165]) by mx.google.com with ESMTPS id l3sm3188620fan.0.2011.01.04.01.05.54 (version=SSLv3 cipher=RC4-MD5); Tue, 04 Jan 2011 01:05:55 -0800 (PST) Sender: Bernhard Schmidt From: Bernhard Schmidt To: Eugene Grosbein Date: Tue, 4 Jan 2011 10:06:05 +0100 User-Agent: KMail/1.13.2 (Linux/2.6.32-25-generic; KDE/4.4.2; i686; ; ) References: <4D22D578.8080903@rdtc.ru> In-Reply-To: <4D22D578.8080903@rdtc.ru> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201101041006.06065.bschmidt@freebsd.org> Cc: freebsd-net@freebsd.org, bug-followup@freebsd.org Subject: Re: kern/153594: [iwn] Network keeps disconnecting when /etc/rc.d/netif restart is run X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bschmidt@freebsd.org List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jan 2011 09:05:58 -0000 On Tuesday, January 04, 2011 09:08:24 Eugene Grosbein wrote: > > There is race in devd and our rc-subsystem if wpa_supplicant is involved > > effectivly resulting in starting wpa_supplicant twice. Both instances try > > to take over the wlan device which results in what you are seeing. > > I have no idea how to fix this right now, so this has to wait until I'm > > able to think of proper fix. > > Perhaps, wrapping wpa_supplicant invocation into "lockf -t0" would help > to eliminate race? Possibly, but I don't think this is the way to go. Currently wpa_supplicant has this code: /* * Mark the interface as down to ensure wpa_supplicant has exclusive * access to the net80211 state machine, do this before opening the * route socket to avoid a false event that the interface disappeared. */ if (getifflags(drv, &flags) == 0) (void) setifflags(drv, flags &~ IFF_UP); This code works such that it will send an event to already running wpa_supplicant instances which will then terminate. This does indeed work if there's enough delay between invocations, though, if there is just a small delay (~100ms or something), that event doesn't get passed probably. I think we should start looking into possible solution at that point, trying to figure out why the the event doesn't get passed (probably because the interface is not yet up at that point) will get us closer to proper solution. -- Bernhard