0ce65dc14143e3d1fc5b71b630cdaa8a0a1fedfc
[openwrt/staging/dangole.git] /
1 From: Pablo Neira Ayuso <pablo@netfilter.org>
2 Date: Tue, 19 Dec 2017 13:40:22 +0100
3 Subject: [PATCH] netfilter: nf_tables: remove struct nft_af_info parameter in
4 nf_tables_chain_type_lookup()
5
6 Pass family number instead, this comes in preparation for the removal of
7 struct nft_af_info.
8
9 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
10 ---
11
12 --- a/net/netfilter/nf_tables_api.c
13 +++ b/net/netfilter/nf_tables_api.c
14 @@ -467,7 +467,7 @@ static inline u64 nf_tables_alloc_handle
15 static const struct nf_chain_type *chain_type[NFPROTO_NUMPROTO][NFT_CHAIN_T_MAX];
16
17 static const struct nf_chain_type *
18 -__nf_tables_chain_type_lookup(int family, const struct nlattr *nla)
19 +__nf_tables_chain_type_lookup(const struct nlattr *nla, u8 family)
20 {
21 int i;
22
23 @@ -480,22 +480,20 @@ __nf_tables_chain_type_lookup(int family
24 }
25
26 static const struct nf_chain_type *
27 -nf_tables_chain_type_lookup(const struct nft_af_info *afi,
28 - const struct nlattr *nla,
29 - bool autoload)
30 +nf_tables_chain_type_lookup(const struct nlattr *nla, u8 family, bool autoload)
31 {
32 const struct nf_chain_type *type;
33
34 - type = __nf_tables_chain_type_lookup(afi->family, nla);
35 + type = __nf_tables_chain_type_lookup(nla, family);
36 if (type != NULL)
37 return type;
38 #ifdef CONFIG_MODULES
39 if (autoload) {
40 nfnl_unlock(NFNL_SUBSYS_NFTABLES);
41 - request_module("nft-chain-%u-%.*s", afi->family,
42 + request_module("nft-chain-%u-%.*s", family,
43 nla_len(nla), (const char *)nla_data(nla));
44 nfnl_lock(NFNL_SUBSYS_NFTABLES);
45 - type = __nf_tables_chain_type_lookup(afi->family, nla);
46 + type = __nf_tables_chain_type_lookup(nla, family);
47 if (type != NULL)
48 return ERR_PTR(-EAGAIN);
49 }
50 @@ -1371,8 +1369,8 @@ static int nft_chain_parse_hook(struct n
51
52 type = chain_type[afi->family][NFT_CHAIN_T_DEFAULT];
53 if (nla[NFTA_CHAIN_TYPE]) {
54 - type = nf_tables_chain_type_lookup(afi, nla[NFTA_CHAIN_TYPE],
55 - create);
56 + type = nf_tables_chain_type_lookup(nla[NFTA_CHAIN_TYPE],
57 + afi->family, create);
58 if (IS_ERR(type))
59 return PTR_ERR(type);
60 }