Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Nov 2011 15:16:23 -0800
From:      Jeremy Chadwick <freebsd@jdc.parodius.com>
To:        GR <freebsd@gomor.org>
Cc:        Kristof Provost <kristof@sigsegv.be>, freebsd-current@freebsd.org, freebsd-stable@freebsd.org
Subject:   Re: SIOCGIFADDR broken on 9.0-RC1?
Message-ID:  <20111115231623.GA5712@icarus.home.lan>
In-Reply-To: <ee86fcc8-de74-4506-bad8-a6a35209b5cf@ubuntu64>
References:  <20111115221453.GO53701@thebe.jupiter.sigsegv.be> <ee86fcc8-de74-4506-bad8-a6a35209b5cf@ubuntu64>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Nov 15, 2011 at 11:35:37PM +0100, GR wrote:
> >From "Kristof Provost" <kristof@sigsegv.be>:
> [..]
> > 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 |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111115231623.GA5712>