diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-01-08 20:38:03 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-01-10 09:32:08 -0500 |
commit | 36596dadf54a920d26286cf9f421fb4ef648b51f (patch) | |
tree | e9e5cdd54acb21f0ccfa88c851bb7f6418bc4609 /include | |
parent | 1ea26cca52e46c0f29ee9fdd567312ba93a7d651 (diff) |
netfilter: nf_tables: add single table list for all families
Place all existing user defined tables in struct net *, instead of
having one list per family. This saves us from one level of indentation
in netlink dump functions.
Place pointer to struct nft_af_info in struct nft_table temporarily, as
we still need this to put back reference module reference counter on
table removal.
This patch comes in preparation for the removal of struct nft_af_info.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/netfilter/nf_tables.h | 8 | ||||
-rw-r--r-- | include/net/netns/nftables.h | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 9a85893a5e30..c55e836e6a2f 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
@@ -143,22 +143,22 @@ static inline void nft_data_debug(const struct nft_data *data) | |||
143 | * struct nft_ctx - nf_tables rule/set context | 143 | * struct nft_ctx - nf_tables rule/set context |
144 | * | 144 | * |
145 | * @net: net namespace | 145 | * @net: net namespace |
146 | * @afi: address family info | ||
147 | * @table: the table the chain is contained in | 146 | * @table: the table the chain is contained in |
148 | * @chain: the chain the rule is contained in | 147 | * @chain: the chain the rule is contained in |
149 | * @nla: netlink attributes | 148 | * @nla: netlink attributes |
150 | * @portid: netlink portID of the original message | 149 | * @portid: netlink portID of the original message |
151 | * @seq: netlink sequence number | 150 | * @seq: netlink sequence number |
151 | * @family: protocol family | ||
152 | * @report: notify via unicast netlink message | 152 | * @report: notify via unicast netlink message |
153 | */ | 153 | */ |
154 | struct nft_ctx { | 154 | struct nft_ctx { |
155 | struct net *net; | 155 | struct net *net; |
156 | struct nft_af_info *afi; | ||
157 | struct nft_table *table; | 156 | struct nft_table *table; |
158 | struct nft_chain *chain; | 157 | struct nft_chain *chain; |
159 | const struct nlattr * const *nla; | 158 | const struct nlattr * const *nla; |
160 | u32 portid; | 159 | u32 portid; |
161 | u32 seq; | 160 | u32 seq; |
161 | u8 family; | ||
162 | bool report; | 162 | bool report; |
163 | }; | 163 | }; |
164 | 164 | ||
@@ -949,6 +949,7 @@ unsigned int nft_do_chain(struct nft_pktinfo *pkt, void *priv); | |||
949 | * @use: number of chain references to this table | 949 | * @use: number of chain references to this table |
950 | * @flags: table flag (see enum nft_table_flags) | 950 | * @flags: table flag (see enum nft_table_flags) |
951 | * @genmask: generation mask | 951 | * @genmask: generation mask |
952 | * @afinfo: address family info | ||
952 | * @name: name of the table | 953 | * @name: name of the table |
953 | */ | 954 | */ |
954 | struct nft_table { | 955 | struct nft_table { |
@@ -961,6 +962,7 @@ struct nft_table { | |||
961 | u32 use; | 962 | u32 use; |
962 | u16 flags:14, | 963 | u16 flags:14, |
963 | genmask:2; | 964 | genmask:2; |
965 | struct nft_af_info *afi; | ||
964 | char *name; | 966 | char *name; |
965 | }; | 967 | }; |
966 | 968 | ||
@@ -970,13 +972,11 @@ struct nft_table { | |||
970 | * @list: used internally | 972 | * @list: used internally |
971 | * @family: address family | 973 | * @family: address family |
972 | * @owner: module owner | 974 | * @owner: module owner |
973 | * @tables: used internally | ||
974 | */ | 975 | */ |
975 | struct nft_af_info { | 976 | struct nft_af_info { |
976 | struct list_head list; | 977 | struct list_head list; |
977 | int family; | 978 | int family; |
978 | struct module *owner; | 979 | struct module *owner; |
979 | struct list_head tables; | ||
980 | }; | 980 | }; |
981 | 981 | ||
982 | int nft_register_afinfo(struct net *, struct nft_af_info *); | 982 | int nft_register_afinfo(struct net *, struct nft_af_info *); |
diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h index 4109b5f3010f..7f86a63ac21f 100644 --- a/include/net/netns/nftables.h +++ b/include/net/netns/nftables.h | |||
@@ -8,6 +8,7 @@ struct nft_af_info; | |||
8 | 8 | ||
9 | struct netns_nftables { | 9 | struct netns_nftables { |
10 | struct list_head af_info; | 10 | struct list_head af_info; |
11 | struct list_head tables; | ||
11 | struct list_head commit_list; | 12 | struct list_head commit_list; |
12 | struct nft_af_info *ipv4; | 13 | struct nft_af_info *ipv4; |
13 | struct nft_af_info *ipv6; | 14 | struct nft_af_info *ipv6; |