From owner-freebsd-net@FreeBSD.ORG Sat Apr 2 11:58:26 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B2B71065670; Sat, 2 Apr 2011 11:58:26 +0000 (UTC) (envelope-from sec@42.org) Received: from ice.42.org (v6.42.org [IPv6:2001:608:9::1]) by mx1.freebsd.org (Postfix) with ESMTP id 020438FC0C; Sat, 2 Apr 2011 11:58:26 +0000 (UTC) Received: by ice.42.org (Postfix, from userid 1000) id A44F12841F; Sat, 2 Apr 2011 13:58:23 +0200 (CEST) Date: Sat, 2 Apr 2011 13:58:23 +0200 From: Stefan `Sec` Zehl To: John Baldwin , freebsd-net@freebsd.org Message-ID: <20110402115823.GE37730@ice.42.org> Mail-Followup-To: John Baldwin , freebsd-net@freebsd.org References: <4D8B99B4.4070404@FreeBSD.org> <201103281423.52202.jhb@freebsd.org> <20110328183810.GF23803@ice.42.org> <201103300838.09608.jhb@freebsd.org> <20110331234017.GC3308@ice.42.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110331234017.GC3308@ice.42.org> User-Agent: Mutt/1.4.2.3i I-love-doing-this: really X-Modeline: vim:set ts=8 sw=4 smarttab tw=72 si noic notitle: Accept-Languages: de, en X-URL: http://sec.42.org/ Cc: Subject: Re: The tale of a TCP bug X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Apr 2011 11:58:26 -0000 Hi I'm back :) On Fri, Apr 01, 2011 at 01:40 +0200, Stefan `Sec` Zehl wrote: > I'll of course monitor this value and report back if I ever see it > increase :-) It did: | ice:~>uptime | 1:45PM up 2 days, 17:01, 0 users, load averages: 1.29, 0.98, 0.60 | ice:~>sysctl net.inet.tcp.adv_neg | net.inet.tcp.adv_neg: 120 | ice:~> I currently have no idea why. But I think it would be a good idea to fix that adv calculation on 64bit for the negative case anyway. As my original attempt with a (long) cast was frowned upon, maybe something like what OpenBSD did in r1.15 / 1998? http://www.openbsd.org/cgi-bin/cvsweb/src/sys/netinet/tcp_output.c.diff?r1=1.14;r2=1.15 --- tcp_output.c.pre 2011-04-02 13:50:32.000000000 +0200 +++ tcp_output.c 2011-04-02 13:50:35.000000000 +0200 @@ -575,7 +575,7 @@ * taking into account that we are limited by * TCP_MAXWIN << tp->rcv_scale. */ - long adv = min(recwin, (long)TCP_MAXWIN << tp->rcv_scale) - + long adv = lmin(recwin, (long)TCP_MAXWIN << tp->rcv_scale) - (tp->rcv_adv - tp->rcv_nxt); if(min(recwin, (long)TCP_MAXWIN << tp->rcv_scale) < If anyone has an idea what could trigger these cases, I'd be happy to help debug. But without a clear testcase, it's a bit difficult. CU, Sec -- "few languages are as bad as PHP for doing serious development work" -- Experiences of Using PHP in Large Websites