From patchwork Fri Sep 25 09:37:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Bohac X-Patchwork-Id: 522702 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CC4EC1402A2 for ; Fri, 25 Sep 2015 19:37:46 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755402AbbIYJhn (ORCPT ); Fri, 25 Sep 2015 05:37:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:48070 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753418AbbIYJhn (ORCPT ); Fri, 25 Sep 2015 05:37:43 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 877AFABD9; Fri, 25 Sep 2015 09:37:39 +0000 (UTC) Date: Fri, 25 Sep 2015 11:37:38 +0200 From: Jiri Bohac To: Wensong Zhang , Simon Horman , Julian Anastasov Cc: netdev@vger.kernel.org, lvs-devel@vger.kernel.org Subject: [PATCH] ipvs: drop first packet to dead server Message-ID: <20150925093737.GA5047@midget.suse.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since commit dc7b3eb9 (ipvs: Fix reuse connection if real server is dead), new connections to dead servers are redistributed immediately to new servers. The old connection is expired using ip_vs_conn_expire_now() which sets the connection timer to expire immediately. However, before the timer callback, ip_vs_conn_expire(), is run to clean the connection's conntrack entry, the new redistributed connection may already be established and its conntrack removed instead. Fix this by dropping the first packet of the new connection instead, like we do when the destination server is not available. The timer will have deleted the old conntrack entry long before the first packet of the new connection is retransmitted. Signed-off-by: Jiri Bohac diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index d1d6b82..3f884b8 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c @@ -1657,7 +1657,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af) is_new_conn(skb, &iph)) { ip_vs_conn_expire_now(cp); __ip_vs_conn_put(cp); - cp = NULL; + return NF_DROP; } if (unlikely(!cp) && !iph.fragoffs) {