From owner-freebsd-stable@FreeBSD.ORG Tue Nov 15 23:16:27 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 427B4106564A for ; Tue, 15 Nov 2011 23:16:27 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta03.westchester.pa.mail.comcast.net (qmta03.westchester.pa.mail.comcast.net [76.96.62.32]) by mx1.freebsd.org (Postfix) with ESMTP id 0195D8FC12 for ; Tue, 15 Nov 2011 23:16:26 +0000 (UTC) Received: from omta11.westchester.pa.mail.comcast.net ([76.96.62.36]) by qmta03.westchester.pa.mail.comcast.net with comcast id xbDs1h0070mv7h053bGTr7; Tue, 15 Nov 2011 23:16:27 +0000 Received: from koitsu.dyndns.org ([67.180.84.87]) by omta11.westchester.pa.mail.comcast.net with comcast id xbGQ1h00S1t3BNj3XbGSAi; Tue, 15 Nov 2011 23:16:27 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 8807D102C1D; Tue, 15 Nov 2011 15:16:23 -0800 (PST) Date: Tue, 15 Nov 2011 15:16:23 -0800 From: Jeremy Chadwick To: GR Message-ID: <20111115231623.GA5712@icarus.home.lan> References: <20111115221453.GO53701@thebe.jupiter.sigsegv.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Kristof Provost , freebsd-current@freebsd.org, freebsd-stable@freebsd.org Subject: Re: SIOCGIFADDR broken on 9.0-RC1? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2011 23:16:27 -0000 On Tue, Nov 15, 2011 at 11:35:37PM +0100, GR wrote: > >From "Kristof Provost" : > [..] > > The 'ia' pointer is later used to return the IP address. > > > > In other words: it returns the first address on the interface > > of type IF_INET (which isn't assigned to a jail). > > > > I think the order of the addresses is not fixed, or rather it depends > > on > > the order in which you assign addresses. In the handling of > > SIOCSIFADDR > > new addresses are just appended: > > > > TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); > > > > I don't believe this has changed since 8.0. Is it possible something > > changed in the network initialisation, leading to the addresses being > > assigned in a different order? > > > > Eagerly awaiting to be told I'm wrong, > > Kristof > > Thanks Kristof. It appears you are right, the order of assignement is important. > I configured my interface using DHCP, and added aliases (all in /etc/rc.conf). > But on the 8.2-RELEASE, I used static configuration. > > So, I switched to static assignement and it changes the behaviour (and "fixes" the "bug"). > My guess is that during the time waiting for the DHCP offer, all aliases are already configured on the network interface, and the IP address given by DHCP is added at the end of the tail. > > Is that a wanted behaviour? I find it dangerous (i.e. not exactly what a user is expecting). > > Note: my aliases are attributed to jails. I would recommend adding synchronous_dhclient="yes" to /etc/rc.conf. This will cause dhclient (the DHCP client) to wait until it gets an answer + IP back from the DHCP server before continuing with the rc.d scripts. The default is "no". -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |