Re: RFC: Designing per chain rule cache support in libnftnl

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

 



Phil Sutter <phil@xxxxxx> wrote:
> > If user doesn't want it cleared at nftnl_chain_free() time they can
> > always allocate a new nftnl_rule_list and splice to that list.
> 
> Good point. What do you think about the simple approach of introducing:
> 
> | struct nftnl_rule_list *nftnl_chain_get_rule_list(const struct nftnl_chain *);

Looks fine to me.

> This would allow to reuse nftnl_rule_list routines from libnftnl/rule.h.
> One potential problem I see is that users may try to call
> nftnl_rule_list_free(). Can we prevent that somehow?

Document that nftnl_rule_list_free() pairs with nftnl_rule_list_alloc() :-)

I don't think its an issue.
We could add a 'bool make_free_no_op' to nftnl_rule_list and set that to
true for nftnl_rule_list structures that are allocated indirectly on
behalf of nftnl_chain struct, but I think thats taking things too far.

> A more fool-proof (but somewhat tedious) solution would be to duplicate
> nftnl_rule_list API for use on an nftnl_chain. But I don't quite like
> that.

I don't like it either, API bloat is problem.



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

  Powered by Linux