Re: TCP bug in 2.0.30 - increasing the sequence number after FIN

Eric.Schenk@dna.lth.se
Mon, 05 May 1997 22:13:11 +0200


Thomas Koenig <ig25@mvmap66.ciw.uni-karlsruhe.de> writes:
>I think that ssh sometimes triggers a bug in the Linux TCP stack in
>version 2.0.30.
>
>I connect from a Linux box, using ssh 1.2.20, to a AIX 4.1.4 or HP-UX
>9.0.5 box, running the same version of the ssh daemon.

I think the following patch should fix this problem. Can anyone who
has seen this please try the patch and report back to me.
(BTW, the same bug is present in the 2.1.36 kernel. I'll drop
the fix in there as well once I get back a positive report.)

Thanks.

diff -r -u vanilla/linux/net/ipv4/tcp.c linux/net/ipv4/tcp.c
--- vanilla/linux/net/ipv4/tcp.c Wed Apr 9 20:31:10 1997
+++ linux/net/ipv4/tcp.c Mon May 5 21:57:17 1997
@@ -1838,7 +1844,10 @@
case TCP_CLOSE:
case TCP_LISTEN:
break;
- case TCP_LAST_ACK: /* Could have shutdown() then close()!*/
+ case TCP_LAST_ACK: /* Could have shutdown() then close().
+ Be careful not to send double fin. */
+ ns=TCP_LAST_ACK;
+ break;
case TCP_CLOSE_WAIT: /* They have FIN'd us. We send our FIN and
wait only for the ACK */
ns=TCP_LAST_ACK;

-- 
Eric Schenk                               www: http://www.dna.lth.se/~erics
Dept. of Comp. Sci., Lund University          email: Eric.Schenk@dna.lth.se
Box 118, S-221 00 LUND, Sweden   fax: +46-46 13 10 21  ph: +46-46 222 96 38