From owner-freebsd-arch@FreeBSD.ORG Tue Nov 5 19:33:53 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 02059AA7 for ; Tue, 5 Nov 2013 19:33:52 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 70FAF2117 for ; Tue, 5 Nov 2013 19:33:52 +0000 (UTC) Received: by mail-wi0-f173.google.com with SMTP id ey11so2665171wid.12 for ; Tue, 05 Nov 2013 11:33:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=RG92irbN9hCPPVhzWP35JsMJyAuanIyipef5rTDe6Lc=; b=JsUoijR6ygLCVJoOttXTbQgbQ0+gog6AREFX48z2Gxhz6CS+V441IqaGTgCg84VNG1 Aqf5gwcONuX9v0C3JyUVm+r8N2K4xZVJlhHTScP6pGw6l1W/k4EEnbQ6GyU2FrH/tjE+ qRHec0EYn1DMVdK0U01pXsoyAY3uDCn7UoU7C3vMMjuzw/A1I6t+SjKu5cJFxeIOw3IH FMbEUj4DsdXA3DbMjZYlisD8U9XmkbY9S9wWKiLRDXEMSer4G8Wo7vyoWqHeunesDJw5 Bm+5QyZyLjbQxPP8vZB6EJS2dNxYKGrJOZ/i0Ng5lCgiD2FdWJLrnAUMKuM8UR+jvzM9 qDTw== X-Gm-Message-State: ALoCoQl+a98lMzomllT/mlmgoH8ZBmf7oWJBEtVyyd3SZqsiit2macEI/f/CVA25g8pxKX0unzrh MIME-Version: 1.0 X-Received: by 10.194.240.197 with SMTP id wc5mr19642081wjc.23.1383680030616; Tue, 05 Nov 2013 11:33:50 -0800 (PST) Received: by 10.227.226.196 with HTTP; Tue, 5 Nov 2013 11:33:50 -0800 (PST) X-Originating-IP: [88.67.223.128] In-Reply-To: <201311051154.18872.jhb@freebsd.org> References: <1382572583.1862.39.camel@eva02.mbsd> <1383419596.3253.42.camel@eva02.mbsd> <201311051154.18872.jhb@freebsd.org> Date: Tue, 5 Nov 2013 20:33:50 +0100 Message-ID: Subject: Re: service netif restart [iface] runs a wpa_supplicant twice From: Bernhard Schmidt To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Cc: clutton , "freebsd-wireless@freebsd.org" , freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2013 19:33:53 -0000 On Tue, Nov 5, 2013 at 5:54 PM, John Baldwin wrote: > On Sunday, November 03, 2013 12:56:08 pm Adrian Chadd wrote: >> On 2 November 2013 12:13, clutton wrote: >> >> [snip] >> >> > What was happened? netif tries to setup wlan0 (clone, wpa, dhcp, etc), >> > when wlan0 interface occurs, devd runs another copy of netif. >> >> Well, it sounds like we need to pick an architecture _and_ fix the >> behaviour here. >> >> Which is: >> >> >> * I think wpa-supplicant should always run if it's required in /etc/rc.conf; >> * netif should check if devd is configured and if so, just leave the >> configuration up to devd >> * if it isn't running, then devd should be responsible for >> dhclient/add-to-wpa-config >> >> What we first have to establish is whether add_interface and >> remove_interface (or whatever they're called) are correctly working, >> for ethernet and wifi driver types. Then, we need to ensure they can >> coexist (ie, one wpa_supplicant, but with both ethernet/wifi drivers >> loaded and active on their relevant interfaces.) _then_ we can break >> out the "stuff devd does" out of netif and have _either_ netif (x)or >> devd call this new script to setup/teardown the interface runtime >> state. >> >> How's that sound? > > Note that devd just runs netif (via /etc/pccard_ether), so it's already > just one script, and having netif bail if devd is running would make > netif not do anything in the common case. > > What normally happens during boot is that '/etc/rc.d/netif start' creates > wlan0 and runs wpa_supplicant via 'childif_create' making a nested call to > ifn_start for wlan0. That is, childif_create autoruns /etc/rc.d/netif > explicitly after it creates the device. Probably that is what should be > removed. That would let devd always start wpa_supplicant via > /etc/pccard_ether. I've just tested this by doing a stop/start on iwn0 > (parent of wlan0, so wlan0 gets destroyed and re-created) and it started > wpa_supplicant correctly. > > Index: head/etc/network.subr > =================================================================== > --- network.subr (revision 257705) > +++ network.subr (working copy) > @@ -1429,9 +1429,6 @@ childif_create() > fi > ${IFCONFIG_CMD} $i name $child && cfg=0 > fi > - if autoif $child; then > - ifn_start $child > - fi > done > > # Create vlan interfaces > > I also tested vlans created via vlans_ and they should use the same fix as > well. Note that this model is more consistent with how cloned_interfaces > works where ifn_start is not explicitly run when each interface is created. > Instead, we rely on devd kicking off pccard_ether for those as well. That looks sane too me. Just one question, I remember that devd is disabled during boot and activated later through a sysctl (to ignore events entirely), is this the case before or after netif is running? I guess it is activated after netif, otherwise we would have seen this issue on booting and not just during netif restart. -- Bernhard