Subject: kern/13952: TCP window info update check seems to be incorrect.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <demizu@dd.iij4u.or.jp>
List: netbsd-bugs
Date: 09/15/2001 19:13:37
>Number:         13952
>Category:       kern
>Synopsis:       TCP window information update check seems to be incorrect.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 15 03:10:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Noritoshi Demizu
>Release:        NetBSD 1.5.2
>Organization:
>Environment:
System: NetBSD viola.watersprings.org 1.5.2 NetBSD 1.5.2 (VIOLA) #1: Sat Sep 15 18:18:38 JST 2001 noritosi@viola.watersprings.org:/home/NetBSD/src/sys-152/arch/i386/compile/VIOLA i386

>Description:
	Current if-test to check if TCP window information should be updated
	seems to be incorrect.  This is introduced at revision 1.23 of
	tcp_input.c.  OpenBSD 2.7 has the same if-test.

>How-To-Repeat:
>Fix:
	I belive following patch makes the meanings of the if-test
	the same with revision 1.22 or before of tcp_input.c.
	FreeBSD has the same if-test with this patch, except indentations.

--- tcp_input.c-ORG	Thu May 10 04:37:19 2001
+++ tcp_input.c	Sat Sep 15 18:18:05 2001
@@ -1919,14 +1919,14 @@
 step6:
 	/*
 	 * Update window information.
 	 * Don't look at window if no ACK: TAC's send garbage on first SYN.
 	 */
 	if ((tiflags & TH_ACK) && (SEQ_LT(tp->snd_wl1, th->th_seq) ||
-	    (tp->snd_wl1 == th->th_seq && SEQ_LT(tp->snd_wl2, th->th_ack)) ||
-	    (tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd))) {
+	    (tp->snd_wl1 == th->th_seq && (SEQ_LT(tp->snd_wl2, th->th_ack) ||
+	    (tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd))))) {
 		/* keep track of pure window updates */
 		if (tlen == 0 &&
 		    tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd)
 			tcpstat.tcps_rcvwinupd++;
 		tp->snd_wnd = tiwin;
 		tp->snd_wl1 = th->th_seq;
>Release-Note:
>Audit-Trail:
>Unformatted: