]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
netfilter: nf_tables: reduce chain type table size
authorFlorian Westphal <fw@strlen.de>
Wed, 14 Jun 2017 09:51:29 +0000 (11:51 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 19 Jun 2017 17:20:59 +0000 (19:20 +0200)
text  data  bss     dec    hex filename
old: 151590  2240 1152  154982  25d66 net/netfilter/nf_tables_api.o
new: 151666  2240  416  154322  25ad2 net/netfilter/nf_tables_api.o

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index bc8f03a537347a8b41ca175d4762f6a3923f7538..5f3339978f6b40c959e7f8689c0d41c7643df24b 100644 (file)
@@ -387,7 +387,7 @@ static inline u64 nf_tables_alloc_handle(struct nft_table *table)
        return ++table->hgenerator;
 }
 
-static const struct nf_chain_type *chain_type[AF_MAX][NFT_CHAIN_T_MAX];
+static const struct nf_chain_type *chain_type[NFPROTO_NUMPROTO][NFT_CHAIN_T_MAX];
 
 static const struct nf_chain_type *
 __nf_tables_chain_type_lookup(int family, const struct nlattr *nla)
@@ -870,6 +870,9 @@ int nft_register_chain_type(const struct nf_chain_type *ctype)
 {
        int err = 0;
 
+       if (WARN_ON(ctype->family >= NFPROTO_NUMPROTO))
+               return -EINVAL;
+
        nfnl_lock(NFNL_SUBSYS_NFTABLES);
        if (chain_type[ctype->family][ctype->type] != NULL) {
                err = -EBUSY;