xref: /linux/include/net/netns/conntrack.h (revision c51d39010a1bccc9c1294e2d7c00005aefeb2b5c)
1 #ifndef __NETNS_CONNTRACK_H
2 #define __NETNS_CONNTRACK_H
3 
4 #include <linux/list.h>
5 #include <linux/list_nulls.h>
6 #include <linux/atomic.h>
7 #include <linux/workqueue.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 #include <linux/seqlock.h>
13 
14 struct ctl_table_header;
15 struct nf_conntrack_ecache;
16 
17 struct nf_proto_net {
18 #ifdef CONFIG_SYSCTL
19 	struct ctl_table_header *ctl_table_header;
20 	struct ctl_table        *ctl_table;
21 #endif
22 	unsigned int		users;
23 };
24 
25 struct nf_generic_net {
26 	struct nf_proto_net pn;
27 	unsigned int timeout;
28 };
29 
30 struct nf_tcp_net {
31 	struct nf_proto_net pn;
32 	unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX];
33 	unsigned int tcp_loose;
34 	unsigned int tcp_be_liberal;
35 	unsigned int tcp_max_retrans;
36 };
37 
38 enum udp_conntrack {
39 	UDP_CT_UNREPLIED,
40 	UDP_CT_REPLIED,
41 	UDP_CT_MAX
42 };
43 
44 struct nf_udp_net {
45 	struct nf_proto_net pn;
46 	unsigned int timeouts[UDP_CT_MAX];
47 };
48 
49 struct nf_icmp_net {
50 	struct nf_proto_net pn;
51 	unsigned int timeout;
52 };
53 
54 #ifdef CONFIG_NF_CT_PROTO_DCCP
55 struct nf_dccp_net {
56 	struct nf_proto_net pn;
57 	int dccp_loose;
58 	unsigned int dccp_timeout[CT_DCCP_MAX + 1];
59 };
60 #endif
61 
62 struct nf_ip_net {
63 	struct nf_generic_net   generic;
64 	struct nf_tcp_net	tcp;
65 	struct nf_udp_net	udp;
66 	struct nf_icmp_net	icmp;
67 	struct nf_icmp_net	icmpv6;
68 #ifdef CONFIG_NF_CT_PROTO_DCCP
69 	struct nf_dccp_net	dccp;
70 #endif
71 };
72 
73 struct ct_pcpu {
74 	spinlock_t		lock;
75 	struct hlist_nulls_head unconfirmed;
76 	struct hlist_nulls_head dying;
77 };
78 
79 struct netns_ct {
80 	atomic_t		count;
81 	unsigned int		expect_count;
82 #ifdef CONFIG_NF_CONNTRACK_EVENTS
83 	struct delayed_work ecache_dwork;
84 	bool ecache_dwork_pending;
85 #endif
86 #ifdef CONFIG_SYSCTL
87 	struct ctl_table_header	*sysctl_header;
88 	struct ctl_table_header	*acct_sysctl_header;
89 	struct ctl_table_header	*tstamp_sysctl_header;
90 	struct ctl_table_header	*event_sysctl_header;
91 	struct ctl_table_header	*helper_sysctl_header;
92 #endif
93 	unsigned int		sysctl_log_invalid; /* Log invalid packets */
94 	int			sysctl_events;
95 	int			sysctl_acct;
96 	int			sysctl_auto_assign_helper;
97 	bool			auto_assign_helper_warned;
98 	int			sysctl_tstamp;
99 	int			sysctl_checksum;
100 
101 	struct ct_pcpu __percpu *pcpu_lists;
102 	struct ip_conntrack_stat __percpu *stat;
103 	struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
104 	struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
105 	struct nf_ip_net	nf_ct_proto;
106 #if defined(CONFIG_NF_CONNTRACK_LABELS)
107 	unsigned int		labels_used;
108 #endif
109 };
110 #endif
111