mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
Make the handling of the tcp window explicit for the SYN_SENT case
in tcp_outout(). This is currently not strictly necessary but paves the way to simplify the entire SYN options handling quite a bit. Clarify comment. No change in effective behavour with this commit. RFC1323 requires the window field in a SYN (i.e., a <SYN> or <SYN,ACK>) segment itself never be scaled.
This commit is contained in:
parent
5396d0f8d8
commit
104ebb2a45
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170470
@ -906,9 +906,6 @@ tcp_output(struct tcpcb *tp)
|
||||
/*
|
||||
* Calculate receive window. Don't shrink window,
|
||||
* but avoid silly window syndrome.
|
||||
*
|
||||
* XXX: RFC1323: The Window field in a SYN (i.e., a <SYN> or
|
||||
* <SYN,ACK>) segment itself is never scaled.
|
||||
*/
|
||||
if (recwin < (long)(so->so_rcv.sb_hiwat / 4) &&
|
||||
recwin < (long)tp->t_maxseg)
|
||||
@ -917,8 +914,17 @@ tcp_output(struct tcpcb *tp)
|
||||
recwin = (long)(tp->rcv_adv - tp->rcv_nxt);
|
||||
if (recwin > (long)TCP_MAXWIN << tp->rcv_scale)
|
||||
recwin = (long)TCP_MAXWIN << tp->rcv_scale;
|
||||
th->th_win = htons((u_short) (recwin >> tp->rcv_scale));
|
||||
|
||||
/*
|
||||
* According to RFC1323 the window field in a SYN (i.e., a <SYN>
|
||||
* or <SYN,ACK>) segment itself is never scaled. The <SYN,ACK>
|
||||
* case is handled in syncache.
|
||||
*/
|
||||
if (flags & TH_SYN)
|
||||
th->th_win = htons((u_short)
|
||||
(min(sbspace(&so->so_rcv), TCP_MAXWIN)));
|
||||
else
|
||||
th->th_win = htons((u_short)(recwin >> tp->rcv_scale));
|
||||
|
||||
/*
|
||||
* Adjust the RXWIN0SENT flag - indicate that we have advertised
|
||||
|
Loading…
Reference in New Issue
Block a user