Patrick McHardy | 41d73ec | 2013-08-27 08:50:12 +0200 | [diff] [blame] | 1 | #ifndef _NF_CONNTRACK_SEQADJ_H |
| 2 | #define _NF_CONNTRACK_SEQADJ_H |
| 3 | |
| 4 | #include <net/netfilter/nf_conntrack_extend.h> |
| 5 | |
| 6 | /** |
| 7 | * struct nf_ct_seqadj - sequence number adjustment information |
| 8 | * |
| 9 | * @correction_pos: position of the last TCP sequence number modification |
| 10 | * @offset_before: sequence number offset before last modification |
| 11 | * @offset_after: sequence number offset after last modification |
| 12 | */ |
| 13 | struct nf_ct_seqadj { |
| 14 | u32 correction_pos; |
| 15 | s32 offset_before; |
| 16 | s32 offset_after; |
| 17 | }; |
| 18 | |
| 19 | struct nf_conn_seqadj { |
| 20 | struct nf_ct_seqadj seq[IP_CT_DIR_MAX]; |
| 21 | }; |
| 22 | |
| 23 | static inline struct nf_conn_seqadj *nfct_seqadj(const struct nf_conn *ct) |
| 24 | { |
| 25 | return nf_ct_ext_find(ct, NF_CT_EXT_SEQADJ); |
| 26 | } |
| 27 | |
| 28 | static inline struct nf_conn_seqadj *nfct_seqadj_ext_add(struct nf_conn *ct) |
| 29 | { |
| 30 | return nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ, GFP_ATOMIC); |
| 31 | } |
| 32 | |
Joe Perches | 4e77be4 | 2013-09-23 11:37:48 -0700 | [diff] [blame] | 33 | int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo, |
| 34 | s32 off); |
| 35 | int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo, |
| 36 | __be32 seq, s32 off); |
| 37 | void nf_ct_tcp_seqadj_set(struct sk_buff *skb, struct nf_conn *ct, |
| 38 | enum ip_conntrack_info ctinfo, s32 off); |
Patrick McHardy | 41d73ec | 2013-08-27 08:50:12 +0200 | [diff] [blame] | 39 | |
Joe Perches | 4e77be4 | 2013-09-23 11:37:48 -0700 | [diff] [blame] | 40 | int nf_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct, |
| 41 | enum ip_conntrack_info ctinfo, unsigned int protoff); |
| 42 | s32 nf_ct_seq_offset(const struct nf_conn *ct, enum ip_conntrack_dir, u32 seq); |
Patrick McHardy | 41d73ec | 2013-08-27 08:50:12 +0200 | [diff] [blame] | 43 | |
Joe Perches | 4e77be4 | 2013-09-23 11:37:48 -0700 | [diff] [blame] | 44 | int nf_conntrack_seqadj_init(void); |
| 45 | void nf_conntrack_seqadj_fini(void); |
Patrick McHardy | 41d73ec | 2013-08-27 08:50:12 +0200 | [diff] [blame] | 46 | |
| 47 | #endif /* _NF_CONNTRACK_SEQADJ_H */ |