From patchwork Mon Apr 2 03:25:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changli Gao X-Patchwork-Id: 150057 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 B2FC7B6EE7 for ; Mon, 2 Apr 2012 13:28:20 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754374Ab2DBD1p (ORCPT ); Sun, 1 Apr 2012 23:27:45 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:33328 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754034Ab2DBD1o (ORCPT ); Sun, 1 Apr 2012 23:27:44 -0400 Received: by iagz16 with SMTP id z16so3555481iag.19 for ; Sun, 01 Apr 2012 20:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=bIRjeNX5CbVV5sPPgN8VdM+Ko7pU127jqRWe9yni3so=; b=0kjzAGTnAXauqhFsFGb0H2MuHr/evxsrdSziTu0pLjcToZX86PeWuc9AJ6/+/8A1KR 83Omaae0qM1oXLv/rgrTIF/4TOVHw5R8UJ78I8yLW+i/U3UI/QahGy8Il9eqYfaztn3g w5HwdZOzhiviq9u6jsHleCZDBpNsOTEPyaGJc59pHScV+JgbmzY/LfGm+1sj0Hik2ZNN 5sBHXO3tPB+g2NHKXgMEuVUD8sBtTCpU1QcaVuuhsglIev2UYMNeT/k13c8yoUKxfVw2 a2pKP1MBFG6Hxoo4QRstg6ZTRhF82buOdqCHa+cMabEKITroXKii4U4PxHSD9UL15chF it7A== Received: by 10.50.41.161 with SMTP id g1mr4271493igl.5.1333337264100; Sun, 01 Apr 2012 20:27:44 -0700 (PDT) Received: from localhost.localdomain ([221.238.69.42]) by mx.google.com with ESMTPS id df1sm7717176igb.12.2012.04.01.20.27.37 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 01 Apr 2012 20:27:43 -0700 (PDT) From: Changli Gao To: Pablo Neira Ayuso Cc: Patrick McHardy , "David S. Miller" , netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, Changli Gao Subject: [PATCH] netfilter: don't scale the size of the window up twice Date: Mon, 2 Apr 2012 11:25:06 +0800 Message-Id: <1333337106-8279-1-git-send-email-xiaosuo@gmail.com> X-Mailer: git-send-email 1.7.4.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For a picked up connection, the window win is scaled twice: one is by the initialization code, and the other is by the sender updating code. I use the temporary variable swin instead of modifying the variable win. Signed-off-by: Changli Gao Acked-by: Jozsef Kadlecsik --- net/netfilter/nf_conntrack_proto_tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 361eade..0d07a1d 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c @@ -584,8 +584,8 @@ static bool tcp_in_window(const struct nf_conn *ct, * Let's try to use the data from the packet. */ sender->td_end = end; - win <<= sender->td_scale; - sender->td_maxwin = (win == 0 ? 1 : win); + swin = win << sender->td_scale; + sender->td_maxwin = (swin == 0 ? 1 : swin); sender->td_maxend = end + sender->td_maxwin; /* * We haven't seen traffic in the other direction yet