Subject: kern/3852: tcp_timer.c intermixes the two different uses of the TCPT_2MSL counter
To: None <gnats-bugs@gnats.netbsd.org>
From: None <frueauf@ira.uka.de>
List: netbsd-bugs
Date: 07/11/1997 22:25:11
>Number:         3852
>Category:       kern
>Synopsis:       tcp_timer.c intermixes the two different uses of the TCPT_2MSL counter
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 11 19:20:04 1997
>Last-Modified:
>Originator:     Thorsten Frueauf
>Organization:
private
	
>Release:        <NetBSD-current source date> NetBSD current 11.07.1997
>Environment:
	
System: NetBSD cyberlap 1.2G NetBSD 1.2G (CYBERLAP) #3: Fri Jul 11 19:16:55 CEST 1997 frueauf@cyberlap:/usr/src/sys/arch/i386/compile/CYBERLAP i386


>Description:
	
Stevens descripes in "TCP/IP Illustrated Vol.2" on page 825, 849 (Exercise 25.4)
and 1085 (solution) that tcp_timer.c intermixes the two different uses of the
TCPT_2MSL counter.

>How-To-Repeat:
	
Read the above cited bookmark :-)

>Fix:
	
Apply the following patch to /src/sys/netinet/tcp_timer.c:

*** tcp_timer.c-orig	Fri Jul 11 21:57:39 1997
--- tcp_timer.c	Fri Jul 11 22:01:24 1997
***************
*** 181,191 ****
  	 * control block.  Otherwise, check again in a bit.
  	 */
  	case TCPT_2MSL:
! 		if (tp->t_state != TCPS_TIME_WAIT &&
! 		    tp->t_idle <= tcp_maxidle)
  			tp->t_timer[TCPT_2MSL] = tcp_keepintvl;
! 		else
  			tp = tcp_close(tp);
  		break;
  
  	/*
--- 181,194 ----
  	 * control block.  Otherwise, check again in a bit.
  	 */
  	case TCPT_2MSL:
! 		if (tp->t_state == TCPS_TIME_WAIT)
! 		    tp = tcp_close(tp);
! 		else {
! 		    if (tp->t_idle <= tcp_maxidle)
  			tp->t_timer[TCPT_2MSL] = tcp_keepintvl;
! 		    else
  			tp = tcp_close(tp);
+ 		}
  		break;
  
  	/*
>Audit-Trail:
>Unformatted:
tcp_timer.c intermixes the two different uses of the TCPT_2MSL counter