summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
authorAndre Oppermann <andre@FreeBSD.org>2007-06-09 21:19:12 +0000
committerAndre Oppermann <andre@FreeBSD.org>2007-06-09 21:19:12 +0000
commit104ebb2a4538e21ddc4ef9f246df360a05ac4cfc (patch)
treeb5d73f6b8dae7dfab41b56fb135c025c877fc34e /sys/netinet/tcp_output.c
parent5396d0f8d85b9f770159304cbd6bff22e092a4b3 (diff)
Notes
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r--sys/netinet/tcp_output.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index d8adff357b93..da3081379129 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -906,9 +906,6 @@ send:
/*
* 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 @@ send:
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