forked from microsoft/WSL2-Linux-Kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
netfilter: nf_conntrack: make sequence number adjustments usuable wit…
…hout NAT Split out sequence number adjustments from NAT and move them to the conntrack core to make them usable for SYN proxying. The sequence number adjustment information is moved to a seperate extend. The extend is added to new conntracks when a NAT mapping is set up for a connection using a helper. As a side effect, this saves 24 bytes per connection with NAT in the common case that a connection does not have a helper assigned. Signed-off-by: Patrick McHardy <kaber@trash.net> Tested-by: Martin Topholm <mph@one.com> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
- Loading branch information
Showing
18 changed files
with
369 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef _NF_CONNTRACK_SEQADJ_H | ||
#define _NF_CONNTRACK_SEQADJ_H | ||
|
||
#include <net/netfilter/nf_conntrack_extend.h> | ||
|
||
/** | ||
* struct nf_ct_seqadj - sequence number adjustment information | ||
* | ||
* @correction_pos: position of the last TCP sequence number modification | ||
* @offset_before: sequence number offset before last modification | ||
* @offset_after: sequence number offset after last modification | ||
*/ | ||
struct nf_ct_seqadj { | ||
u32 correction_pos; | ||
s32 offset_before; | ||
s32 offset_after; | ||
}; | ||
|
||
struct nf_conn_seqadj { | ||
struct nf_ct_seqadj seq[IP_CT_DIR_MAX]; | ||
}; | ||
|
||
static inline struct nf_conn_seqadj *nfct_seqadj(const struct nf_conn *ct) | ||
{ | ||
return nf_ct_ext_find(ct, NF_CT_EXT_SEQADJ); | ||
} | ||
|
||
static inline struct nf_conn_seqadj *nfct_seqadj_ext_add(struct nf_conn *ct) | ||
{ | ||
return nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ, GFP_ATOMIC); | ||
} | ||
|
||
extern int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo, | ||
__be32 seq, s32 off); | ||
extern void nf_ct_tcp_seqadj_set(struct sk_buff *skb, | ||
struct nf_conn *ct, | ||
enum ip_conntrack_info ctinfo, | ||
s32 off); | ||
|
||
extern int nf_ct_seq_adjust(struct sk_buff *skb, | ||
struct nf_conn *ct, enum ip_conntrack_info ctinfo, | ||
unsigned int protoff); | ||
extern s32 nf_ct_seq_offset(const struct nf_conn *ct, enum ip_conntrack_dir, | ||
u32 seq); | ||
|
||
extern int nf_conntrack_seqadj_init(void); | ||
extern void nf_conntrack_seqadj_fini(void); | ||
|
||
#endif /* _NF_CONNTRACK_SEQADJ_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.