summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorDan McDonald <danmcd@nexenta.com>2011-09-02 16:41:08 -0700
committerDan McDonald <danmcd@nexenta.com>2011-09-02 16:41:08 -0700
commit9ebe787f7c290b43a8662c720b8420b27e27d3a9 (patch)
treeb4996e187c5a86a90252416910c25bcf773809b8 /usr/src
parent13cfc9727689eaa4573ca1edb5dd32f9adc5e18c (diff)
downloadillumos-gate-9ebe787f7c290b43a8662c720b8420b27e27d3a9.tar.gz
1434 TCP_INIT_CWND setsockopt doesn't work on passive connections.
Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Dan Kruchinin <dkruchinin@acm.org> Approved by: Eric Schrock <Eric.Schrock@delphix.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/inet/tcp/tcp_opt_data.c32
1 files changed, 21 insertions, 11 deletions
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;
/*