From owner-freebsd-net Thu Feb 1 14: 1:29 2001 Delivered-To: freebsd-net@freebsd.org Received: from postal.sdsc.edu (postal.sdsc.edu [132.249.20.114]) by hub.freebsd.org (Postfix) with ESMTP id 901DE37B491 for ; Thu, 1 Feb 2001 14:01:10 -0800 (PST) Received: from multivac.sdsc.edu (multivac.sdsc.edu [132.249.20.57]) by postal.sdsc.edu (8.9.3/8.9.3/SDSCserver-16) with ESMTP id OAA01958 for ; Thu, 1 Feb 2001 14:01:09 -0800 (PST) Received: from localhost by multivac (8.9.3+Sun/1.11-SolarisClient) with ESMTP id OAA20454; Thu, 1 Feb 2001 14:01:09 -0800 (PST) Date: Thu, 1 Feb 2001 14:01:09 -0800 (PST) From: Matthew Luckie To: Subject: Re: protosw kernel module In-Reply-To: <20010201131820.P26076@fw.wintelcom.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org I'm just wondering if someone on -net can offer some advice on how to go about implementing something like this. I am looking at the ip_input/ip_init functions now. Assuming that it would be a good idea to maintain the protosw table as it is now (i.e. statically declared), perhaps another way to go about this would be to add a single entry to the protosw table that takes care of protocols that are inserted dynamically. the ip_protox table would then be modified dynamically to switch to this pr_input function instead of the raw ip pr_input function that it would otherwise do. the protosw->pr_input function would then delegate the call to the appropriate pr_input function held in a seperate table u_char kld_ip_protox[IPPROTO_MAX]; struct ipprotosw *kld_inetsw; int ip_kld_input(struct mbuf *m, int off, int proto) { (*kld_inetsw[kld_ip_protox[proto]].pr_input)(m,off,proto); } i am rather ignorant of data structures, so what type of data structure would be suited to this lookup task? Perhaps a pointer to a malloc'd array would be good, and if a new protocol is to be inserted to the kernel, then to re-allocate the necessary tables to accomodate a new protocol. Given that the task of re-allocating tables would not happen very often, I think this might be a good way to approach this task. I appreciate any criticism anyone could offer on this approach to this idea Thanks Matthew On Thu, 1 Feb 2001, Alfred Perlstein wrote: > * Matthew Luckie [010201 13:13] wrote: > > Hi there > > > > I am willing to do some work to enable the kernel to do this, if it > > currently cannot, if a committer is interested in adding this feature to > > the kernel. However, I guess that this type of enhancement might not be > > wanted. > > It really depends on how you implement it. :) Give it a shot > and submit patches. > > -- > -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] > "I have the heart of a child; I keep it in a jar on my desk." > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message