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