1 From: Felix Fietkau <nbd@nbd.name>
2 Subject: netfilter: optional tcp window check
4 Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 net/netfilter/nf_conntrack_proto_tcp.c | 13 +++++++++++++
7 1 file changed, 13 insertions(+)
9 diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
10 index 69f687740c76..f24b62668dc8 100644
11 --- a/net/netfilter/nf_conntrack_proto_tcp.c
12 +++ b/net/netfilter/nf_conntrack_proto_tcp.c
14 #include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
15 #include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
17 +/* Do not check the TCP window for incoming packets */
18 +static int nf_ct_tcp_no_window_check __read_mostly = 1;
20 /* "Be conservative in what you do,
21 be liberal in what you accept from others."
22 If it's non-zero, we mark only out of window RST segments as INVALID. */
23 @@ -513,6 +516,9 @@ static bool tcp_in_window(const struct nf_conn *ct,
25 bool res, in_recv_win;
27 + if (nf_ct_tcp_no_window_check)
31 * Get the required data from the packet.
33 @@ -1479,6 +1485,13 @@ static struct ctl_table tcp_sysctl_table[] = {
35 .proc_handler = proc_dointvec,
38 + .procname = "nf_conntrack_tcp_no_window_check",
39 + .data = &nf_ct_tcp_no_window_check,
40 + .maxlen = sizeof(unsigned int),
42 + .proc_handler = proc_dointvec,
46 #endif /* CONFIG_SYSCTL */