32d5d2b4ef40ac0bc01fc18191a1b05a92d98cb5
[openwrt/staging/chunkeey.git] / target / linux / generic / backport-4.14 / 330-v4.16-netfilter-nf_tables-remove-flag-field-from-struct-nf.patch
1 From: Pablo Neira Ayuso <pablo@netfilter.org>
2 Date: Tue, 19 Dec 2017 14:07:52 +0100
3 Subject: [PATCH] netfilter: nf_tables: remove flag field from struct
4 nft_af_info
5
6 Replace it by a direct check for the netdev protocol family.
7
8 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
9 ---
10
11 --- a/include/net/netfilter/nf_tables.h
12 +++ b/include/net/netfilter/nf_tables.h
13 @@ -959,10 +959,6 @@ struct nft_table {
14 char *name;
15 };
16
17 -enum nft_af_flags {
18 - NFT_AF_NEEDS_DEV = (1 << 0),
19 -};
20 -
21 /**
22 * struct nft_af_info - nf_tables address family info
23 *
24 @@ -970,14 +966,12 @@ enum nft_af_flags {
25 * @family: address family
26 * @owner: module owner
27 * @tables: used internally
28 - * @flags: family flags
29 */
30 struct nft_af_info {
31 struct list_head list;
32 int family;
33 struct module *owner;
34 struct list_head tables;
35 - u32 flags;
36 };
37
38 int nft_register_afinfo(struct net *, struct nft_af_info *);
39 --- a/net/netfilter/nf_tables_api.c
40 +++ b/net/netfilter/nf_tables_api.c
41 @@ -1391,7 +1391,7 @@ static int nft_chain_parse_hook(struct n
42 hook->type = type;
43
44 hook->dev = NULL;
45 - if (afi->flags & NFT_AF_NEEDS_DEV) {
46 + if (afi->family == NFPROTO_NETDEV) {
47 char ifname[IFNAMSIZ];
48
49 if (!ha[NFTA_HOOK_DEV]) {
50 --- a/net/netfilter/nf_tables_netdev.c
51 +++ b/net/netfilter/nf_tables_netdev.c
52 @@ -41,7 +41,6 @@ nft_do_chain_netdev(void *priv, struct s
53 static struct nft_af_info nft_af_netdev __read_mostly = {
54 .family = NFPROTO_NETDEV,
55 .owner = THIS_MODULE,
56 - .flags = NFT_AF_NEEDS_DEV,
57 };
58
59 static int nf_tables_netdev_init_net(struct net *net)