Commit | Line | Data |
---|---|---|
9fb9cbb1 YK |
1 | #ifndef _NF_CONNTRACK_COMMON_H |
2 | #define _NF_CONNTRACK_COMMON_H | |
3 | /* Connection state tracking for netfilter. This is separated from, | |
4 | but required by, the NAT layer; it can also be used by an iptables | |
5 | extension. */ | |
d94d9fee | 6 | enum ip_conntrack_info { |
9fb9cbb1 YK |
7 | /* Part of an established connection (either direction). */ |
8 | IP_CT_ESTABLISHED, | |
9 | ||
10 | /* Like NEW, but related to an existing connection, or ICMP error | |
11 | (in either direction). */ | |
12 | IP_CT_RELATED, | |
13 | ||
14 | /* Started a new connection to track (only | |
15 | IP_CT_DIR_ORIGINAL); may be a retransmission. */ | |
16 | IP_CT_NEW, | |
17 | ||
18 | /* >= this indicates reply direction */ | |
19 | IP_CT_IS_REPLY, | |
20 | ||
21 | /* Number of distinct IP_CT types (no NEW in reply dirn). */ | |
22 | IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1 | |
23 | }; | |
24 | ||
25 | /* Bitset representing status of connection. */ | |
26 | enum ip_conntrack_status { | |
27 | /* It's an expected connection: bit 0 set. This bit never changed */ | |
28 | IPS_EXPECTED_BIT = 0, | |
29 | IPS_EXPECTED = (1 << IPS_EXPECTED_BIT), | |
30 | ||
31 | /* We've seen packets both ways: bit 1 set. Can be set, not unset. */ | |
32 | IPS_SEEN_REPLY_BIT = 1, | |
33 | IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT), | |
34 | ||
35 | /* Conntrack should never be early-expired. */ | |
36 | IPS_ASSURED_BIT = 2, | |
37 | IPS_ASSURED = (1 << IPS_ASSURED_BIT), | |
38 | ||
39 | /* Connection is confirmed: originating packet has left box */ | |
40 | IPS_CONFIRMED_BIT = 3, | |
41 | IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT), | |
42 | ||
43 | /* Connection needs src nat in orig dir. This bit never changed. */ | |
44 | IPS_SRC_NAT_BIT = 4, | |
45 | IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT), | |
46 | ||
47 | /* Connection needs dst nat in orig dir. This bit never changed. */ | |
48 | IPS_DST_NAT_BIT = 5, | |
49 | IPS_DST_NAT = (1 << IPS_DST_NAT_BIT), | |
50 | ||
51 | /* Both together. */ | |
52 | IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT), | |
53 | ||
54 | /* Connection needs TCP sequence adjusted. */ | |
55 | IPS_SEQ_ADJUST_BIT = 6, | |
56 | IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT), | |
57 | ||
58 | /* NAT initialization bits. */ | |
59 | IPS_SRC_NAT_DONE_BIT = 7, | |
60 | IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT), | |
61 | ||
62 | IPS_DST_NAT_DONE_BIT = 8, | |
63 | IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT), | |
64 | ||
65 | /* Both together */ | |
66 | IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), | |
67 | ||
68 | /* Connection is dying (removed from lists), can not be unset. */ | |
69 | IPS_DYING_BIT = 9, | |
70 | IPS_DYING = (1 << IPS_DYING_BIT), | |
997ae831 EL |
71 | |
72 | /* Connection has fixed timeout. */ | |
73 | IPS_FIXED_TIMEOUT_BIT = 10, | |
74 | IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), | |
9fb9cbb1 YK |
75 | }; |
76 | ||
9fb9cbb1 | 77 | #ifdef __KERNEL__ |
d94d9fee | 78 | struct ip_conntrack_stat { |
9fb9cbb1 YK |
79 | unsigned int searched; |
80 | unsigned int found; | |
81 | unsigned int new; | |
82 | unsigned int invalid; | |
83 | unsigned int ignore; | |
84 | unsigned int delete; | |
85 | unsigned int delete_list; | |
86 | unsigned int insert; | |
87 | unsigned int insert_failed; | |
88 | unsigned int drop; | |
89 | unsigned int early_drop; | |
90 | unsigned int error; | |
91 | unsigned int expect_new; | |
92 | unsigned int expect_create; | |
93 | unsigned int expect_delete; | |
94 | }; | |
95 | ||
2e4e6a17 HW |
96 | /* call to create an explicit dependency on nf_conntrack. */ |
97 | extern void need_conntrack(void); | |
98 | ||
9fb9cbb1 YK |
99 | #endif /* __KERNEL__ */ |
100 | ||
101 | #endif /* _NF_CONNTRACK_COMMON_H */ |