blob: 29d6a94db54d6136b6b380d5817341d2bbe83bce [file] [log] [blame]
Alexey Dobriyandfdb8d72008-10-08 11:35:02 +02001#ifndef __NETNS_CONNTRACK_H
2#define __NETNS_CONNTRACK_H
3
Alexey Dobriyan63c9a262008-10-08 11:35:04 +02004#include <linux/list.h>
Eric Dumazetea781f12009-03-25 21:05:46 +01005#include <linux/list_nulls.h>
Arun Sharma600634972011-07-26 16:09:06 -07006#include <linux/atomic.h>
Florian Westphal95005072014-06-10 23:12:56 +02007#include <linux/workqueue.h>
Gao fengd2ba1fde2012-05-28 21:04:12 +00008#include <linux/netfilter/nf_conntrack_tcp.h>
Jesper Dangaard Brouer93bb0ce2014-03-03 14:46:13 +01009#include <linux/seqlock.h>
Alexey Dobriyan49ac8712008-10-08 11:35:03 +020010
Alexey Dobriyan80250702008-10-08 11:35:08 +020011struct ctl_table_header;
Alexey Dobriyan6058fa62008-10-08 11:35:07 +020012struct nf_conntrack_ecache;
13
Gao feng2c352f42012-05-28 21:04:09 +000014struct nf_proto_net {
15#ifdef CONFIG_SYSCTL
16 struct ctl_table_header *ctl_table_header;
17 struct ctl_table *ctl_table;
18#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
19 struct ctl_table_header *ctl_compat_header;
20 struct ctl_table *ctl_compat_table;
21#endif
22#endif
23 unsigned int users;
24};
25
Gao feng15f585b2012-05-28 21:04:11 +000026struct nf_generic_net {
27 struct nf_proto_net pn;
28 unsigned int timeout;
29};
30
Gao fengd2ba1fde2012-05-28 21:04:12 +000031struct nf_tcp_net {
32 struct nf_proto_net pn;
33 unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX];
34 unsigned int tcp_loose;
35 unsigned int tcp_be_liberal;
36 unsigned int tcp_max_retrans;
37};
38
Gao feng0ce490a2012-05-28 21:04:13 +000039enum udp_conntrack {
40 UDP_CT_UNREPLIED,
41 UDP_CT_REPLIED,
42 UDP_CT_MAX
43};
44
45struct nf_udp_net {
46 struct nf_proto_net pn;
47 unsigned int timeouts[UDP_CT_MAX];
48};
49
Gao feng4b626b92012-05-28 21:04:14 +000050struct nf_icmp_net {
51 struct nf_proto_net pn;
52 unsigned int timeout;
53};
54
Gao feng524a53e2012-05-28 21:04:10 +000055struct nf_ip_net {
Gao feng15f585b2012-05-28 21:04:11 +000056 struct nf_generic_net generic;
Gao fengd2ba1fde2012-05-28 21:04:12 +000057 struct nf_tcp_net tcp;
Gao feng0ce490a2012-05-28 21:04:13 +000058 struct nf_udp_net udp;
Gao feng4b626b92012-05-28 21:04:14 +000059 struct nf_icmp_net icmp;
Gao feng7080ba02012-05-28 21:04:15 +000060 struct nf_icmp_net icmpv6;
Gao feng524a53e2012-05-28 21:04:10 +000061#if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT)
62 struct ctl_table_header *ctl_table_header;
63 struct ctl_table *ctl_table;
64#endif
65};
66
Jesper Dangaard Brouerb7779d02014-03-03 14:45:20 +010067struct ct_pcpu {
68 spinlock_t lock;
69 struct hlist_nulls_head unconfirmed;
70 struct hlist_nulls_head dying;
71 struct hlist_nulls_head tmpl;
72};
73
Alexey Dobriyandfdb8d72008-10-08 11:35:02 +020074struct netns_ct {
Alexey Dobriyan49ac8712008-10-08 11:35:03 +020075 atomic_t count;
Alexey Dobriyan9b03f382008-10-08 11:35:03 +020076 unsigned int expect_count;
Florian Westphal95005072014-06-10 23:12:56 +020077#ifdef CONFIG_NF_CONNTRACK_EVENTS
78 struct delayed_work ecache_dwork;
79 bool ecache_dwork_pending;
80#endif
Jesper Dangaard Brouer8cf4d6a2013-11-15 15:57:53 +010081#ifdef CONFIG_SYSCTL
82 struct ctl_table_header *sysctl_header;
83 struct ctl_table_header *acct_sysctl_header;
84 struct ctl_table_header *tstamp_sysctl_header;
85 struct ctl_table_header *event_sysctl_header;
86 struct ctl_table_header *helper_sysctl_header;
87#endif
88 char *slabname;
89 unsigned int sysctl_log_invalid; /* Log invalid packets */
Jesper Dangaard Brouer8cf4d6a2013-11-15 15:57:53 +010090 int sysctl_events;
91 int sysctl_acct;
92 int sysctl_auto_assign_helper;
93 bool auto_assign_helper_warned;
94 int sysctl_tstamp;
95 int sysctl_checksum;
96
Patrick McHardyd696c7b2010-02-08 11:18:07 -080097 unsigned int htable_size;
Jesper Dangaard Brouer93bb0ce2014-03-03 14:46:13 +010098 seqcount_t generation;
Eric Dumazet5b3501f2010-02-08 11:16:56 -080099 struct kmem_cache *nf_conntrack_cachep;
Eric Dumazetea781f12009-03-25 21:05:46 +0100100 struct hlist_nulls_head *hash;
Alexey Dobriyan9b03f382008-10-08 11:35:03 +0200101 struct hlist_head *expect_hash;
Jesper Dangaard Brouerb7779d02014-03-03 14:45:20 +0100102 struct ct_pcpu __percpu *pcpu_lists;
Tejun Heo7d720c32010-02-16 15:20:26 +0000103 struct ip_conntrack_stat __percpu *stat;
Pablo Neira Ayuso70e99422011-11-22 00:16:51 +0100104 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
105 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
Gao feng524a53e2012-05-28 21:04:10 +0000106 struct nf_ip_net nf_ct_proto;
Florian Westphalc539f012013-01-11 06:30:44 +0000107#if defined(CONFIG_NF_CONNTRACK_LABELS)
108 unsigned int labels_used;
109 u8 label_words;
110#endif
Patrick McHardyc7232c92012-08-26 19:14:06 +0200111#ifdef CONFIG_NF_NAT_NEEDED
112 struct hlist_head *nat_bysource;
113 unsigned int nat_htable_size;
114#endif
Alexey Dobriyandfdb8d72008-10-08 11:35:02 +0200115};
116#endif