ip_vs_conn_out_get() does not filter templates. A template with cport 0 and DR or TUN forwarding bits is matched by a packet sent to client port 0 that traverses the out hook, and handle_response() then runs ip_vs_set_state() and the timeout update on a connection that must never see packets. A backup server receives such templates over the unauthenticated sync protocol. Connections that still wait for their cport with IP_VS_CONN_F_NO_CPORT can be matched the same way. Require a nonzero cp->cport for a match. Templates keep cport 0 throughout their lifetime. FTP data connections learn their client port from incoming traffic before replies are processed. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Suggested-by: Julian Anastasov Signed-off-by: Axel Mierczuk --- net/netfilter/ipvs/ip_vs_conn.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 6fa3e1dc534c..24dbe34a4827 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c @@ -579,7 +579,8 @@ struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p) ip_vs_addr_equal(p->af, p->vaddr, &cp->caddr) && ip_vs_addr_equal(p->af, p->caddr, saddr) && - p->protocol == cp->protocol) { + p->protocol == cp->protocol && + cp->cport) { if (__ip_vs_conn_get(cp)) goto out; } -- 2.43.0