Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2001 14:20:31 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Hajimu UMEMOTO <ume@mahoroba.org>
Cc:        hackers@FreeBSD.ORG, brian@Awfulhak.org, phk@critter.freebsd.dk, arch@FreeBSD.ORG
Subject:   Re: cloning network interfaces
Message-ID:  <20010611142030.A15283@Odin.AC.HMC.Edu>
In-Reply-To: <20010610.232907.74740159.ume@mahoroba.org>; from ume@mahoroba.org on Sun, Jun 10, 2001 at 11:29:07PM %2B0900
References:  <200106071119.f57BJr766008@hak.lan.Awfulhak.org> <20010607164812.A32379@Odin.AC.HMC.Edu> <20010608191904.A18847@Odin.AC.HMC.Edu> <20010610.232907.74740159.ume@mahoroba.org>

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

--BOKacYhQ+x31HxR3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Jun 10, 2001 at 11:29:07PM +0900, Hajimu UMEMOTO wrote:
> I think it is not BSD network way.  Recent NetBSD has network
> interface cloning.  It uses SIOCIFCREATE and SIOCIFDESTROY.  It may
> good to port it to FreeBSD.

I've looked it over and I generally like it.  There is one problem
though.  That's the requirement that you use static units.  The problem
with this is that it forces you to implement free unit scanning in
userland if you just want to create a unit and don't care what it is.
If you have to do this, and things are being changed at any kind of
significant rate, you have race condition between scanning the
interface list for a free unit and trying to allocate it.  This race can
theoreticaly lead to starvation.

My proposed solution is threefold.  First, change the ifc_create pointer's
type to:

	int     (*ifc_create)(struct if_clone *, int *);

so you can return a unit if the caller requests a wildcard unit (by
passing -1).  Second, move unit management in to the driver rather then
just using ifunit in if_clone_create.  Drivers could choose to implement
wildcarding or not and if not could simply use ifunit for their test.
Third, make if_clone_lookup treat names like "gif#" as a wildcard
request and set unit to -1 as appropriate.  These changes break
compatability with NetBSD slightly, but it's just a few lines to convert
an existing NetBSD clone_create handler to this style and it could
easily be handled with #ifdef's.

Thoughts, comments, objections?

-- 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

--BOKacYhQ+x31HxR3
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7JTYdXY6L6fI4GtQRAjwhAKCgP7XmJFS0ccQ16Dm4OLdrnXI0DwCeKb3p
qJxw/Rk9OAT8cAiWx7hI3uQ=
=5RL0
-----END PGP SIGNATURE-----

--BOKacYhQ+x31HxR3--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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