From 9ebe787f7c290b43a8662c720b8420b27e27d3a9 Mon Sep 17 00:00:00 2001 From: Dan McDonald Date: Fri, 2 Sep 2011 16:41:08 -0700 Subject: 1434 TCP_INIT_CWND setsockopt doesn't work on passive connections. Reviewed by: Jason King Reviewed by: Dan Kruchinin Approved by: Eric Schrock --- usr/src/uts/common/inet/tcp/tcp_opt_data.c | 32 ++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'usr/src') diff --git a/usr/src/uts/common/inet/tcp/tcp_opt_data.c b/usr/src/uts/common/inet/tcp/tcp_opt_data.c index bcec93fcd3..7ac8feeecb 100644 --- a/usr/src/uts/common/inet/tcp/tcp_opt_data.c +++ b/usr/src/uts/common/inet/tcp/tcp_opt_data.c @@ -694,19 +694,29 @@ tcp_opt_set(conn_t *connp, uint_t optset_context, int level, int name, * privilege to set the initial cwnd to be larger * than allowed by RFC 3390. */ - if (val <= MIN(4, MAX(2, 4380 / tcp->tcp_mss))) { - tcp->tcp_init_cwnd = val; - break; - } - if ((reterr = secpolicy_ip_config(cr, B_TRUE)) != 0) { - *outlenp = 0; - return (reterr); - } - if (val > tcp_max_init_cwnd) { - *outlenp = 0; - return (EINVAL); + if (val > MIN(4, MAX(2, 4380 / tcp->tcp_mss))) { + if ((reterr = secpolicy_ip_config(cr, B_TRUE)) + != 0) { + *outlenp = 0; + return (reterr); + } + if (val > tcp_max_init_cwnd) { + *outlenp = 0; + return (EINVAL); + } } + tcp->tcp_init_cwnd = val; + + /* + * If the socket is connected, AND no outbound data + * has been sent, reset the actual cwnd values. + */ + if (tcp->tcp_state == TCPS_ESTABLISHED && + tcp->tcp_iss == tcp->tcp_snxt - 1) { + tcp->tcp_cwnd = + MIN(tcp->tcp_rwnd, val * tcp->tcp_mss); + } break; /* -- cgit v1.2.3