Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 May 2004 10:18:38 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Peter Pentchev <roam@ringlet.net>
Cc:        freebsd-net@freebsd.org
Subject:   Re: [RFC] ifconfig: match by link-level address
Message-ID:  <20040520171833.GA22494@Odin.AC.HMC.Edu>
In-Reply-To: <20040520162919.GA1971@straylight.m.ringlet.net>
References:  <20040520162919.GA1971@straylight.m.ringlet.net>

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

--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, May 20, 2004 at 07:29:19PM +0300, Peter Pentchev wrote:
> Hi,
>=20
> I found out recently that the Linux (or at least recent RedHat) startup
> scripts could be configured to not bring up an Ethernet interface unless
> it has a specified MAC address.  This, combined with the wonderful
> interface renaming functionality recently committed to -CURRENT, led me
> to the idea of interface renaming on boot-up, by hardware addresses -
> something like 'I don't care how you detected this network card, or how
> many others like it are there, but the card with MAC address
> 00:03:0d:08:dc:a7 will be known as sis0int from now on'.
>=20
> The main missing piece was the ability to find an interface by MAC
> address; hence the attached patch, also available at
> http://www.ringlet.net/~roam/bsd-patches/src5/sbin-ifconfig-hwmatch.patch
> http://people.FreeBSD.org/~roam/bsd-patches/src5/sbin-ifconfig-hwmatch.pa=
tch
>=20
> It teaches ifconfig(8) to treat interface "names" beginning with 'hw-'
> as link-level addresses; ifconfig tries to find an interface with this
> address and behaves as if its name was specified on the command line:
>=20
> [roam@straylight ~/fbsd/r/src/sbin/ifconfig]> ./ifconfig hw-00:03:0d:08:d=
c:a7
> sis0: flags=3D8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>         options=3D8<VLAN_MTU>
>         inet 10.0.8.129 netmask 0xffff0000 broadcast 10.0.255.255
>         inet 192.168.1.13 netmask 0xffffff00 broadcast 192.168.1.255
>         ether 00:03:0d:08:dc:a7
>         media: Ethernet autoselect (100baseTX <full-duplex>)
>         status: active
> [roam@straylight ~/fbsd/r/src/sbin/ifconfig]>
>=20
> This could be the first step towards teaching rc.conf about something like
> network_interfaces_rename=3D"hw-00:03:0d:08:dc:a7 sis0int"
>=20
> I had initially written my own function for parsing the user-supplied
> address into a sequence of bytes instead of using ether_aton(); it would
> have the advantage of being able to specify 'hw-' to match lo0's empty
> link-level "address".  However, the odds of somebody actually wishing to
> rename lo0 don't seem to be so high :)

I don't really like the idea of adding magic values to the interface
namespace that only work with ifconfig.  If you want ifconfig to match
the lladdr, I'd suggest adding a flag that means match interface by
address instead of by name.  That would be a fairly simple change to
your patch and seems like a potentialy useful feature.

FWIW, I've talked to Warner about automaticly renaming interfaces based
on things like their MAC address or their PCI slot and we think devd
will eventually be the place to do this.  We're probably going to have
to rethink interface configuration for this to work though.

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--82I3+IH0IqGh5yIs
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFArOhnXY6L6fI4GtQRApoUAKDD137CCU8b/nKeWZCJ8h8+GIx3UQCfYRwu
zkcgBHXgWn6uPNYOlZ2pRaU=
=jUJD
-----END PGP SIGNATURE-----

--82I3+IH0IqGh5yIs--



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