From 59b08e389968b6d4c383469945947f9809a58991 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 24 Feb 2021 16:36:03 +0800 Subject: [PATCH 2551/2944] alinux: Revert "TencentOS-kernel: ipvs: avoid drop first packet by reusing conntrack" fix #29256237 This reverts commit 173a802484fe547ba32db9ddf5067a667eb17d8c for this approach is deprecated since upstream has a more general solution, and it will be merged in the following patch. Signed-off-by: Tony Lu Acked-by: Dust Li --- Documentation/networking/ipvs-sysctl.txt | 23 ----------------------- include/net/ip_vs.h | 11 ----------- net/netfilter/ipvs/ip_vs_core.c | 11 ++--------- net/netfilter/ipvs/ip_vs_ctl.c | 8 -------- 4 files changed, 2 insertions(+), 51 deletions(-) diff --git a/Documentation/networking/ipvs-sysctl.txt b/Documentation/networking/ipvs-sysctl.txt index ba4f247..b2bf36d 100644 --- a/Documentation/networking/ipvs-sysctl.txt +++ b/Documentation/networking/ipvs-sysctl.txt @@ -43,29 +43,6 @@ conn_reuse_mode - INTEGER balancer in Direct Routing mode. This bit helps on adding new real servers to a very busy cluster. -conn_reuse_old_conntrack - BOOLEAN - - 0 - disabled (default) - - not 0 - enabled - - If set, when a new TCP syn packet hits an old ipvs connection - table and need reschedule to a new dest: if - 1) the packet uses conntrack - 2) the old ipvs connection table is not a master control - connection (E.g. the command connection of passive FTP) - 3) the old ipvs connection table hasn't been controlled by any - connection (E.g. the data connection of passive FTP) - ipvs will not release the old conntrack, just let the conntrack - reopen the old session as it is a new one. This is an optimization - option selectable by the system administrator. - - If not set, when a new TCP syn packet hits an old ipvs connection - table and need reschedule to a new dest: if - 1) the packet uses conntrack - ipvs just drops this syn packet, expires the old connection by timer. - This will cause the client to retransmit TCP SYN. - - Only has effect when conn_reuse_mode not 0. - conntrack - BOOLEAN 0 - disabled (default) not 0 - enabled diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 3431331..dab43a6 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -924,7 +924,6 @@ struct netns_ipvs { int sysctl_pmtu_disc; int sysctl_backup_only; int sysctl_conn_reuse_mode; - int sysctl_conn_reuse_old_conntrack; int sysctl_schedule_icmp; int sysctl_ignore_tunneled; @@ -1049,11 +1048,6 @@ static inline int sysctl_conn_reuse_mode(struct netns_ipvs *ipvs) return ipvs->sysctl_conn_reuse_mode; } -static inline int sysctl_conn_reuse_old_conntrack(struct netns_ipvs *ipvs) -{ - return ipvs->sysctl_conn_reuse_old_conntrack; -} - static inline int sysctl_schedule_icmp(struct netns_ipvs *ipvs) { return ipvs->sysctl_schedule_icmp; @@ -1141,11 +1135,6 @@ static inline int sysctl_conn_reuse_mode(struct netns_ipvs *ipvs) return 1; } -static inline int sysctl_conn_reuse_old_conntrack(struct netns_ipvs *ipvs) -{ - return 0; -} - static inline int sysctl_schedule_icmp(struct netns_ipvs *ipvs) { return 0; diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 80cfd71..a71f777 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c @@ -1928,7 +1928,7 @@ static int ip_vs_in_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb, conn_reuse_mode = sysctl_conn_reuse_mode(ipvs); if (conn_reuse_mode && !iph.fragoffs && is_new_conn(skb, &iph) && cp) { - bool uses_ct = false, resched = false, drop = false; + bool uses_ct = false, resched = false; if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest && unlikely(!atomic_read(&cp->dest->weight))) { @@ -1948,17 +1948,10 @@ static int ip_vs_in_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb, } if (resched) { - if (uses_ct) { - if (likely(!atomic_read(&cp->n_control) && !cp->control) && - likely(sysctl_conn_reuse_old_conntrack(ipvs))) - cp->flags &= ~IP_VS_CONN_F_NFCT; - else - drop = true; - } if (!atomic_read(&cp->n_control)) ip_vs_conn_expire_now(cp); __ip_vs_conn_put(cp); - if (drop) + if (uses_ct) return NF_DROP; cp = NULL; } diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 4f37dbe..c339b5e 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -1892,12 +1892,6 @@ static int ip_vs_zero_all(struct netns_ipvs *ipvs) .proc_handler = proc_dointvec, }, { - .procname = "conn_reuse_old_conntrack", - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec, - }, - { .procname = "schedule_icmp", .maxlen = sizeof(int), .mode = 0644, @@ -3957,9 +3951,7 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) tbl[idx++].data = &ipvs->sysctl_pmtu_disc; tbl[idx++].data = &ipvs->sysctl_backup_only; ipvs->sysctl_conn_reuse_mode = 1; - ipvs->sysctl_conn_reuse_old_conntrack = 0; tbl[idx++].data = &ipvs->sysctl_conn_reuse_mode; - tbl[idx++].data = &ipvs->sysctl_conn_reuse_old_conntrack; tbl[idx++].data = &ipvs->sysctl_schedule_icmp; tbl[idx++].data = &ipvs->sysctl_ignore_tunneled; -- 1.8.3.1