Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Feb 2002 15:48:28 -0600
From:      Maxime Henrion <mux@sneakerz.org>
To:        freebsd-arch@FreeBSD.org
Cc:        brooks@freebsd.org
Subject:   Patches to if_loop + the interface cloning framework
Message-ID:  <20020212154828.A25374@sneakerz.org>

next in thread | raw e-mail | index | archive | help
	Hello all,


I recently noticed that the if_loop interface was using a loader tunable
(net.nloop), which is a sysctl later, to allow having more than one
loopback interface.  Since Brooks Davis recently gave FreeBSD a more
generic interface cloning framework, I started to hack if_loop to use it
instead.  The result of this work is available at :
	http://www.sneakerz.org/~mux/loop.diff

This patch allows the loopback interfaces to be managed the same way
as other cloning interfaces (gif, vlan...), that is, with
``ifconfig loX {create|destroy}''.  There is however one problem with
this patch, as stated in the added XXX comment :
	/*
	 * Prevent lo0 from being destroyed
	 * XXX Since the clone_destroy() function
	 * is void, there is no way to return
	 * an error back to the upper layer.
	 */

The reason why lo0 can't be destroyed is that there is a global struct
ifnet *loif pointer which points to it used by some code in the kernel.
Destroying this interface would cause panics if this pointer is accessed
later.  We thus need a way to report this error to the upper layer.  I
slightly modified the interface cloning framework to this purpose,
changing the prototype of foo_clone_destroy() to be a function returning
an int.  The patch containing this change plus the if_loop change is
available at :
	http://www.sneakerz.org/~mux/net.diff

Of course, any reviews or comments would be greatly appreciated.

Thanks,
Maxime Henrion

Note: the if_loop part of the changes also include some more minor
modifications : the removing of a few __P() macros, and the replacement
of all "lo" by a LONAME macro.

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




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