Vallo Kallaste wrote: > On Thu, Dec 19, 2002 at 08:46:44PM -0800, Sam Leffler <[EMAIL PROTECTED]> wrote: > > > #ifndef PFIL_HOOKS > > > #error "You must specify PFIL_HOOKS when using ipfilter" > > > #endif > > > > > > Unfortunately there's no way that I know to express this if ipfilter is > > > loaded as a module. > > > > Duh, there'll probably be unresolved symbols if you try to load ipl.ko w/o > > PFIL_HOOKS defined in the kernel. > > Yes, and this "undefined symbols" message will make no sense from > user perspective.
Then fix it. The fix is trivial: 1) Create accessor/mutator functions which are *not* protected by "#ifndef PFIL_HOOKS". 2) Use the accessor/mutator functions from within the ipfilter code to register and deregister use of the hooks. 3) In the case of the "#ifndef PFIL_HOOKS", cause the accessor/mutator functions to return errors. Like so: #ifdef PFIL_HOOKS pfil_hook_t *pfil_hook_func; #endif int pfil_set_hook( pfil_hook_t *func) { #ifdef PFIL_HOOKS pfil_hook_func = func; return( 0); #else /* !PFIL_HOOKS */ return( -1); #endif /* !PFIL_HOOKS */ } ...the (in this example) mutator function will always be defined, and the error in a kernel without "PFIL_HOOKS" defined can be trapped by the caller during the module registration phase, at which point a console error can be printed. -- Terry To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message