🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd.ucb-fixes
Article #22

ARTICLE 5

#22
From: bostic
Date: Fri, 20 Mar 1987 18:49
42 lines
1973 bytes
4.3BSD network bug (#1, tcp_output)
Index:	sys/netinet/tcp_output.c 4.3BSD FIX

Description:
The final change in the send code in TCP in 4.3 was made incorrectly.
In tcp_output (/sys/netinet/tcp_output.c), the output packet flags
are chosen before the packet length is adjusted to reflect the maximum
segment size.  Under some cirsumstances, this results in sending a FIN
with a packet which is not the last data packet.  This is most often
noticed when the connection implements a one-way transfer of data
and the sender closes while the data is still draining; the result is
unnoticed loss of data.

Fix:
Move the lines in tcp_output that look up the flags to be sent
to a location after the final length adjustment, as follows:

*** /nbsd/sys/netinet/tcp_output.c	Thu Jun  5 00:31:36 1986
--- tcp_output.c	Wed Aug 20 09:31:34 1986
***************
*** 5,7 ****
   *
!  *	@(#)tcp_output.c	7.1 (Berkeley) 6/5/86
   */
--- 5,7 ----
   *
!  *	@(#)tcp_output.c	7.2 (Berkeley) 8/20/86
   */
***************
*** 82,85 ****
  	flags = tcp_outflags[tp->t_state];
- 	if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + so->so_snd.sb_cc))
- 		flags &= ~TH_FIN;
  
--- 82,83 ----
***************
*** 118,119 ****
--- 116,119 ----
  	}
+ 	if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + so->so_snd.sb_cc))
+ 		flags &= ~TH_FIN;
  	win = sbspace(&so->so_rcv);
Technical Details
Message-ID: <8703201849.AA20723@okeeffe.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ucbvax!OKEEFFE.BERKELEY.EDU!bostic

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ucbvax!OKEEFFE.BERKELEY.EDU!bostic
From: bostic@OKEEFFE.BERKELEY.EDU.UUCP
Newsgroups: comp.bugs.4bsd.ucb-fixes
Subject: ARTICLE 5
Message-ID: <8703201849.AA20723@okeeffe.Berkeley.EDU>
Date: Fri, 20-Mar-87 13:49:44 EST
Article-I.D.: okeeffe.8703201849.AA20723
Posted: Fri Mar 20 13:49:44 1987
Date-Received: Sun, 22-Mar-87 21:31:01 EST
Sender: daemon@ucbvax.BERKELEY.EDU
Distribution: world
Organization: The ARPA Internet
Lines: 42
Approved: ucb-fixes@okeeffe.berkeley.edu