kernel: split patches folder up into backport, pending and hack folders
[openwrt/openwrt.git] / target / linux / generic / pending-4.9 / 613-netfilter_optional_tcp_window_check.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Subject: netfilter: optional tcp window check
3
4 Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 ---
6 net/netfilter/nf_conntrack_proto_tcp.c | 13 +++++++++++++
7 1 file changed, 13 insertions(+)
8
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
13 @@ -33,6 +33,9 @@
14 #include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
15 #include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
16
17 +/* Do not check the TCP window for incoming packets */
18 +static int nf_ct_tcp_no_window_check __read_mostly = 1;
19 +
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,
24 s32 receiver_offset;
25 bool res, in_recv_win;
26
27 + if (nf_ct_tcp_no_window_check)
28 + return true;
29 +
30 /*
31 * Get the required data from the packet.
32 */
33 @@ -1479,6 +1485,13 @@ static struct ctl_table tcp_sysctl_table[] = {
34 .mode = 0644,
35 .proc_handler = proc_dointvec,
36 },
37 + {
38 + .procname = "nf_conntrack_tcp_no_window_check",
39 + .data = &nf_ct_tcp_no_window_check,
40 + .maxlen = sizeof(unsigned int),
41 + .mode = 0644,
42 + .proc_handler = proc_dointvec,
43 + },
44 { }
45 };
46 #endif /* CONFIG_SYSCTL */
47 --
48 2.11.0
49