tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: interface detach/destroy hook?



On Mon, Nov 17, 2008 at 12:58:43AM -0500, der Mouse wrote:
> >> Am I missing something, or is there really nothing in place to deal
> >> generically with code that keeps struct ifnet pointers finding out
> >> when their structs ifnet disappear?
> > The PFIL_IFNET_DETACH hook exists for exactly this purpose.  That is
> > the generic interface for this kind of operations.
> 
> Hmm, so I was close.  Should I error out ifndef(PFIL_HOOKS), or is the
> preferred tack to build anyway and just let the system crash if an
> interface is removed out from under an srt (or pppoe or etc), or what?
> It appears to me that the stuff in pfil.c doesn't exist without
> PFIL_HOOKS (or ipf or pf, which I definitely do not want to depend on).

I would just depend on PFIL_HOOKS. It adds a 7KB source file and the
actual hooks, so while the overhead is not 0, it is quite low. If
runtime overhead is of certain, it might be a good idea to split
pfil_run_hooks into a small inline function that checks if a hook exists
and only calls the real function in that case, but that is
micro-optimisation.

Joerg


Home | Main Index | Thread Index | Old Index