Re: [nft PATH 01/16] libnftables: introduce library

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

 



Hey,

On Thu, Aug 17, 2017 at 07:09:02PM +0200, Eric Leblond wrote:
> On Thu, 2017-08-17 at 10:57 +0200, Phil Sutter wrote:
> > On Wed, Aug 16, 2017 at 10:42:55PM +0200, Eric Leblond wrote:
[...]
> > > +void nft_global_init(void)
> > > +{
> > > +	mark_table_init();
> > > +	realm_table_rt_init();
> > > +	devgroup_table_init();
> > > +	realm_table_meta_init();
> > > +	ct_label_table_init();
> > > +	gmp_init();
> > > +#ifdef HAVE_LIBXTABLES
> > > +	xt_init();
> > > +#endif
> > > +}
> > > +
> > > +void nft_global_deinit(void)
> > > +{
> > > +	ct_label_table_exit();
> > > +	realm_table_rt_exit();
> > > +	devgroup_table_exit();
> > > +	realm_table_meta_exit();
> > > +	mark_table_exit();
> > > +}
> > 
> > How about calling these from nft_context_new() and
> > nft_context_free()?
> 
> I want to be able to have multiple context for a single process. Hence
> I defined a global init and deinit. But maybe it does not really make
> sense and could be attached to each context or init could be done at
> first usage.

My idea was to implement simple reference counting to see whether the
library was already initialized and whether it is safe to deinit. Of
course this needs some serialization for thread-safety.

Or maybe the deinit can be ignored completely and nft_global_init() just
has to check whether data is already initialized or not.

Cheers, Phil
--
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



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux