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
8 /* Part of an established connection (either direction). */
11 /* Like NEW, but related to an existing connection, or ICMP error
12 (in either direction). */
15 /* Started a new connection to track (only
16 IP_CT_DIR_ORIGINAL); may be a retransmission. */
19 /* >= this indicates reply direction */
22 /* Number of distinct IP_CT types (no NEW in reply dirn). */
23 IP_CT_NUMBER
= IP_CT_IS_REPLY
* 2 - 1
26 /* Bitset representing status of connection. */
27 enum ip_conntrack_status
{
28 /* It's an expected connection: bit 0 set. This bit never changed */
30 IPS_EXPECTED
= (1 << IPS_EXPECTED_BIT
),
32 /* We've seen packets both ways: bit 1 set. Can be set, not unset. */
33 IPS_SEEN_REPLY_BIT
= 1,
34 IPS_SEEN_REPLY
= (1 << IPS_SEEN_REPLY_BIT
),
36 /* Conntrack should never be early-expired. */
38 IPS_ASSURED
= (1 << IPS_ASSURED_BIT
),
40 /* Connection is confirmed: originating packet has left box */
41 IPS_CONFIRMED_BIT
= 3,
42 IPS_CONFIRMED
= (1 << IPS_CONFIRMED_BIT
),
44 /* Connection needs src nat in orig dir. This bit never changed. */
46 IPS_SRC_NAT
= (1 << IPS_SRC_NAT_BIT
),
48 /* Connection needs dst nat in orig dir. This bit never changed. */
50 IPS_DST_NAT
= (1 << IPS_DST_NAT_BIT
),
53 IPS_NAT_MASK
= (IPS_DST_NAT
| IPS_SRC_NAT
),
55 /* Connection needs TCP sequence adjusted. */
56 IPS_SEQ_ADJUST_BIT
= 6,
57 IPS_SEQ_ADJUST
= (1 << IPS_SEQ_ADJUST_BIT
),
59 /* NAT initialization bits. */
60 IPS_SRC_NAT_DONE_BIT
= 7,
61 IPS_SRC_NAT_DONE
= (1 << IPS_SRC_NAT_DONE_BIT
),
63 IPS_DST_NAT_DONE_BIT
= 8,
64 IPS_DST_NAT_DONE
= (1 << IPS_DST_NAT_DONE_BIT
),
67 IPS_NAT_DONE_MASK
= (IPS_DST_NAT_DONE
| IPS_SRC_NAT_DONE
),
69 /* Connection is dying (removed from lists), can not be unset. */
71 IPS_DYING
= (1 << IPS_DYING_BIT
),
73 /* Connection has fixed timeout. */
74 IPS_FIXED_TIMEOUT_BIT
= 10,
75 IPS_FIXED_TIMEOUT
= (1 << IPS_FIXED_TIMEOUT_BIT
),
79 struct ip_conntrack_stat
81 unsigned int searched
;
87 unsigned int delete_list
;
89 unsigned int insert_failed
;
91 unsigned int early_drop
;
93 unsigned int expect_new
;
94 unsigned int expect_create
;
95 unsigned int expect_delete
;
98 /* call to create an explicit dependency on nf_conntrack. */
99 extern void need_conntrack(void);
101 #endif /* __KERNEL__ */
103 #endif /* _NF_CONNTRACK_COMMON_H */