mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-01 21:33:04 +00:00
Don't allow the window to be increased beyond what is possible to
represent in the TCP header. The old code did effectively: win = min(win, MAX_ALLOWED); win = max(win, what_i_think_i_advertised_last_time); so if what_i_think_i_advertised_last_time is bigger than can be represented in the header (e.g. large buffers and no window scaling) then we stuff a too-big number into a short. This fix reverses the order of the comparisons. PR: kern/4712
This commit is contained in:
parent
186741ecdb
commit
610a2e9ca5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=30209
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)tcp_output.c 8.4 (Berkeley) 5/24/95
|
||||
* $Id: tcp_output.c,v 1.25 1997/08/02 14:32:56 bde Exp $
|
||||
* $Id: tcp_output.c,v 1.26 1997/09/16 18:36:05 joerg Exp $
|
||||
*/
|
||||
|
||||
#include "opt_tcpdebug.h"
|
||||
@ -569,10 +569,10 @@ send:
|
||||
*/
|
||||
if (win < (long)(so->so_rcv.sb_hiwat / 4) && win < (long)tp->t_maxseg)
|
||||
win = 0;
|
||||
if (win > (long)TCP_MAXWIN << tp->rcv_scale)
|
||||
win = (long)TCP_MAXWIN << tp->rcv_scale;
|
||||
if (win < (long)(tp->rcv_adv - tp->rcv_nxt))
|
||||
win = (long)(tp->rcv_adv - tp->rcv_nxt);
|
||||
if (win > (long)TCP_MAXWIN << tp->rcv_scale)
|
||||
win = (long)TCP_MAXWIN << tp->rcv_scale;
|
||||
ti->ti_win = htons((u_short) (win>>tp->rcv_scale));
|
||||
if (SEQ_GT(tp->snd_up, tp->snd_nxt)) {
|
||||
ti->ti_urp = htons((u_short)(tp->snd_up - tp->snd_nxt));
|
||||
|
Loading…
Reference in New Issue
Block a user