]>
Commit | Line | Data |
---|---|---|
9fb9cbb1 YK |
1 | #ifndef _NF_CONNTRACK_TCP_H |
2 | #define _NF_CONNTRACK_TCP_H | |
3 | /* TCP tracking. */ | |
4 | ||
60c195c7 AB |
5 | #include <linux/types.h> |
6 | ||
9fb9cbb1 YK |
7 | /* This is exposed to userspace (ctnetlink) */ |
8 | enum tcp_conntrack { | |
9 | TCP_CONNTRACK_NONE, | |
10 | TCP_CONNTRACK_SYN_SENT, | |
11 | TCP_CONNTRACK_SYN_RECV, | |
12 | TCP_CONNTRACK_ESTABLISHED, | |
13 | TCP_CONNTRACK_FIN_WAIT, | |
14 | TCP_CONNTRACK_CLOSE_WAIT, | |
15 | TCP_CONNTRACK_LAST_ACK, | |
16 | TCP_CONNTRACK_TIME_WAIT, | |
17 | TCP_CONNTRACK_CLOSE, | |
874ab923 JK |
18 | TCP_CONNTRACK_LISTEN, /* obsolete */ |
19 | #define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN | |
9fb9cbb1 YK |
20 | TCP_CONNTRACK_MAX, |
21 | TCP_CONNTRACK_IGNORE | |
22 | }; | |
23 | ||
24 | /* Window scaling is advertised by the sender */ | |
25 | #define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01 | |
26 | ||
27 | /* SACK is permitted by the sender */ | |
28 | #define IP_CT_TCP_FLAG_SACK_PERM 0x02 | |
29 | ||
30 | /* This sender sent FIN first */ | |
f79e7802 | 31 | #define IP_CT_TCP_FLAG_CLOSE_INIT 0x04 |
9fb9cbb1 | 32 | |
a09113c2 PM |
33 | /* Be liberal in window checking */ |
34 | #define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 | |
35 | ||
ae375044 PM |
36 | /* Has unacknowledged data */ |
37 | #define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10 | |
38 | ||
bfcaa502 JK |
39 | /* The field td_maxack has been set */ |
40 | #define IP_CT_TCP_FLAG_MAXACK_SET 0x20 | |
41 | ||
c8e2078c | 42 | struct nf_ct_tcp_flags { |
60c195c7 AB |
43 | __u8 flags; |
44 | __u8 mask; | |
c8e2078c PNA |
45 | }; |
46 | ||
9fb9cbb1 YK |
47 | #ifdef __KERNEL__ |
48 | ||
49 | struct ip_ct_tcp_state { | |
50 | u_int32_t td_end; /* max of seq + len */ | |
51 | u_int32_t td_maxend; /* max of ack + max(win, 1) */ | |
52 | u_int32_t td_maxwin; /* max(win) */ | |
bfcaa502 | 53 | u_int32_t td_maxack; /* max of ack */ |
9fb9cbb1 | 54 | u_int8_t td_scale; /* window scale factor */ |
9fb9cbb1 YK |
55 | u_int8_t flags; /* per direction options */ |
56 | }; | |
57 | ||
d94d9fee | 58 | struct ip_ct_tcp { |
9fb9cbb1 YK |
59 | struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */ |
60 | u_int8_t state; /* state of the connection (enum tcp_conntrack) */ | |
61 | /* For detecting stale connections */ | |
62 | u_int8_t last_dir; /* Direction of the last packet (enum ip_conntrack_dir) */ | |
63 | u_int8_t retrans; /* Number of retransmitted packets */ | |
64 | u_int8_t last_index; /* Index of the last packet */ | |
65 | u_int32_t last_seq; /* Last sequence number seen in dir */ | |
66 | u_int32_t last_ack; /* Last sequence number seen in opposite dir */ | |
67 | u_int32_t last_end; /* Last seq + len */ | |
c1fe3ca5 | 68 | u_int16_t last_win; /* Last window advertisement seen in dir */ |
9fb9cbb1 YK |
69 | }; |
70 | ||
71 | #endif /* __KERNEL__ */ | |
72 | ||
73 | #endif /* _NF_CONNTRACK_TCP_H */ |