mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-14 10:54:47 +00:00
generic: 5.15: standardize tcp_no_window_check pending patch
Standardize pending patch tcp_no_window_check patch as with new kernel they added a check for global variables. The 2 new condition are that they must be read-only or the data pointer should not point to kernel/module global data. Remove the global variable and move it to a standard place following other variables logic. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
This commit is contained in:
parent
483503603c
commit
92fb51bc98
@ -8,21 +8,11 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
|
|
||||||
--- a/net/netfilter/nf_conntrack_proto_tcp.c
|
--- a/net/netfilter/nf_conntrack_proto_tcp.c
|
||||||
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
|
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
|
||||||
@@ -31,6 +31,9 @@
|
|
||||||
#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
|
|
||||||
#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
|
|
||||||
|
|
||||||
+/* Do not check the TCP window for incoming packets */
|
|
||||||
+static int nf_ct_tcp_no_window_check __read_mostly = 1;
|
|
||||||
+
|
|
||||||
/* FIXME: Examine ipfilter's timeouts and conntrack transitions more
|
|
||||||
closely. They're more complex. --RR */
|
|
||||||
|
|
||||||
@@ -476,6 +479,9 @@ static bool tcp_in_window(const struct n
|
@@ -476,6 +479,9 @@ static bool tcp_in_window(const struct n
|
||||||
s32 receiver_offset;
|
s32 receiver_offset;
|
||||||
bool res, in_recv_win;
|
bool res, in_recv_win;
|
||||||
|
|
||||||
+ if (nf_ct_tcp_no_window_check)
|
+ if (net->ct.sysctl_no_window_check)
|
||||||
+ return true;
|
+ return true;
|
||||||
+
|
+
|
||||||
/*
|
/*
|
||||||
@ -33,22 +23,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK])
|
timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK])
|
||||||
timeout = timeouts[TCP_CONNTRACK_UNACK];
|
timeout = timeouts[TCP_CONNTRACK_UNACK];
|
||||||
- else if (ct->proto.tcp.last_win == 0 &&
|
- else if (ct->proto.tcp.last_win == 0 &&
|
||||||
+ else if (!nf_ct_tcp_no_window_check && ct->proto.tcp.last_win == 0 &&
|
+ else if (!net->ct.sysctl_no_window_check && ct->proto.tcp.last_win == 0 &&
|
||||||
timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS])
|
timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS])
|
||||||
timeout = timeouts[TCP_CONNTRACK_RETRANS];
|
timeout = timeouts[TCP_CONNTRACK_RETRANS];
|
||||||
else
|
else
|
||||||
--- a/net/netfilter/nf_conntrack_standalone.c
|
--- a/net/netfilter/nf_conntrack_standalone.c
|
||||||
+++ b/net/netfilter/nf_conntrack_standalone.c
|
+++ b/net/netfilter/nf_conntrack_standalone.c
|
||||||
@@ -25,6 +25,9 @@
|
|
||||||
#include <net/netfilter/nf_conntrack_timestamp.h>
|
|
||||||
#include <linux/rculist_nulls.h>
|
|
||||||
|
|
||||||
+/* Do not check the TCP window for incoming packets */
|
|
||||||
+static int nf_ct_tcp_no_window_check __read_mostly = 1;
|
|
||||||
+
|
|
||||||
static bool enable_hooks __read_mostly;
|
|
||||||
MODULE_PARM_DESC(enable_hooks, "Always enable conntrack hooks");
|
|
||||||
module_param(enable_hooks, bool, 0000);
|
|
||||||
@@ -660,6 +663,7 @@ enum nf_ct_sysctl_index {
|
@@ -660,6 +663,7 @@ enum nf_ct_sysctl_index {
|
||||||
NF_SYSCTL_CT_PROTO_TIMEOUT_GRE_STREAM,
|
NF_SYSCTL_CT_PROTO_TIMEOUT_GRE_STREAM,
|
||||||
#endif
|
#endif
|
||||||
@ -63,7 +43,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
#endif
|
#endif
|
||||||
+ [NF_SYSCTL_CT_PROTO_TCP_NO_WINDOW_CHECK] = {
|
+ [NF_SYSCTL_CT_PROTO_TCP_NO_WINDOW_CHECK] = {
|
||||||
+ .procname = "nf_conntrack_tcp_no_window_check",
|
+ .procname = "nf_conntrack_tcp_no_window_check",
|
||||||
+ .data = &nf_ct_tcp_no_window_check,
|
+ .data = &init_net.ct.sysctl_no_window_check,
|
||||||
+ .maxlen = sizeof(unsigned int),
|
+ .maxlen = sizeof(unsigned int),
|
||||||
+ .mode = 0644,
|
+ .mode = 0644,
|
||||||
+ .proc_handler = proc_dointvec,
|
+ .proc_handler = proc_dointvec,
|
||||||
@ -71,3 +51,29 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1164,6 +1164,7 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net)
|
||||||
|
#ifdef CONFIG_NF_CONNTRACK_EVENTS
|
||||||
|
table[NF_SYSCTL_CT_EVENTS].data = &net->ct.sysctl_events;
|
||||||
|
#endif
|
||||||
|
+ table[NF_SYSCTL_CT_PROTO_TCP_NO_WINDOW_CHECK].data = &net->ct.sysctl_no_window_check;
|
||||||
|
#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
|
||||||
|
table[NF_SYSCTL_CT_TIMESTAMP].data = &net->ct.sysctl_tstamp;
|
||||||
|
#endif
|
||||||
|
@@ -1220,6 +1220,7 @@
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
net->ct.sysctl_checksum = 1;
|
||||||
|
+ net->ct.sysctl_no_window_check = 1;
|
||||||
|
|
||||||
|
ret = nf_conntrack_standalone_init_sysctl(net);
|
||||||
|
if (ret < 0)
|
||||||
|
--- a/include/net/netns/conntrack.h
|
||||||
|
+++ b/include/net/netns/conntrack.h
|
||||||
|
@@ -109,6 +109,7 @@ struct netns_ct {
|
||||||
|
u8 sysctl_auto_assign_helper;
|
||||||
|
u8 sysctl_tstamp;
|
||||||
|
u8 sysctl_checksum;
|
||||||
|
+ u8 sysctl_no_window_check;
|
||||||
|
|
||||||
|
struct ct_pcpu __percpu *pcpu_lists;
|
||||||
|
struct ip_conntrack_stat __percpu *stat;
|
||||||
|
Loading…
Reference in New Issue
Block a user