1 #ifndef _NF_CONNTRACK_TCP_H
2 #define _NF_CONNTRACK_TCP_H
5 #include <linux/types.h>
7 /* This is exposed to userspace (ctnetlink) */
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,
18 TCP_CONNTRACK_LISTEN, /* obsolete */
19 #define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN
22 TCP_CONNTRACK_RETRANS,
24 TCP_CONNTRACK_TIMEOUT_MAX
27 /* Window scaling is advertised by the sender */
28 #define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01
30 /* SACK is permitted by the sender */
31 #define IP_CT_TCP_FLAG_SACK_PERM 0x02
33 /* This sender sent FIN first */
34 #define IP_CT_TCP_FLAG_CLOSE_INIT 0x04
36 /* Be liberal in window checking */
37 #define IP_CT_TCP_FLAG_BE_LIBERAL 0x08
39 /* Has unacknowledged data */
40 #define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10
42 /* The field td_maxack has been set */
43 #define IP_CT_TCP_FLAG_MAXACK_SET 0x20
45 struct nf_ct_tcp_flags {
52 struct ip_ct_tcp_state {
53 u_int32_t td_end; /* max of seq + len */
54 u_int32_t td_maxend; /* max of ack + max(win, 1) */
55 u_int32_t td_maxwin; /* max(win) */
56 u_int32_t td_maxack; /* max of ack */
57 u_int8_t td_scale; /* window scale factor */
58 u_int8_t flags; /* per direction options */
62 struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */
63 u_int8_t state; /* state of the connection (enum tcp_conntrack) */
64 /* For detecting stale connections */
65 u_int8_t last_dir; /* Direction of the last packet (enum ip_conntrack_dir) */
66 u_int8_t retrans; /* Number of retransmitted packets */
67 u_int8_t last_index; /* Index of the last packet */
68 u_int32_t last_seq; /* Last sequence number seen in dir */
69 u_int32_t last_ack; /* Last sequence number seen in opposite dir */
70 u_int32_t last_end; /* Last seq + len */
71 u_int16_t last_win; /* Last window advertisement seen in dir */
72 /* For SYN packets while we may be out-of-sync */
73 u_int8_t last_wscale; /* Last window scaling factor seen */
74 u_int8_t last_flags; /* Last flags set */
77 #endif /* __KERNEL__ */
79 #endif /* _NF_CONNTRACK_TCP_H */