kernel: Bump to 4.14.277
[librecmc/librecmc.git] / target / linux / generic / pending-4.14 / 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 --- a/net/netfilter/nf_conntrack_proto_tcp.c
10 +++ b/net/netfilter/nf_conntrack_proto_tcp.c
11 @@ -33,6 +33,9 @@
12  #include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
13  #include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
14  
15 +/* Do not check the TCP window for incoming packets  */
16 +static int nf_ct_tcp_no_window_check __read_mostly = 1;
17 +
18  /* "Be conservative in what you do,
19      be liberal in what you accept from others."
20      If it's non-zero, we mark only out of window RST segments as INVALID. */
21 @@ -508,6 +511,9 @@ static bool tcp_in_window(const struct n
22         s32 receiver_offset;
23         bool res, in_recv_win;
24  
25 +       if (nf_ct_tcp_no_window_check)
26 +               return true;
27 +
28         /*
29          * Get the required data from the packet.
30          */
31 @@ -1498,6 +1504,13 @@ static struct ctl_table tcp_sysctl_table
32                 .mode           = 0644,
33                 .proc_handler   = proc_dointvec,
34         },
35 +       {
36 +               .procname       = "nf_conntrack_tcp_no_window_check",
37 +               .data           = &nf_ct_tcp_no_window_check,
38 +               .maxlen         = sizeof(unsigned int),
39 +               .mode           = 0644,
40 +               .proc_handler   = proc_dointvec,
41 +       },
42         { }
43  };
44  #endif /* CONFIG_SYSCTL */