From owner-freebsd-arch Tue Feb 12 13:48:41 2002 Delivered-To: freebsd-arch@freebsd.org Received: from sneakerz.org (sneakerz.org [216.33.66.254]) by hub.freebsd.org (Postfix) with ESMTP id 11B3A37B404; Tue, 12 Feb 2002 13:48:34 -0800 (PST) Received: by sneakerz.org (Postfix, from userid 1023) id 5237A5D006; Tue, 12 Feb 2002 15:48:28 -0600 (CST) Date: Tue, 12 Feb 2002 15:48:28 -0600 From: Maxime Henrion To: freebsd-arch@FreeBSD.org Cc: brooks@freebsd.org Subject: Patches to if_loop + the interface cloning framework Message-ID: <20020212154828.A25374@sneakerz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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