Subject: Re: Moving ethfoo in the main tree
To: Manuel Bouyer <>
From: Quentin Garnier <>
List: tech-kern
Date: 12/13/2004 16:57:53
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Dec 13, 2004 at 04:49:06PM +0100, Manuel Bouyer wrote:
> > Here's my idea of how things could be done.  Currently I have the whole
> > space of minor numbers devoted to actual ethfoo interfaces, indexed by
> > the number.  The exception is the cloner device, whose minor number is
> > 0xfffff.
> >=20
> > I could simply part in half the minor number space between tun and tap
> > interfaces, and have two cloners.  That way the code is shared, but you
> > get two cloning interface and two cloning devices.
> >=20
> > Moreover, I would keep minor numbers starting at 0 for tun devices, and
> > get tun major number for the merged ethfoo.  That way existing tun0,
> > tun1 etc. devices found in /dev would still work as before.
> >=20
> > You would have tap, tap0, tap1, ... and tun, tun0, tun1, ... in /dev,
> > with tap's minor being 0xfffff, tun's 0x7ffff, tap0's 0x80000 and
> > tun0's 0.  That way you choose first what kind of device you want,
> > then you open it.
> >=20
> > That way of doing it would make things much simpler.
> >=20
> > As I said, we also need an API to retrieve the name of the interface.
> > Linux writes the name of the interface in the answer to the setting-up
> > ioctl() call.  I don't know if FreeBSD has a specific API for that
> > as qemu uses devname(), but our devname(3) is too weak for the dynamic
> > aspect of such interfaces.  Another TUN* ioctl() would do just fine.
> >=20
> > Comments?
> How would we create an interface of the desired type (i.e.
> ifconfig foo1 create) before using it ?

Two ifcloners.  So you would do either 'ifconfig tap0 create' or
'ifconfig tun0 create'.

> In some cases, having the interface created when the application wants to
> use it isn't the desired behavior, we want to application to use an
> already-existing and configured interface.

I'm well aware of that, that's why I provide both traditional cdevsw
access and a cloning device.

Quentin Garnier - -
"Commala-come-five! / Even when the shadows rise!
To see the world and walk the world / Makes ya glad to be alive."
Susannah's Song, The Dark Tower VI, Stephen King, 2004.

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

Version: GnuPG v1.2.6 (NetBSD)