From owner-freebsd-net@FreeBSD.ORG Wed Mar 14 14:48:33 2007 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F2DFA16A404 for ; Wed, 14 Mar 2007 14:48:33 +0000 (UTC) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.freebsd.org (Postfix) with ESMTP id DBEAF13C465 for ; Wed, 14 Mar 2007 14:48:33 +0000 (UTC) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.13.6) with ESMTP id l2EEmBpB079035; Wed, 14 Mar 2007 06:48:11 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id l2EEmBcG079034; Wed, 14 Mar 2007 07:48:11 -0700 (PDT) (envelope-from rizzo) Date: Wed, 14 Mar 2007 07:48:11 -0700 From: Luigi Rizzo To: Yar Tikhiy Message-ID: <20070314074811.A78933@xorpc.icir.org> References: <20070310153534.GA35834@comp.chem.msu.su> <20070313004543.A54774@xorpc.icir.org> <20070314095725.GA1766@comp.chem.msu.su> <20070314043506.A76618@xorpc.icir.org> <20070314141142.GB3830@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20070314141142.GB3830@comp.chem.msu.su>; from yar@comp.chem.msu.su on Wed, Mar 14, 2007 at 05:11:43PM +0300 Cc: freebsd-net@freebsd.org Subject: Re: Who is to load dummynet.ko? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Mar 2007 14:48:34 -0000 On Wed, Mar 14, 2007 at 05:11:43PM +0300, Yar Tikhiy wrote: > On Wed, Mar 14, 2007 at 04:35:06AM -0700, Luigi Rizzo wrote: ... > > actually, i think it is the kernel itself (in the setsockopt handler, > > once it validates the rule) that should load the module, and not leave > > the task to the userland utility. Other modules already do this, > > e.g. iwi loads the firmware autonomously, and maybe even netgraph components > > do something similar. > > > > For dummynet and divert, this can be surely put in the setsockopt > > handler which is in ipfw.ko - if you need to autoload ipfw.ko, > > then i am not sure where to put the hooks (in the kernel) but i am > > pretty confident that there must be a good place. > > As our fortune file puts it, "If God is dead, who will save the > Queen?" :-) We seem to have a sort of a chicken and egg problem not really. IP_FW_GET (and other commands) are processed in sys/netinet/raw_ip.c::rip_ctloutput() so it's there that we can try and autoload the module (if ip_fw_ctl_ptr == NULL). I don't know if there are hooks to autoload a protocol stack, as some are not modules - no ipv4.ko, ipv6.ko, but there is arcnet.ko, but you could in principle do the same thing with protocols and anywhere there is a missing function, annotate it with the functions to autoload the module supplying it. cheers luigi