diff options
author | Florian Westphal <fw@strlen.de> | 2017-08-12 00:57:02 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-08-24 18:52:32 +0200 |
commit | 0d03510038bda70b5a4a252e8216822e6ce0cbdb (patch) | |
tree | 1c7acf5e1d75424f44404e2824521b341bd8e16f /net/netfilter/nf_conntrack_proto.c | |
parent | eee6ebbac18a189ef33d25ea9b8bcae176515e49 (diff) | |
download | linux-stable-0d03510038bda70b5a4a252e8216822e6ce0cbdb.tar.gz linux-stable-0d03510038bda70b5a4a252e8216822e6ce0cbdb.tar.bz2 linux-stable-0d03510038bda70b5a4a252e8216822e6ce0cbdb.zip |
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>
Diffstat (limited to 'net/netfilter/nf_conntrack_proto.c')
-rw-r--r-- | net/netfilter/nf_conntrack_proto.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c index 27810cf816a6..85104a27cc89 100644 --- a/net/netfilter/nf_conntrack_proto.c +++ b/net/netfilter/nf_conntrack_proto.c @@ -214,10 +214,10 @@ int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto) if (proto->l3proto >= NFPROTO_NUMPROTO) return -EBUSY; - - if (proto->tuple_to_nlattr && !proto->nlattr_tuple_size) +#if IS_ENABLED(CONFIG_NF_CT_NETLINK) + if (proto->tuple_to_nlattr && proto->nla_size == 0) return -EINVAL; - +#endif mutex_lock(&nf_ct_proto_mutex); old = rcu_dereference_protected(nf_ct_l3protos[proto->l3proto], lockdep_is_held(&nf_ct_proto_mutex)); @@ -226,9 +226,6 @@ int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto) goto out_unlock; } - if (proto->nlattr_tuple_size) - proto->nla_size = 3 * proto->nlattr_tuple_size(); - rcu_assign_pointer(nf_ct_l3protos[proto->l3proto], proto); out_unlock: |