netfilter: conntrack: don't cache nlattr_tuple_size result in nla_size
We currently call ->nlattr_tuple_size() once at register time and cache result in l4proto->nla_size. nla_size is the only member that is written to, avoiding this would allow to make l4proto trackers const. We can use ->nlattr_tuple_size() at run time, and cache result in the individual trackers instead. This is an intermediate step, next patch removes nlattr_size() callback and computes size at compile time, then removes nla_size. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
committed by
Pablo Neira Ayuso
parent
7f4dae2d7f
commit
5caaed151a
@@ -74,7 +74,7 @@ struct nf_conntrack_l4proto {
|
||||
int (*tuple_to_nlattr)(struct sk_buff *skb,
|
||||
const struct nf_conntrack_tuple *t);
|
||||
/* Calculate tuple nlattr size */
|
||||
int (*nlattr_tuple_size)(void);
|
||||
unsigned int (*nlattr_tuple_size)(void);
|
||||
int (*nlattr_to_tuple)(struct nlattr *tb[],
|
||||
struct nf_conntrack_tuple *t);
|
||||
const struct nla_policy *nla_policy;
|
||||
@@ -144,7 +144,7 @@ int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
|
||||
const struct nf_conntrack_tuple *tuple);
|
||||
int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
|
||||
struct nf_conntrack_tuple *t);
|
||||
int nf_ct_port_nlattr_tuple_size(void);
|
||||
unsigned int nf_ct_port_nlattr_tuple_size(void);
|
||||
extern const struct nla_policy nf_ct_port_nla_policy[];
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
|
||||
Reference in New Issue
Block a user