conntrack.h 3.0 KB
Newer Older
1 2 3
#ifndef __NETNS_CONNTRACK_H
#define __NETNS_CONNTRACK_H

4
#include <linux/list.h>
5
#include <linux/list_nulls.h>
A
Arun Sharma 已提交
6
#include <linux/atomic.h>
7
#include <linux/workqueue.h>
8
#include <linux/netfilter/nf_conntrack_tcp.h>
9 10 11
#ifdef CONFIG_NF_CT_PROTO_DCCP
#include <linux/netfilter/nf_conntrack_dccp.h>
#endif
12 13 14
#ifdef CONFIG_NF_CT_PROTO_SCTP
#include <linux/netfilter/nf_conntrack_sctp.h>
#endif
15
#include <linux/seqlock.h>
16

17
struct ctl_table_header;
18 19
struct nf_conntrack_ecache;

20 21 22 23 24 25 26 27
struct nf_proto_net {
#ifdef CONFIG_SYSCTL
	struct ctl_table_header *ctl_table_header;
	struct ctl_table        *ctl_table;
#endif
	unsigned int		users;
};

28 29 30 31 32
struct nf_generic_net {
	struct nf_proto_net pn;
	unsigned int timeout;
};

33 34 35 36 37 38 39 40
struct nf_tcp_net {
	struct nf_proto_net pn;
	unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX];
	unsigned int tcp_loose;
	unsigned int tcp_be_liberal;
	unsigned int tcp_max_retrans;
};

41 42 43 44 45 46 47 48 49 50 51
enum udp_conntrack {
	UDP_CT_UNREPLIED,
	UDP_CT_REPLIED,
	UDP_CT_MAX
};

struct nf_udp_net {
	struct nf_proto_net pn;
	unsigned int timeouts[UDP_CT_MAX];
};

52 53 54 55 56
struct nf_icmp_net {
	struct nf_proto_net pn;
	unsigned int timeout;
};

57 58 59 60 61 62 63 64
#ifdef CONFIG_NF_CT_PROTO_DCCP
struct nf_dccp_net {
	struct nf_proto_net pn;
	int dccp_loose;
	unsigned int dccp_timeout[CT_DCCP_MAX + 1];
};
#endif

65 66 67 68 69 70 71
#ifdef CONFIG_NF_CT_PROTO_SCTP
struct nf_sctp_net {
	struct nf_proto_net pn;
	unsigned int timeouts[SCTP_CONNTRACK_MAX];
};
#endif

72 73 74 75 76 77 78 79 80 81 82 83 84
#ifdef CONFIG_NF_CT_PROTO_UDPLITE
enum udplite_conntrack {
	UDPLITE_CT_UNREPLIED,
	UDPLITE_CT_REPLIED,
	UDPLITE_CT_MAX
};

struct nf_udplite_net {
	struct nf_proto_net pn;
	unsigned int timeouts[UDPLITE_CT_MAX];
};
#endif

85
struct nf_ip_net {
86
	struct nf_generic_net   generic;
87
	struct nf_tcp_net	tcp;
88
	struct nf_udp_net	udp;
89
	struct nf_icmp_net	icmp;
90
	struct nf_icmp_net	icmpv6;
91 92 93
#ifdef CONFIG_NF_CT_PROTO_DCCP
	struct nf_dccp_net	dccp;
#endif
94 95 96
#ifdef CONFIG_NF_CT_PROTO_SCTP
	struct nf_sctp_net	sctp;
#endif
97 98 99
#ifdef CONFIG_NF_CT_PROTO_UDPLITE
	struct nf_udplite_net	udplite;
#endif
100 101
};

102 103 104 105 106 107
struct ct_pcpu {
	spinlock_t		lock;
	struct hlist_nulls_head unconfirmed;
	struct hlist_nulls_head dying;
};

108
struct netns_ct {
109
	atomic_t		count;
110
	unsigned int		expect_count;
111 112 113 114
#ifdef CONFIG_NF_CONNTRACK_EVENTS
	struct delayed_work ecache_dwork;
	bool ecache_dwork_pending;
#endif
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
#ifdef CONFIG_SYSCTL
	struct ctl_table_header	*sysctl_header;
	struct ctl_table_header	*acct_sysctl_header;
	struct ctl_table_header	*tstamp_sysctl_header;
	struct ctl_table_header	*event_sysctl_header;
	struct ctl_table_header	*helper_sysctl_header;
#endif
	unsigned int		sysctl_log_invalid; /* Log invalid packets */
	int			sysctl_events;
	int			sysctl_acct;
	int			sysctl_auto_assign_helper;
	bool			auto_assign_helper_warned;
	int			sysctl_tstamp;
	int			sysctl_checksum;

130
	struct ct_pcpu __percpu *pcpu_lists;
131
	struct ip_conntrack_stat __percpu *stat;
132 133
	struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
	struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
134
	struct nf_ip_net	nf_ct_proto;
135 136 137
#if defined(CONFIG_NF_CONNTRACK_LABELS)
	unsigned int		labels_used;
#endif
138 139
};
#endif