From owner-freebsd-net@FreeBSD.ORG Wed Apr 3 15:30:01 2013 Return-Path: Delivered-To: freebsd-net@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6C031C3F for ; Wed, 3 Apr 2013 15:30:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 5E06E9B3 for ; Wed, 3 Apr 2013 15:30:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r33FU1xp097999 for ; Wed, 3 Apr 2013 15:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r33FU1AY097998; Wed, 3 Apr 2013 15:30:01 GMT (envelope-from gnats) Date: Wed, 3 Apr 2013 15:30:01 GMT Message-Id: <201304031530.r33FU1AY097998@freefall.freebsd.org> To: freebsd-net@FreeBSD.org Cc: From: Gleb Smirnoff Subject: Re: misc/177456: An error of calculating TCP sequence number will resault in the machine to restart X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Gleb Smirnoff List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Apr 2013 15:30:01 -0000 The following reply was made to PR kern/177456; it has been noted by GNATS. From: Gleb Smirnoff To: ?????? Cc: bug-followup@FreeBSD.org Subject: Re: misc/177456: An error of calculating TCP sequence number will resault in the machine to restart Date: Wed, 3 Apr 2013 19:21:12 +0400 Hi! On Wed, Apr 03, 2013 at 07:52:42AM +0800, ?????? wrote: ?> I mean there is a bug in FreeBSD's tcp code. I'm trying to describe it by pictuer. Pelease see the attachments?? I am trying to model what you are describing in the picture by special crafted code. I intentionally model memory allocation failure on first two packets for a connection that has special socket option. I'm modelling allocation failure at tcp_output.c near line 900: Index: tcp_output.c =================================================================== --- tcp_output.c (revision 249051) +++ tcp_output.c (working copy) @@ -898,6 +898,13 @@ send: else TCPSTAT_INC(tcps_sndwinup); + /* Fail allocating first 2 packets. */ + if (tp->t_flags & TF_ZHOPA && tp->t_zhopa < 2) { + tp->t_zhopa++; + m = NULL; + error = ENOBUFS; + goto out; + } else m = m_gethdr(M_NOWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; I have no success in reproducing your problems. With above code, first 2 packets are failing to allocate, but third retransmission succeeds and connection is established with no problems. May be I incorrectly understand your description :( Please don't give up and try to explain again. A modelling code that demonstrates problem would be appreciated. -- Totus tuus, Glebius.