Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Dec 2009 11:48:31 -0600
From:      Brooks Davis <brooks@freebsd.org>
To:        Angelo Hongens <angelo@hongens.nl>
Cc:        Brooks Davis <brooks@freebsd.org>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Re: FreeBSD 8.0 problems with interface renaming and dhcp?
Message-ID:  <20091207174831.GA75154@lor.one-eyed-alien.net>
In-Reply-To: <4B1A0B39.5060201@hongens.nl>
References:  <4B195845.4000201@hongens.nl> <20091204221530.GA42198@lor.one-eyed-alien.net> <4B1A0B39.5060201@hongens.nl>

next in thread | previous in thread | raw e-mail | index | archive | help

--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Dec 05, 2009 at 08:26:49AM +0100, Angelo Hongens wrote:
> On 04-12-2009 23:15, Brooks Davis wrote:
> > On Fri, Dec 04, 2009 at 07:43:17PM +0100, Angelo Hongens wrote:
> >> On most of my BSD machines I rename the interfaces to nic0. This way, I
> >> can swap cards and drivers, and keep the rest of my config the same.
> >>
> >> I upgraded one of these machines from 7.2 to 8.0 (both standard kernel=
),
> >> and suddenly the machine would not get a dhcp lease.
> >>
> >> In my /etc/rc.conf:
> >>
> >> ifconfig_em0_name=3D"nic0"
> >> ifconfig_nic0=3D"DHCP"
> >>
> >> The machine woud boot, but not get an ip. (and no dhclient output while
> >> booting). And ifconfig would show the nic nic0 up, but without an ip. =
If
> >> I do 'dhclient nic0' it immediately gets an ip, and all is well.
> >>
> >> If I do NOT rename the interface but just config: ifconfig_em0=3D"DHCP"
> >> everything works as well..
> >>
> >> So is this a new bug or feature introduced in FreeBSD8? Is it something
> >> that can be fixed? (So dhclient is executed for renamed interfaces.)
> >=20
> > I think the problem here is that with the new DHCP configuration where
> > we only start DHCP based on link events we're loosing a race between the
> > link coming up and the rename occurring.  The absolutely correct answer=
 is
> > that the nic should no be trying to do anything until it is configured
> > up and I don't think that happens before the rename (it shouldn't).
> > It's likely the case though that a number of nics incorrectly start doi=
ng
> > things before they are configured and thus racing the rename.  The
> > easiest workaround in the rc.d code would probably be to add some code
> > to the rename section to take the interface down and then bring it back
> > up after the rename.  That should cause it to renegotiate and generate
> > an event.
> >=20
> > The no code change workaround is to change DHCP to SYNCDHCP which will
> > restore the old behavior on this interface.
> >=20
> > -- Brooks
>=20
> Great, configuring SYNCDHCP does exactly what it should do. I'm happy.
>=20
> If I understand you correctly, the long term solution would be to fix
> the 'em' driver so that it never does anything with an interface until
> it's configured (in my case: renamed). I never even touched C code, so I
> hope someone else will look into that ;)

My view is that interfaces should be "down" and ideally in maximum power
save mode until they are configured "up" due to having an ifconfig_<ifn>
or related entry in /etc/rc.conf.  As a result, they shouldn't do
anything that would result in events being generated until after a
rename.

-- Brooks

--n8g4imXOkfNTN/H1
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iD8DBQFLHT/vXY6L6fI4GtQRAkKeAJwN0WpDoOEc31e4Zf5rcP0gf0FZMACZAYAD
Tq7YkGTae+fGIYfY1JbeO4w=
=77uc
-----END PGP SIGNATURE-----

--n8g4imXOkfNTN/H1--



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