diff options
author | andre <andre@FreeBSD.org> | 2006-09-15 16:08:09 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2006-09-15 16:08:09 +0000 |
commit | e168227ed2fb2c85707431a1167890c349968718 (patch) | |
tree | 41ed3bfc9e6442904a2985518857f2126815d962 /sys/netinet/tcp_output.c | |
parent | 8daf5708793187a7f3158d1a5582ae00dec135ff (diff) | |
download | FreeBSD-src-e168227ed2fb2c85707431a1167890c349968718.zip FreeBSD-src-e168227ed2fb2c85707431a1167890c349968718.tar.gz |
When doing TSO subtract hdrlen from TCP_MAXWIN to prevent ip->ip_len
from wrapping when we generate a maximally sized packet for later
segmentation.
Noticed by: gallatin
Sponsored by: TCP/IP Optimization Fundraise 2005
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r-- | sys/netinet/tcp_output.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 986f956..dc67a5d 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -730,16 +730,18 @@ send: * Clear the FIN bit because we cut off the tail of * the segment. * - * When doing TSO limit a burst to TCP_MAXWIN and set the - * flag to continue sending and prevent the last segment - * from being fractional thus making them all equal sized. + * When doing TSO limit a burst to TCP_MAXWIN minus the + * IP, TCP and Options length to keep ip->ip_len from + * overflowing. Prevent the last segment from being + * fractional thus making them all equal sized and set + * the flag to continue sending. */ if (len + optlen + ipoptlen > tp->t_maxopd) { flags &= ~TH_FIN; if (tso) { if (len > TCP_MAXWIN) { - len = TCP_MAXWIN - TCP_MAXWIN % - (tp->t_maxopd - optlen); + len = TCP_MAXWIN - hdrlen; + len = len - (len % (tp->t_maxopd - optlen)); sendalot = 1; } else if (tp->t_flags & TF_NEEDFIN) sendalot = 1; |