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


 677                 case TCP_CONN_ABORT_THRESHOLD:
 678                         if (!checkonly)
 679                                 tcp->tcp_second_ctimer_threshold = *i1;
 680                         break;
 681                 case TCP_RECVDSTADDR:
 682                         if (tcp->tcp_state > TCPS_LISTEN) {
 683                                 *outlenp = 0;
 684                                 return (EOPNOTSUPP);
 685                         }
 686                         /* Setting done in conn_opt_set */
 687                         break;
 688                 case TCP_INIT_CWND:
 689                         if (checkonly)
 690                                 break;
 691 
 692                         /*
 693                          * Only allow socket with network configuration
 694                          * privilege to set the initial cwnd to be larger
 695                          * than allowed by RFC 3390.
 696                          */
 697                         if (val <= MIN(4, MAX(2, 4380 / tcp->tcp_mss))) {
 698                                 tcp->tcp_init_cwnd = val;
 699                                 break;
 700                         }
 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                         }


 709                         tcp->tcp_init_cwnd = val;










 710                         break;
 711 
 712                 /*
 713                  * TCP_KEEPIDLE is in seconds but TCP_KEEPALIVE_THRESHOLD
 714                  * is in milliseconds. TCP_KEEPIDLE is introduced for
 715                  * compatibility with other Unix flavors.
 716                  * We can fall through TCP_KEEPALIVE_THRESHOLD logic after
 717                  * converting the input to milliseconds.
 718                  */
 719                 case TCP_KEEPIDLE:
 720                         *i1 *= 1000;
 721                         /* FALLTHRU */
 722 
 723                 case TCP_KEEPALIVE_THRESHOLD:
 724                         if (checkonly)
 725                                 break;
 726 
 727                         if (*i1 < tcps->tcps_keepalive_interval_low ||
 728                             *i1 > tcps->tcps_keepalive_interval_high) {
 729                                 *outlenp = 0;




 677                 case TCP_CONN_ABORT_THRESHOLD:
 678                         if (!checkonly)
 679                                 tcp->tcp_second_ctimer_threshold = *i1;
 680                         break;
 681                 case TCP_RECVDSTADDR:
 682                         if (tcp->tcp_state > TCPS_LISTEN) {
 683                                 *outlenp = 0;
 684                                 return (EOPNOTSUPP);
 685                         }
 686                         /* Setting done in conn_opt_set */
 687                         break;
 688                 case TCP_INIT_CWND:
 689                         if (checkonly)
 690                                 break;
 691 
 692                         /*
 693                          * Only allow socket with network configuration
 694                          * privilege to set the initial cwnd to be larger
 695                          * than allowed by RFC 3390.
 696                          */
 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                                 }
 707                         }
 708 
 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                         }
 720                         break;
 721 
 722                 /*
 723                  * TCP_KEEPIDLE is in seconds but TCP_KEEPALIVE_THRESHOLD
 724                  * is in milliseconds. TCP_KEEPIDLE is introduced for
 725                  * compatibility with other Unix flavors.
 726                  * We can fall through TCP_KEEPALIVE_THRESHOLD logic after
 727                  * converting the input to milliseconds.
 728                  */
 729                 case TCP_KEEPIDLE:
 730                         *i1 *= 1000;
 731                         /* FALLTHRU */
 732 
 733                 case TCP_KEEPALIVE_THRESHOLD:
 734                         if (checkonly)
 735                                 break;
 736 
 737                         if (*i1 < tcps->tcps_keepalive_interval_low ||
 738                             *i1 > tcps->tcps_keepalive_interval_high) {
 739                                 *outlenp = 0;