Fix an old and obscure TCP bug, brought to my attention by Bill Fenner,
fixed in FreeBSD by John Polstra: Fix a bug (apparently very old) that can cause a TCP connection to be dropped when it has an unusual traffic pattern. For full details as well as a test case that demonstrates the failure, see the referenced PR (FreeBSD's kern/3998). Under certain circumstances involving the persist state, it is possible for the receive side's tp->rcv_nxt to advance beyond its tp->rcv_adv. This causes (tp->rcv_adv - tp->rcv_nxt) to become negative. However, in the code affected by this fix, that difference was interpreted as an unsigned number by max(). Since it was negative, it was taken as a huge unsigned number. The effect was to cause the receiver to believe that its receive window had negative size, thereby rejecting all received segments including ACKs. As the test case shows, this led to fruitless retransmissions and eventually to a dropped connection. Even connections using the loopback interface could be dropped. The fix substitutes the signed imax() for the unsigned max() function. Bill informs me that his research indicates this bug appeared in Reno.
This commit is contained in:
parent
b19b36aff5
commit
e0acb98b94
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tcp_input.c,v 1.27 1996/12/10 18:20:19 mycroft Exp $ */
|
||||
/* $NetBSD: tcp_input.c,v 1.28 1997/07/06 07:04:34 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994
|
||||
|
@ -550,7 +550,7 @@ findpcb:
|
|||
win = sbspace(&so->so_rcv);
|
||||
if (win < 0)
|
||||
win = 0;
|
||||
tp->rcv_wnd = max(win, (int)(tp->rcv_adv - tp->rcv_nxt));
|
||||
tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt));
|
||||
}
|
||||
|
||||
switch (tp->t_state) {
|
||||
|
|
Loading…
Reference in New Issue