Ensure that TCP RST-segments announce consistently a receiver window of
zero. This was already done when sending them via tcp_respond(). Reviewed by: rrs@ MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D17949
This commit is contained in:
parent
fbbdea9acc
commit
3ece71ca83
@ -1172,14 +1172,18 @@ tcp_output(struct tcpcb *tp)
|
||||
/*
|
||||
* Calculate receive window. Don't shrink window,
|
||||
* but avoid silly window syndrome.
|
||||
* If a RST segment is sent, advertise a window of zero.
|
||||
*/
|
||||
if (recwin < (so->so_rcv.sb_hiwat / 4) &&
|
||||
recwin < tp->t_maxseg)
|
||||
if (flags & TH_RST) {
|
||||
recwin = 0;
|
||||
if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) &&
|
||||
recwin < (tp->rcv_adv - tp->rcv_nxt))
|
||||
recwin = (tp->rcv_adv - tp->rcv_nxt);
|
||||
|
||||
} else {
|
||||
if (recwin < (so->so_rcv.sb_hiwat / 4) &&
|
||||
recwin < tp->t_maxseg)
|
||||
recwin = 0;
|
||||
if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) &&
|
||||
recwin < (tp->rcv_adv - tp->rcv_nxt))
|
||||
recwin = (tp->rcv_adv - tp->rcv_nxt);
|
||||
}
|
||||
/*
|
||||
* According to RFC1323 the window field in a SYN (i.e., a <SYN>
|
||||
* or <SYN,ACK>) segment itself is never scaled. The <SYN,ACK>
|
||||
|
@ -8189,15 +8189,20 @@ rack_output(struct tcpcb *tp)
|
||||
/*
|
||||
* Calculate receive window. Don't shrink window, but avoid silly
|
||||
* window syndrome.
|
||||
* If a RST segment is sent, advertise a window of zero.
|
||||
*/
|
||||
if (recwin < (long)(so->so_rcv.sb_hiwat / 4) &&
|
||||
recwin < (long)tp->t_maxseg)
|
||||
if (flags & TH_RST) {
|
||||
recwin = 0;
|
||||
if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) &&
|
||||
recwin < (long)(tp->rcv_adv - tp->rcv_nxt))
|
||||
recwin = (long)(tp->rcv_adv - tp->rcv_nxt);
|
||||
if (recwin > (long)TCP_MAXWIN << tp->rcv_scale)
|
||||
recwin = (long)TCP_MAXWIN << tp->rcv_scale;
|
||||
} else {
|
||||
if (recwin < (long)(so->so_rcv.sb_hiwat / 4) &&
|
||||
recwin < (long)tp->t_maxseg)
|
||||
recwin = 0;
|
||||
if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) &&
|
||||
recwin < (long)(tp->rcv_adv - tp->rcv_nxt))
|
||||
recwin = (long)(tp->rcv_adv - tp->rcv_nxt);
|
||||
if (recwin > (long)TCP_MAXWIN << tp->rcv_scale)
|
||||
recwin = (long)TCP_MAXWIN << tp->rcv_scale;
|
||||
}
|
||||
|
||||
/*
|
||||
* According to RFC1323 the window field in a SYN (i.e., a <SYN> or
|
||||
|
Loading…
Reference in New Issue
Block a user