aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-01-21 11:35:34 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-21 11:35:34 -0500
commitcbcbeedbfd76e45c3f522043bb7c6fb287779a9c (patch)
treed691fe7e3291b9a8bb1cd8b655a61d92250e5b83 /include/net
parentea9722e2650db8f0a0d9ef2e391c95285ef991cd (diff)
parente55311665286ab2744295575948c2b08dc001bf3 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
Pablo Neira Ayuso says: ==================== Netfilter/IPVS updates for net-next The following patchset contains Netfilter/IPVS updates for your net-next tree. Basically, a new extension for ip6tables, simplification work of nf_tables that saves us 500 LoC, allow raw table registration before defragmentation, conversion of the SNMP helper to use the ASN.1 code generator, unique 64-bit handle for all nf_tables objects and fixes to address fallout from previous nf-next batch. More specifically, they are: 1) Seven patches to remove family abstraction layer (struct nft_af_info) in nf_tables, this simplifies our codebase and it saves us 64 bytes per net namespace. 2) Add IPv6 segment routing header matching for ip6tables, from Ahmed Abdelsalam. 3) Allow to register iptable_raw table before defragmentation, some people do not want to waste cycles on defragmenting traffic that is going to be dropped, hence add a new module parameter to enable this behaviour in iptables and ip6tables. From Subash Abhinov Kasiviswanathan. This patch needed a couple of follow up patches to get things tidy from Arnd Bergmann. 4) SNMP helper uses the ASN.1 code generator, from Taehee Yoo. Several patches for this helper to prepare this change are also part of this patch series. 5) Add 64-bit handles to uniquely objects in nf_tables, from Harsha Sharma. 6) Remove log message that several netfilter subsystems print at boot/load time. 7) Restore x_tables module autoloading, that got broken in a previous patch to allow singleton NAT hook callback registration per hook spot, from Florian Westphal. Moreover, return EBUSY to report that the singleton NAT hook slot is already in instead. 8) Several fixes for the new nf_tables flowtable representation, including incorrect error check after nf_tables_flowtable_lookup(), missing Kconfig dependencies that lead to build breakage and missing initialization of priority and hooknum in flowtable object. 9) Missing NETFILTER_FAMILY_ARP dependency in Kconfig for the clusterip target. This is due to recent updates in the core to shrink the hook array size and compile it out if no specific family is enabled via .config file. Patch from Florian Westphal. 10) Remove duplicated include header files, from Wei Yongjun. 11) Sparse warning fix for the NFPROTO_INET handling from the core due to missing static function definition, also from Wei Yongjun. 12) Restore ICMPv6 Parameter Problem error reporting when defragmentation fails, from Subash Abhinov Kasiviswanathan. 13) Remove obsolete owner field initialization from struct file_operations, patch from Alexey Dobriyan. 14) Use boolean datatype where needed in the Netfilter codebase, from Gustavo A. R. Silva. 15) Remove double semicolon in dynset nf_tables expression, from Luis de Bethencourt. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/netfilter/nf_tables.h48
-rw-r--r--include/net/netns/nftables.h8
2 files changed, 15 insertions, 41 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index dd238950df81..663b015dace5 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 */
154struct nft_ctx { 154struct 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
@@ -374,6 +374,7 @@ void nft_unregister_set(struct nft_set_type *type);
374 * @list: table set list node 374 * @list: table set list node
375 * @bindings: list of set bindings 375 * @bindings: list of set bindings
376 * @name: name of the set 376 * @name: name of the set
377 * @handle: unique handle of the set
377 * @ktype: key type (numeric type defined by userspace, not used in the kernel) 378 * @ktype: key type (numeric type defined by userspace, not used in the kernel)
378 * @dtype: data type (verdict or numeric type defined by userspace) 379 * @dtype: data type (verdict or numeric type defined by userspace)
379 * @objtype: object type (see NFT_OBJECT_* definitions) 380 * @objtype: object type (see NFT_OBJECT_* definitions)
@@ -396,6 +397,7 @@ struct nft_set {
396 struct list_head list; 397 struct list_head list;
397 struct list_head bindings; 398 struct list_head bindings;
398 char *name; 399 char *name;
400 u64 handle;
399 u32 ktype; 401 u32 ktype;
400 u32 dtype; 402 u32 dtype;
401 u32 objtype; 403 u32 objtype;
@@ -946,9 +948,11 @@ unsigned int nft_do_chain(struct nft_pktinfo *pkt, void *priv);
946 * @objects: stateful objects in the table 948 * @objects: stateful objects in the table
947 * @flowtables: flow tables in the table 949 * @flowtables: flow tables in the table
948 * @hgenerator: handle generator state 950 * @hgenerator: handle generator state
951 * @handle: table handle
949 * @use: number of chain references to this table 952 * @use: number of chain references to this table
950 * @flags: table flag (see enum nft_table_flags) 953 * @flags: table flag (see enum nft_table_flags)
951 * @genmask: generation mask 954 * @genmask: generation mask
955 * @afinfo: address family info
952 * @name: name of the table 956 * @name: name of the table
953 */ 957 */
954struct nft_table { 958struct nft_table {
@@ -958,38 +962,14 @@ struct nft_table {
958 struct list_head objects; 962 struct list_head objects;
959 struct list_head flowtables; 963 struct list_head flowtables;
960 u64 hgenerator; 964 u64 hgenerator;
965 u64 handle;
961 u32 use; 966 u32 use;
962 u16 flags:14, 967 u16 family:6,
968 flags:8,
963 genmask:2; 969 genmask:2;
964 char *name; 970 char *name;
965}; 971};
966 972
967enum nft_af_flags {
968 NFT_AF_NEEDS_DEV = (1 << 0),
969};
970
971/**
972 * struct nft_af_info - nf_tables address family info
973 *
974 * @list: used internally
975 * @family: address family
976 * @nhooks: number of hooks in this family
977 * @owner: module owner
978 * @tables: used internally
979 * @flags: family flags
980 */
981struct nft_af_info {
982 struct list_head list;
983 int family;
984 unsigned int nhooks;
985 struct module *owner;
986 struct list_head tables;
987 u32 flags;
988};
989
990int nft_register_afinfo(struct net *, struct nft_af_info *);
991void nft_unregister_afinfo(struct net *, struct nft_af_info *);
992
993int nft_register_chain_type(const struct nf_chain_type *); 973int nft_register_chain_type(const struct nf_chain_type *);
994void nft_unregister_chain_type(const struct nf_chain_type *); 974void nft_unregister_chain_type(const struct nf_chain_type *);
995 975
@@ -1007,9 +987,9 @@ int nft_verdict_dump(struct sk_buff *skb, int type,
1007 * @name: name of this stateful object 987 * @name: name of this stateful object
1008 * @genmask: generation mask 988 * @genmask: generation mask
1009 * @use: number of references to this stateful object 989 * @use: number of references to this stateful object
1010 * @data: object data, layout depends on type 990 * @handle: unique object handle
1011 * @ops: object operations 991 * @ops: object operations
1012 * @data: pointer to object data 992 * @data: object data, layout depends on type
1013 */ 993 */
1014struct nft_object { 994struct nft_object {
1015 struct list_head list; 995 struct list_head list;
@@ -1017,6 +997,7 @@ struct nft_object {
1017 struct nft_table *table; 997 struct nft_table *table;
1018 u32 genmask:2, 998 u32 genmask:2,
1019 use:30; 999 use:30;
1000 u64 handle;
1020 /* runtime data below here */ 1001 /* runtime data below here */
1021 const struct nft_object_ops *ops ____cacheline_aligned; 1002 const struct nft_object_ops *ops ____cacheline_aligned;
1022 unsigned char data[] 1003 unsigned char data[]
@@ -1098,6 +1079,7 @@ void nft_unregister_obj(struct nft_object_type *obj_type);
1098 * @ops_len: number of hooks in array 1079 * @ops_len: number of hooks in array
1099 * @genmask: generation mask 1080 * @genmask: generation mask
1100 * @use: number of references to this flow table 1081 * @use: number of references to this flow table
1082 * @handle: unique object handle
1101 * @data: rhashtable and garbage collector 1083 * @data: rhashtable and garbage collector
1102 * @ops: array of hooks 1084 * @ops: array of hooks
1103 */ 1085 */
@@ -1110,6 +1092,7 @@ struct nft_flowtable {
1110 int ops_len; 1092 int ops_len;
1111 u32 genmask:2, 1093 u32 genmask:2,
1112 use:30; 1094 use:30;
1095 u64 handle;
1113 /* runtime data below here */ 1096 /* runtime data below here */
1114 struct nf_hook_ops *ops ____cacheline_aligned; 1097 struct nf_hook_ops *ops ____cacheline_aligned;
1115 struct nf_flowtable data; 1098 struct nf_flowtable data;
@@ -1154,9 +1137,6 @@ void nft_trace_init(struct nft_traceinfo *info, const struct nft_pktinfo *pkt,
1154 1137
1155void nft_trace_notify(struct nft_traceinfo *info); 1138void nft_trace_notify(struct nft_traceinfo *info);
1156 1139
1157#define MODULE_ALIAS_NFT_FAMILY(family) \
1158 MODULE_ALIAS("nft-afinfo-" __stringify(family))
1159
1160#define MODULE_ALIAS_NFT_CHAIN(family, name) \ 1140#define MODULE_ALIAS_NFT_CHAIN(family, name) \
1161 MODULE_ALIAS("nft-chain-" __stringify(family) "-" name) 1141 MODULE_ALIAS("nft-chain-" __stringify(family) "-" name)
1162 1142
diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h
index 4109b5f3010f..48134353411d 100644
--- a/include/net/netns/nftables.h
+++ b/include/net/netns/nftables.h
@@ -7,14 +7,8 @@
7struct nft_af_info; 7struct nft_af_info;
8 8
9struct netns_nftables { 9struct netns_nftables {
10 struct list_head af_info; 10 struct list_head tables;
11 struct list_head commit_list; 11 struct list_head commit_list;
12 struct nft_af_info *ipv4;
13 struct nft_af_info *ipv6;
14 struct nft_af_info *inet;
15 struct nft_af_info *arp;
16 struct nft_af_info *bridge;
17 struct nft_af_info *netdev;
18 unsigned int base_seq; 12 unsigned int base_seq;
19 u8 gencursor; 13 u8 gencursor;
20}; 14};