Date: Thu, 1 Feb 2001 14:01:09 -0800 (PST) From: Matthew Luckie <mjl@SDSC.EDU> To: <net@freebsd.org> Subject: Re: protosw kernel module Message-ID: <Pine.GSO.4.30.0102011340510.19483-100000@multivac.sdsc.edu> In-Reply-To: <20010201131820.P26076@fw.wintelcom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <mjl@SDSC.EDU> [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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.30.0102011340510.19483-100000>