-
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.
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
…t/pablo/nf-next Pablo Neira Ayuso says: ==================== The following patchset contains Netfilter updates for your net-next tree, they are: * The new SYNPROXY target for iptables, including IPv4 and IPv6 support, from Patrick McHardy. * nf_defrag_ipv6.o should be only linked to nf_defrag_ipv6.ko, from Nathan Hintz. * Fix an old bug in REJECT, which replies with wrong MAC source address from the bridge, by Phil Oester. * Fix uninitialized helper variable in the expectation support over nfnetlink_queue, from Florian Westphal. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
33 changed files
with
2,026 additions
and
400 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,51 @@ | ||
#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_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo, | ||
s32 off); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#ifndef _NF_CONNTRACK_SYNPROXY_H | ||
#define _NF_CONNTRACK_SYNPROXY_H | ||
|
||
#include <net/netns/generic.h> | ||
|
||
struct nf_conn_synproxy { | ||
u32 isn; | ||
u32 its; | ||
u32 tsoff; | ||
}; | ||
|
||
static inline struct nf_conn_synproxy *nfct_synproxy(const struct nf_conn *ct) | ||
{ | ||
#if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY) | ||
return nf_ct_ext_find(ct, NF_CT_EXT_SYNPROXY); | ||
#else | ||
return NULL; | ||
#endif | ||
} | ||
|
||
static inline struct nf_conn_synproxy *nfct_synproxy_ext_add(struct nf_conn *ct) | ||
{ | ||
#if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY) | ||
return nf_ct_ext_add(ct, NF_CT_EXT_SYNPROXY, GFP_ATOMIC); | ||
#else | ||
return NULL; | ||
#endif | ||
} | ||
|
||
struct synproxy_stats { | ||
unsigned int syn_received; | ||
unsigned int cookie_invalid; | ||
unsigned int cookie_valid; | ||
unsigned int cookie_retrans; | ||
unsigned int conn_reopened; | ||
}; | ||
|
||
struct synproxy_net { | ||
struct nf_conn *tmpl; | ||
struct synproxy_stats __percpu *stats; | ||
}; | ||
|
||
extern int synproxy_net_id; | ||
static inline struct synproxy_net *synproxy_pernet(struct net *net) | ||
{ | ||
return net_generic(net, synproxy_net_id); | ||
} | ||
|
||
struct synproxy_options { | ||
u8 options; | ||
u8 wscale; | ||
u16 mss; | ||
u32 tsval; | ||
u32 tsecr; | ||
}; | ||
|
||
struct tcphdr; | ||
struct xt_synproxy_info; | ||
extern void synproxy_parse_options(const struct sk_buff *skb, unsigned int doff, | ||
const struct tcphdr *th, | ||
struct synproxy_options *opts); | ||
extern unsigned int synproxy_options_size(const struct synproxy_options *opts); | ||
extern void synproxy_build_options(struct tcphdr *th, | ||
const struct synproxy_options *opts); | ||
|
||
extern void synproxy_init_timestamp_cookie(const struct xt_synproxy_info *info, | ||
struct synproxy_options *opts); | ||
extern void synproxy_check_timestamp_cookie(struct synproxy_options *opts); | ||
|
||
extern unsigned int synproxy_tstamp_adjust(struct sk_buff *skb, | ||
unsigned int protoff, | ||
struct tcphdr *th, | ||
struct nf_conn *ct, | ||
enum ip_conntrack_info ctinfo, | ||
const struct nf_conn_synproxy *synproxy); | ||
|
||
#endif /* _NF_CONNTRACK_SYNPROXY_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef _XT_SYNPROXY_H | ||
#define _XT_SYNPROXY_H | ||
|
||
#define XT_SYNPROXY_OPT_MSS 0x01 | ||
#define XT_SYNPROXY_OPT_WSCALE 0x02 | ||
#define XT_SYNPROXY_OPT_SACK_PERM 0x04 | ||
#define XT_SYNPROXY_OPT_TIMESTAMP 0x08 | ||
#define XT_SYNPROXY_OPT_ECN 0x10 | ||
|
||
struct xt_synproxy_info { | ||
__u8 options; | ||
__u8 wscale; | ||
__u16 mss; | ||
}; | ||
|
||
#endif /* _XT_SYNPROXY_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
Oops, something went wrong.