Print this page
1434 TCP_INIT_CWND setsockopt doesn't work on passive connections.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/tcp/tcp_opt_data.c
          +++ new/usr/src/uts/common/inet/tcp/tcp_opt_data.c
↓ open down ↓ 686 lines elided ↑ open up ↑
 687  687                          break;
 688  688                  case TCP_INIT_CWND:
 689  689                          if (checkonly)
 690  690                                  break;
 691  691  
 692  692                          /*
 693  693                           * Only allow socket with network configuration
 694  694                           * privilege to set the initial cwnd to be larger
 695  695                           * than allowed by RFC 3390.
 696  696                           */
 697      -                        if (val <= MIN(4, MAX(2, 4380 / tcp->tcp_mss))) {
 698      -                                tcp->tcp_init_cwnd = val;
 699      -                                break;
      697 +                        if (val > MIN(4, MAX(2, 4380 / tcp->tcp_mss))) {
      698 +                                if ((reterr = secpolicy_ip_config(cr, B_TRUE))
      699 +                                    != 0) {
      700 +                                        *outlenp = 0;
      701 +                                        return (reterr);
      702 +                                }
      703 +                                if (val > tcp_max_init_cwnd) {
      704 +                                        *outlenp = 0;
      705 +                                        return (EINVAL);
      706 +                                }
 700  707                          }
 701      -                        if ((reterr = secpolicy_ip_config(cr, B_TRUE)) != 0) {
 702      -                                *outlenp = 0;
 703      -                                return (reterr);
 704      -                        }
 705      -                        if (val > tcp_max_init_cwnd) {
 706      -                                *outlenp = 0;
 707      -                                return (EINVAL);
 708      -                        }
      708 +
 709  709                          tcp->tcp_init_cwnd = val;
      710 +
      711 +                        /*
      712 +                         * If the socket is connected, AND no outbound data
      713 +                         * has been sent, reset the actual cwnd values.
      714 +                         */
      715 +                        if (tcp->tcp_state == TCPS_ESTABLISHED &&
      716 +                            tcp->tcp_iss == tcp->tcp_snxt - 1) {
      717 +                                tcp->tcp_cwnd =
      718 +                                    MIN(tcp->tcp_rwnd, val * tcp->tcp_mss);
      719 +                        }
 710  720                          break;
 711  721  
 712  722                  /*
 713  723                   * TCP_KEEPIDLE is in seconds but TCP_KEEPALIVE_THRESHOLD
 714  724                   * is in milliseconds. TCP_KEEPIDLE is introduced for
 715  725                   * compatibility with other Unix flavors.
 716  726                   * We can fall through TCP_KEEPALIVE_THRESHOLD logic after
 717  727                   * converting the input to milliseconds.
 718  728                   */
 719  729                  case TCP_KEEPIDLE:
↓ open down ↓ 360 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX