nf_conntrack_tcp.h revision 874ab9233eeddb85fd2dd85131c145bde75da39a
1#ifndef _NF_CONNTRACK_TCP_H 2#define _NF_CONNTRACK_TCP_H 3/* TCP tracking. */ 4 5#include <linux/types.h> 6 7/* This is exposed to userspace (ctnetlink) */ 8enum 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, 18 TCP_CONNTRACK_LISTEN, /* obsolete */ 19#define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN 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 */ 31#define IP_CT_TCP_FLAG_CLOSE_INIT 0x04 32 33/* Be liberal in window checking */ 34#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 35 36/* Has unacknowledged data */ 37#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10 38 39struct nf_ct_tcp_flags { 40 __u8 flags; 41 __u8 mask; 42}; 43 44#ifdef __KERNEL__ 45 46struct ip_ct_tcp_state { 47 u_int32_t td_end; /* max of seq + len */ 48 u_int32_t td_maxend; /* max of ack + max(win, 1) */ 49 u_int32_t td_maxwin; /* max(win) */ 50 u_int8_t td_scale; /* window scale factor */ 51 u_int8_t flags; /* per direction options */ 52}; 53 54struct ip_ct_tcp 55{ 56 struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */ 57 u_int8_t state; /* state of the connection (enum tcp_conntrack) */ 58 /* For detecting stale connections */ 59 u_int8_t last_dir; /* Direction of the last packet (enum ip_conntrack_dir) */ 60 u_int8_t retrans; /* Number of retransmitted packets */ 61 u_int8_t last_index; /* Index of the last packet */ 62 u_int32_t last_seq; /* Last sequence number seen in dir */ 63 u_int32_t last_ack; /* Last sequence number seen in opposite dir */ 64 u_int32_t last_end; /* Last seq + len */ 65 u_int16_t last_win; /* Last window advertisement seen in dir */ 66}; 67 68#endif /* __KERNEL__ */ 69 70#endif /* _NF_CONNTRACK_TCP_H */ 71