Prevent premature shrinking of the scaled receive window
which can cause a TCP client to use invalid or stale TCP sequence numbers for ACK packets. Packets with old sequence numbers are ignored and not used to update the send window size. This might cause the TCP session to hang indefinitely under some circumstances. Reported by: Cui Cheng Reviewed by: tuexen (mentor), rgrimes (mentor) Approved by: tuexen (mentor), rgrimes (mentor) MFC after: 3 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D24515
This commit is contained in:
parent
57588206fe
commit
9ff3e71cd0
@ -1238,8 +1238,11 @@ tcp_output(struct tcpcb *tp)
|
||||
if (flags & TH_SYN)
|
||||
th->th_win = htons((u_short)
|
||||
(min(sbspace(&so->so_rcv), TCP_MAXWIN)));
|
||||
else
|
||||
else {
|
||||
/* Avoid shrinking window with window scaling. */
|
||||
recwin = roundup2(recwin, 1 << tp->rcv_scale);
|
||||
th->th_win = htons((u_short)(recwin >> tp->rcv_scale));
|
||||
}
|
||||
|
||||
/*
|
||||
* Adjust the RXWIN0SENT flag - indicate that we have advertised
|
||||
|
@ -13756,8 +13756,11 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeval *tv)
|
||||
if (flags & TH_SYN)
|
||||
th->th_win = htons((u_short)
|
||||
(min(sbspace(&so->so_rcv), TCP_MAXWIN)));
|
||||
else
|
||||
else {
|
||||
/* Avoid shrinking window with window scaling. */
|
||||
recwin = roundup2(recwin, 1 << tp->rcv_scale);
|
||||
th->th_win = htons((u_short)(recwin >> tp->rcv_scale));
|
||||
}
|
||||
/*
|
||||
* Adjust the RXWIN0SENT flag - indicate that we have advertised a 0
|
||||
* window. This may cause the remote transmitter to stall. This
|
||||
|
@ -9572,8 +9572,11 @@ rack_output(struct tcpcb *tp)
|
||||
if (flags & TH_SYN)
|
||||
th->th_win = htons((u_short)
|
||||
(min(sbspace(&so->so_rcv), TCP_MAXWIN)));
|
||||
else
|
||||
else {
|
||||
/* Avoid shrinking window with window scaling. */
|
||||
recwin = roundup2(recwin, 1 << tp->rcv_scale);
|
||||
th->th_win = htons((u_short)(recwin >> tp->rcv_scale));
|
||||
}
|
||||
/*
|
||||
* Adjust the RXWIN0SENT flag - indicate that we have advertised a 0
|
||||
* window. This may cause the remote transmitter to stall. This
|
||||
|
Loading…
Reference in New Issue
Block a user