On Sunday 2008-04-06 17:41, Patrick McHardy wrote: > Jan Engelhardt wrote: >> --- a/extensions/libip6t_LOG.c >> +++ b/extensions/libip6t_LOG.c >> @@ -269,6 +269,7 @@ static struct ip6tables_target log_target6 = { >> .extra_opts = LOG_opts, >> }; >> >> +void _init(void); >> void _init(void) >> { >> register_target6(&log_target6); > > I don't like this very much. But it is relatively error-safe. > A global prototype I remember why I did not do that... every .c file would have to #include "proto.h" or some kind - is this really that badly needed? This would also cause a needless recompilation of all modules if the list of modules changed. > or simply using __attribute__ ((constructor)) and > __attribute__ ((destructor)) would be preferred. Been there, done that, threw it out. Doing a CTOR with iptables-static leads to a NULL deref because the ctors get run before any of the iptables data structures are initialized. Of course, one can always cook up more and more magic, i.e. test for if (!initalized) run_init_first(); in a ctor (as well as main(), for consistency), but that's the least thrilling thing to do IMO. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html