Subject: Re: Implementing per protosw pfil hooks.
To: Matt Thomas <matt@3am-software.com>
From: Darren Reed <darrenr@reed.wattle.id.au>
List: tech-net
Date: 12/11/1999 14:11:49
In some email I received from Matt Thomas, sie wrote:
> At 06:38 PM 12/10/99 , Darren Reed wrote:
> >Some comments on an exercise this afternoon to do this:
> >
> >1. Adding pfil struct reference to protosw.  It seems best to do this
> >    without it being conditional on PFIL_HOOKS so that user programs pick
> >    don't need to screw with this option.  A side effect of this is that
> >    adding a "#include <net/pfil.h>" to the top of <sys/protosw.h> was the
> >    quick way to avoid touching many files where <sys/protosw.h> is used
> >    already.
> 
> Just add a 
> struct pfil;
> (or whatever) to protosw.h.  don't include net/pfil.h
> 
> I assume this is struct pfil *, right?

No...I was trying to having to allocate things.  However, that would
be much cleaner...

> >2. New struct created in pfil.h which contains two tailq heads and an
> >    init variable - pfil_init_done has been removed: an init must be done
> >    per pfil struct for each protosw.  Considering this, I'd like to be
> >    able to do some sort of pfil_init() in ip_init() when inetsw and
> >    ip_protox[] are initialized.
> 
> Why can't this be done in dom_init? (struct domain) 

Because this is a per-protocol filtering thing, not per-domain ?  Also,
it would appear that per-domain protocol init functions (for IPv4 at
least) are all NULL.

Maybe pr_init would be better, but still, you'd need to (at least) pass
"struct protosw *" to pr_init ?

> >3. ip_protox[] was moved from ip_input.c to in_proto.c and an extern for it
> >    added to <sys/protosw.h> and removed from where it was present in .c
> >    files.
> 
> No.  That is not appropriate.
[...]
> Ditto.  protosw should not have any family/protocol specific definitions.

ok.  Is there a more appropriate place then ?  <netinet/in.h> and
<netinet/in6.h> for each of ipv4 and ipv6 ?  I can't believe that
the current way this is done is seen to be "correct".

Darren