1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _NF_CONNTRACK_SEQADJ_H
3 #define _NF_CONNTRACK_SEQADJ_H
5 #include <net/netfilter/nf_conntrack_extend.h>
8 * struct nf_ct_seqadj - sequence number adjustment information
10 * @correction_pos: position of the last TCP sequence number modification
11 * @offset_before: sequence number offset before last modification
12 * @offset_after: sequence number offset after last modification
20 struct nf_conn_seqadj {
21 struct nf_ct_seqadj seq[IP_CT_DIR_MAX];
24 static inline struct nf_conn_seqadj *nfct_seqadj(const struct nf_conn *ct)
26 return nf_ct_ext_find(ct, NF_CT_EXT_SEQADJ);
29 static inline struct nf_conn_seqadj *nfct_seqadj_ext_add(struct nf_conn *ct)
31 return nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ, GFP_ATOMIC);
34 int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
36 int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
38 void nf_ct_tcp_seqadj_set(struct sk_buff *skb, struct nf_conn *ct,
39 enum ip_conntrack_info ctinfo, s32 off);
41 int nf_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct,
42 enum ip_conntrack_info ctinfo, unsigned int protoff);
43 s32 nf_ct_seq_offset(const struct nf_conn *ct, enum ip_conntrack_dir, u32 seq);
45 int nf_conntrack_seqadj_init(void);
46 void nf_conntrack_seqadj_fini(void);
48 #endif /* _NF_CONNTRACK_SEQADJ_H */