netfilter: conntrack: compute l3proto nla size at compile time
avoids a pointer and allows struct to be const later on. 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
eee6ebbac1
commit
0d03510038
@@ -20,6 +20,9 @@ struct nf_conntrack_l3proto {
|
||||
/* L3 Protocol Family number. ex) PF_INET */
|
||||
u_int16_t l3proto;
|
||||
|
||||
/* size of tuple nlattr, fills a hole */
|
||||
u16 nla_size;
|
||||
|
||||
/* Protocol name */
|
||||
const char *name;
|
||||
|
||||
@@ -49,24 +52,18 @@ struct nf_conntrack_l3proto {
|
||||
int (*get_l4proto)(const struct sk_buff *skb, unsigned int nhoff,
|
||||
unsigned int *dataoff, u_int8_t *protonum);
|
||||
|
||||
#if IS_ENABLED(CONFIG_NF_CT_NETLINK)
|
||||
int (*tuple_to_nlattr)(struct sk_buff *skb,
|
||||
const struct nf_conntrack_tuple *t);
|
||||
int (*nlattr_to_tuple)(struct nlattr *tb[],
|
||||
struct nf_conntrack_tuple *t);
|
||||
const struct nla_policy *nla_policy;
|
||||
#endif
|
||||
|
||||
/* Called when netns wants to use connection tracking */
|
||||
int (*net_ns_get)(struct net *);
|
||||
void (*net_ns_put)(struct net *);
|
||||
|
||||
/*
|
||||
* Calculate size of tuple nlattr
|
||||
*/
|
||||
int (*nlattr_tuple_size)(void);
|
||||
|
||||
int (*nlattr_to_tuple)(struct nlattr *tb[],
|
||||
struct nf_conntrack_tuple *t);
|
||||
const struct nla_policy *nla_policy;
|
||||
|
||||
size_t nla_size;
|
||||
|
||||
/* Module (if any) which this is connected to. */
|
||||
struct module *me;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user