Subject: Re: Moving ethfoo in the main tree
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 12/13/2004 16:57:53
--lIrNkN/7tmsD/ALM
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?
>=20
> 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.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"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.

--lIrNkN/7tmsD/ALM
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQb28AdgoQloHrPnoAQIipggAjTaEtrcAoVSMlfxWFKzD38ZjysovIb04
tjPO5+cMdI+1tZrd1TQi70NAR6T4FHZ0ygUNu+mGlzWh82Gr6dCvLeG4rEUq1JFY
RWWEJnYyWuMRMW2wYcEGzyiW2JMi1rdDisaM7mwcK+2y+ub2CYASZs7UD72eyXBW
u3noxj7NlODEr0aDmqjIoIjpwc/vetcyKSWm4N2r1fy8gBUsS3wtcvyTtkaiR62D
XrO6qM/B+yb3Nn/lyudNSPt57Ub+6GcSw3wE/d40zqYTIZdfzce7lywOZEKw/nYB
Pa9zdJXMNXXSubPYt5cql88uHPhBT24PJskvUEXJwEKiOCcmeUlcDw==
=3Bk7
-----END PGP SIGNATURE-----

--lIrNkN/7tmsD/ALM--