summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2007-06-09 21:19:12 +0000
committerandre <andre@FreeBSD.org>2007-06-09 21:19:12 +0000
commitccc729300fe603bc8347b9f689f8ff5c8a5ac15d (patch)
treeb5d73f6b8dae7dfab41b56fb135c025c877fc34e /sys/netinet/tcp_output.c
parent5a4573d5f0ebf178390d09d56f57c73e35cf97bb (diff)
downloadFreeBSD-src-ccc729300fe603bc8347b9f689f8ff5c8a5ac15d.zip
FreeBSD-src-ccc729300fe603bc8347b9f689f8ff5c8a5ac15d.tar.gz
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.
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 d8adff3..da30813 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
OpenPOWER on IntegriCloud