Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jun 2001 18:55:45 -0500
From:      Alfred Perlstein <bright@sneakerz.org>
To:        Stuart Eichert <seichert@coopcomp.com>
Cc:        net@freebsd.org
Subject:   Re: Am I missing something?
Message-ID:  <20010627185545.J74703@sneakerz.org>
In-Reply-To: <20010627164107.A48973@gourdy.coopcomp.com>; from seichert@coopcomp.com on Wed, Jun 27, 2001 at 04:41:07PM -0700
References:  <20010627111222.A9434@gourdy.coopcomp.com> <20010627143042.F74703@sneakerz.org> <20010627164107.A48973@gourdy.coopcomp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I hope you don't mind the -net carbon copy, but I wanted this
preserved in the archives for others doing a search on the subject.

* Stuart Eichert <seichert@coopcomp.com> [010627 18:41] wrote:
> On Wed, Jun 27, 2001 at 02:30:42PM -0500, Alfred Perlstein wrote:
> <snip, my old comment>
> > Why not provide a patch that allows one to add callbacks to the list?
> > 
> > for ether_output under the default case you would walk the list
> > looking for your type, since for the most part packets will be in
> > AF_INET and when no callbacks are registered the array will be
> > short, transmit should be cheap.  For recieve if you look in
> > the default case you can see ng_ether_input_orphan_p being used to
> > input packets that don't match a known type.
> 
> 	It was my feeling that a good idea might be to set aside a
> range of ETHERTYPEs for research/testing use.  Put them after the normal ones,
> so that AF_INET and others will get checked for first (thus hopefully not
> harming performance for the normal case).  The last case statement could be
> something that sees if the type is in the research range, and then if it
> is it could do some sort of lookup in a hash table/cache deal and then
> call the appropriate callback funcs.  
> 
> 	My goal for this project is to not only provide code for adding a
> network protocol to FreeBSD, but also document the process so that others
> can learn how to modify the network subsystem.  In addition I would like to
> provide a framework for people to dynamically add and remove new protocols.
> If I was able to patch if_ethersubr (and probably a few others) to allow for
> these dynamically available protocols, what are the chances that the code
> would be committed and become part of FreeBSD 4.4 or 5.0?  The reason I ask
> is that I would like to reduce the barriers to people using FreeBSD for this
> purpose.  I would like to say to them "Hey install FreeBSD 4.4 with default
> settings, nothing special, download a few of these network protocol modules,
> load them, try the test apps"  After they do that, hopefully they will
> read the documents about how to add protocols to FreeBSD, or at least use
> of the tools/libs I provide to add their own protocols.  The intended market
> is researchers who may or may not currently use FreeBSD in their research.

Actually if you use netgraph this is all already done.  You can
see the netgraph callbacks in bother ether_input and ether_output,
just use those and you should be fine.  I'm not terribly familiar
with netgraph, however i've heard it's trivial to use a subset of
the facilities, meaning using netgraph to provide your hooks should
be simple and not require you to learn an aweful lot about netgraph
versus just getting your stuff working.

All you need to do is add your handler to the ng_ether_input_p
and ng_ether_input_orphan_p callchains and you should be fine.

-Alfred

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?20010627185545.J74703>