aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-12-07 19:16:46 -0500
committerDavid S. Miller <davem@davemloft.net>2016-12-07 19:16:46 -0500
commit5fccd64aa44829f87997e3342698ef98862adffd (patch)
tree21cbd3c0975d1d90b4b29f513871853db09a4094 /include/net
parent63c36c40b9b031b760f89f5991843b6eeb6314e7 (diff)
parent73c25fb139337ac4fe1695ae3c056961855594db (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 a large Netfilter update for net-next, to summarise: 1) Add support for stateful objects. This series provides a nf_tables native alternative to the extended accounting infrastructure for nf_tables. Two initial stateful objects are supported: counters and quotas. Objects are identified by a user-defined name, you can fetch and reset them anytime. You can also use a maps to allow fast lookups using any arbitrary key combination. More info at: http://marc.info/?l=netfilter-devel&m=148029128323837&w=2 2) On-demand registration of nf_conntrack and defrag hooks per netns. Register nf_conntrack hooks if we have a stateful ruleset, ie. state-based filtering or NAT. The new nf_conntrack_default_on sysctl enables this from newly created netnamespaces. Default behaviour is not modified. Patches from Florian Westphal. 3) Allocate 4k chunks and then use these for x_tables counter allocation requests, this improves ruleset load time and also datapath ruleset evaluation, patches from Florian Westphal. 4) Add support for ebpf to the existing x_tables bpf extension. From Willem de Bruijn. 5) Update layer 4 checksum if any of the pseudoheader fields is updated. This provides a limited form of 1:1 stateless NAT that make sense in specific scenario, eg. load balancing. 6) Add support to flush sets in nf_tables. This series comes with a new set->ops->deactivate_one() indirection given that we have to walk over the list of set elements, then deactivate them one by one. The existing set->ops->deactivate() performs an element lookup that we don't need. 7) Two patches to avoid cloning packets, thus speed up packet forwarding via nft_fwd from ingress. From Florian Westphal. 8) Two IPVS patches via Simon Horman: Decrement ttl in all modes to prevent infinite loops, patch from Dwip Banerjee. And one minor refactoring from Gao feng. 9) Revisit recent log support for nf_tables netdev families: One patch to ensure that we correctly handle non-ethernet packets. Another patch to add missing logger definition for netdev. Patches from Liping Zhang. 10) Three patches for nft_fib, one to address insufficient register initialization and another to solve incorrect (although harmless) byteswap operation. Moreover update xt_rpfilter and nft_fib to match lbcast packets with zeronet as source, eg. DHCP Discover packets (0.0.0.0 -> 255.255.255.255). Also from Liping Zhang. 11) Built-in DCCP, SCTP and UDPlite conntrack and NAT support, from Davide Caratti. While DCCP is rather hopeless lately, and UDPlite has been broken in many-cast mode for some little time, let's give them a chance by placing them at the same level as other existing protocols. Thus, users don't explicitly have to modprobe support for this and NAT rules work for them. Some people point to the lack of support in SOHO Linux-based routers that make deployment of new protocols harder. I guess other middleboxes outthere on the Internet are also to blame. Anyway, let's see if this has any impact in the midrun. 12) Skip software SCTP software checksum calculation if the NIC comes with SCTP checksum offload support. From Davide Caratti. 13) Initial core factoring to prepare conversion to hook array. Three patches from Aaron Conole. 14) Gao Feng made a wrong conversion to switch in the xt_multiport extension in a patch coming in the previous batch. Fix it in this batch. 15) Get vmalloc call in sync with kmalloc flags to avoid a warning and likely OOM killer intervention from x_tables. From Marcelo Ricardo Leitner. 16) Update Arturo Borrero's email address in all source code headers. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_ipv4.h9
-rw-r--r--include/net/netfilter/ipv4/nf_defrag_ipv4.h3
-rw-r--r--include/net/netfilter/ipv6/nf_conntrack_ipv6.h9
-rw-r--r--include/net/netfilter/ipv6/nf_defrag_ipv6.h3
-rw-r--r--include/net/netfilter/nf_conntrack.h4
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h16
-rw-r--r--include/net/netfilter/nf_dup_netdev.h1
-rw-r--r--include/net/netfilter/nf_log.h4
-rw-r--r--include/net/netfilter/nf_nat_l4proto.h9
-rw-r--r--include/net/netfilter/nf_tables.h101
-rw-r--r--include/net/netfilter/nf_tables_core.h1
-rw-r--r--include/net/netns/conntrack.h43
-rw-r--r--include/net/netns/netfilter.h6
13 files changed, 202 insertions, 7 deletions
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
index 981c327374da..919e4e8af327 100644
--- a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
@@ -15,6 +15,15 @@ extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4;
15extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4; 15extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;
16extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4; 16extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
17extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp; 17extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
18#ifdef CONFIG_NF_CT_PROTO_DCCP
19extern struct nf_conntrack_l4proto nf_conntrack_l4proto_dccp4;
20#endif
21#ifdef CONFIG_NF_CT_PROTO_SCTP
22extern struct nf_conntrack_l4proto nf_conntrack_l4proto_sctp4;
23#endif
24#ifdef CONFIG_NF_CT_PROTO_UDPLITE
25extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udplite4;
26#endif
18 27
19int nf_conntrack_ipv4_compat_init(void); 28int nf_conntrack_ipv4_compat_init(void);
20void nf_conntrack_ipv4_compat_fini(void); 29void nf_conntrack_ipv4_compat_fini(void);
diff --git a/include/net/netfilter/ipv4/nf_defrag_ipv4.h b/include/net/netfilter/ipv4/nf_defrag_ipv4.h
index f01ef208dff6..db405f70e538 100644
--- a/include/net/netfilter/ipv4/nf_defrag_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_defrag_ipv4.h
@@ -1,6 +1,7 @@
1#ifndef _NF_DEFRAG_IPV4_H 1#ifndef _NF_DEFRAG_IPV4_H
2#define _NF_DEFRAG_IPV4_H 2#define _NF_DEFRAG_IPV4_H
3 3
4void nf_defrag_ipv4_enable(void); 4struct net;
5int nf_defrag_ipv4_enable(struct net *);
5 6
6#endif /* _NF_DEFRAG_IPV4_H */ 7#endif /* _NF_DEFRAG_IPV4_H */
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
index a4c993685795..eaea968f8657 100644
--- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
@@ -6,6 +6,15 @@ extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;
6extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6; 6extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
7extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6; 7extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
8extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6; 8extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
9#ifdef CONFIG_NF_CT_PROTO_DCCP
10extern struct nf_conntrack_l4proto nf_conntrack_l4proto_dccp6;
11#endif
12#ifdef CONFIG_NF_CT_PROTO_SCTP
13extern struct nf_conntrack_l4proto nf_conntrack_l4proto_sctp6;
14#endif
15#ifdef CONFIG_NF_CT_PROTO_UDPLITE
16extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udplite6;
17#endif
9 18
10#include <linux/sysctl.h> 19#include <linux/sysctl.h>
11extern struct ctl_table nf_ct_ipv6_sysctl_table[]; 20extern struct ctl_table nf_ct_ipv6_sysctl_table[];
diff --git a/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
index ddf162f7966f..7664efe37974 100644
--- a/include/net/netfilter/ipv6/nf_defrag_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
@@ -1,7 +1,8 @@
1#ifndef _NF_DEFRAG_IPV6_H 1#ifndef _NF_DEFRAG_IPV6_H
2#define _NF_DEFRAG_IPV6_H 2#define _NF_DEFRAG_IPV6_H
3 3
4void nf_defrag_ipv6_enable(void); 4struct net;
5int nf_defrag_ipv6_enable(struct net *);
5 6
6int nf_ct_frag6_init(void); 7int nf_ct_frag6_init(void);
7void nf_ct_frag6_cleanup(void); 8void nf_ct_frag6_cleanup(void);
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index d9d52c020a70..5916aa9ab3f0 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -181,6 +181,10 @@ static inline void nf_ct_put(struct nf_conn *ct)
181int nf_ct_l3proto_try_module_get(unsigned short l3proto); 181int nf_ct_l3proto_try_module_get(unsigned short l3proto);
182void nf_ct_l3proto_module_put(unsigned short l3proto); 182void nf_ct_l3proto_module_put(unsigned short l3proto);
183 183
184/* load module; enable/disable conntrack in this namespace */
185int nf_ct_netns_get(struct net *net, u8 nfproto);
186void nf_ct_netns_put(struct net *net, u8 nfproto);
187
184/* 188/*
185 * Allocate a hashtable of hlist_head (if nulls == 0), 189 * Allocate a hashtable of hlist_head (if nulls == 0),
186 * or hlist_nulls_head (if nulls == 1) 190 * or hlist_nulls_head (if nulls == 1)
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 8992e4229da9..e01559b4d781 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -52,6 +52,10 @@ struct nf_conntrack_l3proto {
52 int (*tuple_to_nlattr)(struct sk_buff *skb, 52 int (*tuple_to_nlattr)(struct sk_buff *skb,
53 const struct nf_conntrack_tuple *t); 53 const struct nf_conntrack_tuple *t);
54 54
55 /* Called when netns wants to use connection tracking */
56 int (*net_ns_get)(struct net *);
57 void (*net_ns_put)(struct net *);
58
55 /* 59 /*
56 * Calculate size of tuple nlattr 60 * Calculate size of tuple nlattr
57 */ 61 */
@@ -63,18 +67,24 @@ struct nf_conntrack_l3proto {
63 67
64 size_t nla_size; 68 size_t nla_size;
65 69
66 /* Init l3proto pernet data */
67 int (*init_net)(struct net *net);
68
69 /* Module (if any) which this is connected to. */ 70 /* Module (if any) which this is connected to. */
70 struct module *me; 71 struct module *me;
71}; 72};
72 73
73extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX]; 74extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX];
74 75
76#ifdef CONFIG_SYSCTL
75/* Protocol pernet registration. */ 77/* Protocol pernet registration. */
76int nf_ct_l3proto_pernet_register(struct net *net, 78int nf_ct_l3proto_pernet_register(struct net *net,
77 struct nf_conntrack_l3proto *proto); 79 struct nf_conntrack_l3proto *proto);
80#else
81static inline int nf_ct_l3proto_pernet_register(struct net *n,
82 struct nf_conntrack_l3proto *p)
83{
84 return 0;
85}
86#endif
87
78void nf_ct_l3proto_pernet_unregister(struct net *net, 88void nf_ct_l3proto_pernet_unregister(struct net *net,
79 struct nf_conntrack_l3proto *proto); 89 struct nf_conntrack_l3proto *proto);
80 90
diff --git a/include/net/netfilter/nf_dup_netdev.h b/include/net/netfilter/nf_dup_netdev.h
index 397dcae349f9..3e919356bedf 100644
--- a/include/net/netfilter/nf_dup_netdev.h
+++ b/include/net/netfilter/nf_dup_netdev.h
@@ -2,5 +2,6 @@
2#define _NF_DUP_NETDEV_H_ 2#define _NF_DUP_NETDEV_H_
3 3
4void nf_dup_netdev_egress(const struct nft_pktinfo *pkt, int oif); 4void nf_dup_netdev_egress(const struct nft_pktinfo *pkt, int oif);
5void nf_fwd_netdev_egress(const struct nft_pktinfo *pkt, int oif);
5 6
6#endif 7#endif
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index a559aa41253c..450f87f95415 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -109,7 +109,9 @@ void nf_log_dump_packet_common(struct nf_log_buf *m, u_int8_t pf,
109 const struct net_device *out, 109 const struct net_device *out,
110 const struct nf_loginfo *loginfo, 110 const struct nf_loginfo *loginfo,
111 const char *prefix); 111 const char *prefix);
112void nf_log_l2packet(struct net *net, u_int8_t pf, unsigned int hooknum, 112void nf_log_l2packet(struct net *net, u_int8_t pf,
113 __be16 protocol,
114 unsigned int hooknum,
113 const struct sk_buff *skb, 115 const struct sk_buff *skb,
114 const struct net_device *in, 116 const struct net_device *in,
115 const struct net_device *out, 117 const struct net_device *out,
diff --git a/include/net/netfilter/nf_nat_l4proto.h b/include/net/netfilter/nf_nat_l4proto.h
index 12f4cc841b6e..3923150f2a1e 100644
--- a/include/net/netfilter/nf_nat_l4proto.h
+++ b/include/net/netfilter/nf_nat_l4proto.h
@@ -54,6 +54,15 @@ extern const struct nf_nat_l4proto nf_nat_l4proto_udp;
54extern const struct nf_nat_l4proto nf_nat_l4proto_icmp; 54extern const struct nf_nat_l4proto nf_nat_l4proto_icmp;
55extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6; 55extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6;
56extern const struct nf_nat_l4proto nf_nat_l4proto_unknown; 56extern const struct nf_nat_l4proto nf_nat_l4proto_unknown;
57#ifdef CONFIG_NF_NAT_PROTO_DCCP
58extern const struct nf_nat_l4proto nf_nat_l4proto_dccp;
59#endif
60#ifdef CONFIG_NF_NAT_PROTO_SCTP
61extern const struct nf_nat_l4proto nf_nat_l4proto_sctp;
62#endif
63#ifdef CONFIG_NF_NAT_PROTO_UDPLITE
64extern const struct nf_nat_l4proto nf_nat_l4proto_udplite;
65#endif
57 66
58bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple, 67bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple,
59 enum nf_nat_manip_type maniptype, 68 enum nf_nat_manip_type maniptype,
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 32970cba184a..924325c46aab 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -259,7 +259,8 @@ struct nft_expr;
259 * @lookup: look up an element within the set 259 * @lookup: look up an element within the set
260 * @insert: insert new element into set 260 * @insert: insert new element into set
261 * @activate: activate new element in the next generation 261 * @activate: activate new element in the next generation
262 * @deactivate: deactivate element in the next generation 262 * @deactivate: lookup for element and deactivate it in the next generation
263 * @deactivate_one: deactivate element in the next generation
263 * @remove: remove element from set 264 * @remove: remove element from set
264 * @walk: iterate over all set elemeennts 265 * @walk: iterate over all set elemeennts
265 * @privsize: function to return size of set private data 266 * @privsize: function to return size of set private data
@@ -294,6 +295,9 @@ struct nft_set_ops {
294 void * (*deactivate)(const struct net *net, 295 void * (*deactivate)(const struct net *net,
295 const struct nft_set *set, 296 const struct nft_set *set,
296 const struct nft_set_elem *elem); 297 const struct nft_set_elem *elem);
298 bool (*deactivate_one)(const struct net *net,
299 const struct nft_set *set,
300 void *priv);
297 void (*remove)(const struct nft_set *set, 301 void (*remove)(const struct nft_set *set,
298 const struct nft_set_elem *elem); 302 const struct nft_set_elem *elem);
299 void (*walk)(const struct nft_ctx *ctx, 303 void (*walk)(const struct nft_ctx *ctx,
@@ -326,6 +330,7 @@ void nft_unregister_set(struct nft_set_ops *ops);
326 * @name: name of the set 330 * @name: name of the set
327 * @ktype: key type (numeric type defined by userspace, not used in the kernel) 331 * @ktype: key type (numeric type defined by userspace, not used in the kernel)
328 * @dtype: data type (verdict or numeric type defined by userspace) 332 * @dtype: data type (verdict or numeric type defined by userspace)
333 * @objtype: object type (see NFT_OBJECT_* definitions)
329 * @size: maximum set size 334 * @size: maximum set size
330 * @nelems: number of elements 335 * @nelems: number of elements
331 * @ndeact: number of deactivated elements queued for removal 336 * @ndeact: number of deactivated elements queued for removal
@@ -347,6 +352,7 @@ struct nft_set {
347 char name[NFT_SET_MAXNAMELEN]; 352 char name[NFT_SET_MAXNAMELEN];
348 u32 ktype; 353 u32 ktype;
349 u32 dtype; 354 u32 dtype;
355 u32 objtype;
350 u32 size; 356 u32 size;
351 atomic_t nelems; 357 atomic_t nelems;
352 u32 ndeact; 358 u32 ndeact;
@@ -416,6 +422,7 @@ void nf_tables_unbind_set(const struct nft_ctx *ctx, struct nft_set *set,
416 * @NFT_SET_EXT_EXPIRATION: element expiration time 422 * @NFT_SET_EXT_EXPIRATION: element expiration time
417 * @NFT_SET_EXT_USERDATA: user data associated with the element 423 * @NFT_SET_EXT_USERDATA: user data associated with the element
418 * @NFT_SET_EXT_EXPR: expression assiociated with the element 424 * @NFT_SET_EXT_EXPR: expression assiociated with the element
425 * @NFT_SET_EXT_OBJREF: stateful object reference associated with element
419 * @NFT_SET_EXT_NUM: number of extension types 426 * @NFT_SET_EXT_NUM: number of extension types
420 */ 427 */
421enum nft_set_extensions { 428enum nft_set_extensions {
@@ -426,6 +433,7 @@ enum nft_set_extensions {
426 NFT_SET_EXT_EXPIRATION, 433 NFT_SET_EXT_EXPIRATION,
427 NFT_SET_EXT_USERDATA, 434 NFT_SET_EXT_USERDATA,
428 NFT_SET_EXT_EXPR, 435 NFT_SET_EXT_EXPR,
436 NFT_SET_EXT_OBJREF,
429 NFT_SET_EXT_NUM 437 NFT_SET_EXT_NUM
430}; 438};
431 439
@@ -554,6 +562,11 @@ static inline struct nft_set_ext *nft_set_elem_ext(const struct nft_set *set,
554 return elem + set->ops->elemsize; 562 return elem + set->ops->elemsize;
555} 563}
556 564
565static inline struct nft_object **nft_set_ext_obj(const struct nft_set_ext *ext)
566{
567 return nft_set_ext(ext, NFT_SET_EXT_OBJREF);
568}
569
557void *nft_set_elem_init(const struct nft_set *set, 570void *nft_set_elem_init(const struct nft_set *set,
558 const struct nft_set_ext_tmpl *tmpl, 571 const struct nft_set_ext_tmpl *tmpl,
559 const u32 *key, const u32 *data, 572 const u32 *key, const u32 *data,
@@ -875,6 +888,7 @@ unsigned int nft_do_chain(struct nft_pktinfo *pkt, void *priv);
875 * @list: used internally 888 * @list: used internally
876 * @chains: chains in the table 889 * @chains: chains in the table
877 * @sets: sets in the table 890 * @sets: sets in the table
891 * @objects: stateful objects in the table
878 * @hgenerator: handle generator state 892 * @hgenerator: handle generator state
879 * @use: number of chain references to this table 893 * @use: number of chain references to this table
880 * @flags: table flag (see enum nft_table_flags) 894 * @flags: table flag (see enum nft_table_flags)
@@ -885,6 +899,7 @@ struct nft_table {
885 struct list_head list; 899 struct list_head list;
886 struct list_head chains; 900 struct list_head chains;
887 struct list_head sets; 901 struct list_head sets;
902 struct list_head objects;
888 u64 hgenerator; 903 u64 hgenerator;
889 u32 use; 904 u32 use;
890 u16 flags:14, 905 u16 flags:14,
@@ -935,6 +950,80 @@ int nft_verdict_dump(struct sk_buff *skb, int type,
935 const struct nft_verdict *v); 950 const struct nft_verdict *v);
936 951
937/** 952/**
953 * struct nft_object - nf_tables stateful object
954 *
955 * @list: table stateful object list node
956 * @table: table this object belongs to
957 * @type: pointer to object type
958 * @data: pointer to object data
959 * @name: name of this stateful object
960 * @genmask: generation mask
961 * @use: number of references to this stateful object
962 * @data: object data, layout depends on type
963 */
964struct nft_object {
965 struct list_head list;
966 char name[NFT_OBJ_MAXNAMELEN];
967 struct nft_table *table;
968 u32 genmask:2,
969 use:30;
970 /* runtime data below here */
971 const struct nft_object_type *type ____cacheline_aligned;
972 unsigned char data[]
973 __attribute__((aligned(__alignof__(u64))));
974};
975
976static inline void *nft_obj_data(const struct nft_object *obj)
977{
978 return (void *)obj->data;
979}
980
981#define nft_expr_obj(expr) *((struct nft_object **)nft_expr_priv(expr))
982
983struct nft_object *nf_tables_obj_lookup(const struct nft_table *table,
984 const struct nlattr *nla, u32 objtype,
985 u8 genmask);
986
987int nft_obj_notify(struct net *net, struct nft_table *table,
988 struct nft_object *obj, u32 portid, u32 seq,
989 int event, int family, int report, gfp_t gfp);
990
991/**
992 * struct nft_object_type - stateful object type
993 *
994 * @eval: stateful object evaluation function
995 * @list: list node in list of object types
996 * @type: stateful object numeric type
997 * @size: stateful object size
998 * @owner: module owner
999 * @maxattr: maximum netlink attribute
1000 * @policy: netlink attribute policy
1001 * @init: initialize object from netlink attributes
1002 * @destroy: release existing stateful object
1003 * @dump: netlink dump stateful object
1004 */
1005struct nft_object_type {
1006 void (*eval)(struct nft_object *obj,
1007 struct nft_regs *regs,
1008 const struct nft_pktinfo *pkt);
1009 struct list_head list;
1010 u32 type;
1011 unsigned int size;
1012 unsigned int maxattr;
1013 struct module *owner;
1014 const struct nla_policy *policy;
1015 int (*init)(const struct nlattr * const tb[],
1016 struct nft_object *obj);
1017 void (*destroy)(struct nft_object *obj);
1018 int (*dump)(struct sk_buff *skb,
1019 struct nft_object *obj,
1020 bool reset);
1021};
1022
1023int nft_register_obj(struct nft_object_type *obj_type);
1024void nft_unregister_obj(struct nft_object_type *obj_type);
1025
1026/**
938 * struct nft_traceinfo - nft tracing information and state 1027 * struct nft_traceinfo - nft tracing information and state
939 * 1028 *
940 * @pkt: pktinfo currently processed 1029 * @pkt: pktinfo currently processed
@@ -981,6 +1070,9 @@ void nft_trace_notify(struct nft_traceinfo *info);
981#define MODULE_ALIAS_NFT_SET() \ 1070#define MODULE_ALIAS_NFT_SET() \
982 MODULE_ALIAS("nft-set") 1071 MODULE_ALIAS("nft-set")
983 1072
1073#define MODULE_ALIAS_NFT_OBJ(type) \
1074 MODULE_ALIAS("nft-obj-" __stringify(type))
1075
984/* 1076/*
985 * The gencursor defines two generations, the currently active and the 1077 * The gencursor defines two generations, the currently active and the
986 * next one. Objects contain a bitmask of 2 bits specifying the generations 1078 * next one. Objects contain a bitmask of 2 bits specifying the generations
@@ -1157,4 +1249,11 @@ struct nft_trans_elem {
1157#define nft_trans_elem(trans) \ 1249#define nft_trans_elem(trans) \
1158 (((struct nft_trans_elem *)trans->data)->elem) 1250 (((struct nft_trans_elem *)trans->data)->elem)
1159 1251
1252struct nft_trans_obj {
1253 struct nft_object *obj;
1254};
1255
1256#define nft_trans_obj(trans) \
1257 (((struct nft_trans_obj *)trans->data)->obj)
1258
1160#endif /* _NET_NF_TABLES_H */ 1259#endif /* _NET_NF_TABLES_H */
diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h
index 862373d4ea9d..8f690effec37 100644
--- a/include/net/netfilter/nf_tables_core.h
+++ b/include/net/netfilter/nf_tables_core.h
@@ -45,6 +45,7 @@ struct nft_payload_set {
45 enum nft_registers sreg:8; 45 enum nft_registers sreg:8;
46 u8 csum_type; 46 u8 csum_type;
47 u8 csum_offset; 47 u8 csum_offset;
48 u8 csum_flags;
48}; 49};
49 50
50extern const struct nft_expr_ops nft_payload_fast_ops; 51extern const struct nft_expr_ops nft_payload_fast_ops;
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 3d06d94d2e52..cf799fc3fdec 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -6,6 +6,12 @@
6#include <linux/atomic.h> 6#include <linux/atomic.h>
7#include <linux/workqueue.h> 7#include <linux/workqueue.h>
8#include <linux/netfilter/nf_conntrack_tcp.h> 8#include <linux/netfilter/nf_conntrack_tcp.h>
9#ifdef CONFIG_NF_CT_PROTO_DCCP
10#include <linux/netfilter/nf_conntrack_dccp.h>
11#endif
12#ifdef CONFIG_NF_CT_PROTO_SCTP
13#include <linux/netfilter/nf_conntrack_sctp.h>
14#endif
9#include <linux/seqlock.h> 15#include <linux/seqlock.h>
10 16
11struct ctl_table_header; 17struct ctl_table_header;
@@ -48,12 +54,49 @@ struct nf_icmp_net {
48 unsigned int timeout; 54 unsigned int timeout;
49}; 55};
50 56
57#ifdef CONFIG_NF_CT_PROTO_DCCP
58struct nf_dccp_net {
59 struct nf_proto_net pn;
60 int dccp_loose;
61 unsigned int dccp_timeout[CT_DCCP_MAX + 1];
62};
63#endif
64
65#ifdef CONFIG_NF_CT_PROTO_SCTP
66struct nf_sctp_net {
67 struct nf_proto_net pn;
68 unsigned int timeouts[SCTP_CONNTRACK_MAX];
69};
70#endif
71
72#ifdef CONFIG_NF_CT_PROTO_UDPLITE
73enum udplite_conntrack {
74 UDPLITE_CT_UNREPLIED,
75 UDPLITE_CT_REPLIED,
76 UDPLITE_CT_MAX
77};
78
79struct nf_udplite_net {
80 struct nf_proto_net pn;
81 unsigned int timeouts[UDPLITE_CT_MAX];
82};
83#endif
84
51struct nf_ip_net { 85struct nf_ip_net {
52 struct nf_generic_net generic; 86 struct nf_generic_net generic;
53 struct nf_tcp_net tcp; 87 struct nf_tcp_net tcp;
54 struct nf_udp_net udp; 88 struct nf_udp_net udp;
55 struct nf_icmp_net icmp; 89 struct nf_icmp_net icmp;
56 struct nf_icmp_net icmpv6; 90 struct nf_icmp_net icmpv6;
91#ifdef CONFIG_NF_CT_PROTO_DCCP
92 struct nf_dccp_net dccp;
93#endif
94#ifdef CONFIG_NF_CT_PROTO_SCTP
95 struct nf_sctp_net sctp;
96#endif
97#ifdef CONFIG_NF_CT_PROTO_UDPLITE
98 struct nf_udplite_net udplite;
99#endif
57}; 100};
58 101
59struct ct_pcpu { 102struct ct_pcpu {
diff --git a/include/net/netns/netfilter.h b/include/net/netns/netfilter.h
index 58487b1cc99a..cea396b53a60 100644
--- a/include/net/netns/netfilter.h
+++ b/include/net/netns/netfilter.h
@@ -17,5 +17,11 @@ struct netns_nf {
17 struct ctl_table_header *nf_log_dir_header; 17 struct ctl_table_header *nf_log_dir_header;
18#endif 18#endif
19 struct nf_hook_entry __rcu *hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 19 struct nf_hook_entry __rcu *hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
20#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4)
21 bool defrag_ipv4;
22#endif
23#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
24 bool defrag_ipv6;
25#endif
20}; 26};
21#endif 27#endif