The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netinet/sctp_sysctl.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved.
    3  * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
    4  * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions are met:
    8  *
    9  * a) Redistributions of source code must retain the above copyright notice,
   10  *    this list of conditions and the following disclaimer.
   11  *
   12  * b) Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in
   14  *    the documentation and/or other materials provided with the distribution.
   15  *
   16  * c) Neither the name of Cisco Systems, Inc. nor the names of its
   17  *    contributors may be used to endorse or promote products derived
   18  *    from this software without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
   22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
   24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   30  * THE POSSIBILITY OF SUCH DAMAGE.
   31  */
   32 
   33 #include <sys/cdefs.h>
   34 __FBSDID("$FreeBSD: stable/9/sys/netinet/sctp_sysctl.c 273916 2014-10-31 18:53:16Z hselasky $");
   35 
   36 #include <netinet/sctp_os.h>
   37 #include <netinet/sctp.h>
   38 #include <netinet/sctp_constants.h>
   39 #include <netinet/sctp_sysctl.h>
   40 #include <netinet/sctp_pcb.h>
   41 #include <netinet/sctputil.h>
   42 #include <netinet/sctp_output.h>
   43 #include <sys/smp.h>
   44 
   45 /*
   46  * sysctl tunable variables
   47  */
   48 
   49 void
   50 sctp_init_sysctls()
   51 {
   52         SCTP_BASE_SYSCTL(sctp_sendspace) = SCTPCTL_MAXDGRAM_DEFAULT;
   53         SCTP_BASE_SYSCTL(sctp_recvspace) = SCTPCTL_RECVSPACE_DEFAULT;
   54         SCTP_BASE_SYSCTL(sctp_auto_asconf) = SCTPCTL_AUTOASCONF_DEFAULT;
   55         SCTP_BASE_SYSCTL(sctp_multiple_asconfs) = SCTPCTL_MULTIPLEASCONFS_DEFAULT;
   56         SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT;
   57         SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT;
   58         SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT;
   59         SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT;
   60         SCTP_BASE_SYSCTL(sctp_fr_max_burst_default) = SCTPCTL_FRMAXBURST_DEFAULT;
   61         SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue) = SCTPCTL_MAXCHUNKS_DEFAULT;
   62         SCTP_BASE_SYSCTL(sctp_hashtblsize) = SCTPCTL_TCBHASHSIZE_DEFAULT;
   63         SCTP_BASE_SYSCTL(sctp_pcbtblsize) = SCTPCTL_PCBHASHSIZE_DEFAULT;
   64         SCTP_BASE_SYSCTL(sctp_min_split_point) = SCTPCTL_MIN_SPLIT_POINT_DEFAULT;
   65         SCTP_BASE_SYSCTL(sctp_chunkscale) = SCTPCTL_CHUNKSCALE_DEFAULT;
   66         SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default) = SCTPCTL_DELAYED_SACK_TIME_DEFAULT;
   67         SCTP_BASE_SYSCTL(sctp_sack_freq_default) = SCTPCTL_SACK_FREQ_DEFAULT;
   68         SCTP_BASE_SYSCTL(sctp_system_free_resc_limit) = SCTPCTL_SYS_RESOURCE_DEFAULT;
   69         SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit) = SCTPCTL_ASOC_RESOURCE_DEFAULT;
   70         SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default) = SCTPCTL_HEARTBEAT_INTERVAL_DEFAULT;
   71         SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default) = SCTPCTL_PMTU_RAISE_TIME_DEFAULT;
   72         SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default) = SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULT;
   73         SCTP_BASE_SYSCTL(sctp_secret_lifetime_default) = SCTPCTL_SECRET_LIFETIME_DEFAULT;
   74         SCTP_BASE_SYSCTL(sctp_rto_max_default) = SCTPCTL_RTO_MAX_DEFAULT;
   75         SCTP_BASE_SYSCTL(sctp_rto_min_default) = SCTPCTL_RTO_MIN_DEFAULT;
   76         SCTP_BASE_SYSCTL(sctp_rto_initial_default) = SCTPCTL_RTO_INITIAL_DEFAULT;
   77         SCTP_BASE_SYSCTL(sctp_init_rto_max_default) = SCTPCTL_INIT_RTO_MAX_DEFAULT;
   78         SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default) = SCTPCTL_VALID_COOKIE_LIFE_DEFAULT;
   79         SCTP_BASE_SYSCTL(sctp_init_rtx_max_default) = SCTPCTL_INIT_RTX_MAX_DEFAULT;
   80         SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default) = SCTPCTL_ASSOC_RTX_MAX_DEFAULT;
   81         SCTP_BASE_SYSCTL(sctp_path_rtx_max_default) = SCTPCTL_PATH_RTX_MAX_DEFAULT;
   82         SCTP_BASE_SYSCTL(sctp_path_pf_threshold) = SCTPCTL_PATH_PF_THRESHOLD_DEFAULT;
   83         SCTP_BASE_SYSCTL(sctp_add_more_threshold) = SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT;
   84         SCTP_BASE_SYSCTL(sctp_nr_incoming_streams_default) = SCTPCTL_INCOMING_STREAMS_DEFAULT;
   85         SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default) = SCTPCTL_OUTGOING_STREAMS_DEFAULT;
   86         SCTP_BASE_SYSCTL(sctp_cmt_on_off) = SCTPCTL_CMT_ON_OFF_DEFAULT;
   87         /* EY */
   88         SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) = SCTPCTL_NR_SACK_ON_OFF_DEFAULT;
   89         SCTP_BASE_SYSCTL(sctp_cmt_use_dac) = SCTPCTL_CMT_USE_DAC_DEFAULT;
   90         SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst) = SCTPCTL_CWND_MAXBURST_DEFAULT;
   91         SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk) = SCTPCTL_ASCONF_AUTH_NOCHK_DEFAULT;
   92         SCTP_BASE_SYSCTL(sctp_auth_disable) = SCTPCTL_AUTH_DISABLE_DEFAULT;
   93         SCTP_BASE_SYSCTL(sctp_nat_friendly) = SCTPCTL_NAT_FRIENDLY_DEFAULT;
   94         SCTP_BASE_SYSCTL(sctp_L2_abc_variable) = SCTPCTL_ABC_L_VAR_DEFAULT;
   95         SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count) = SCTPCTL_MAX_CHAINED_MBUFS_DEFAULT;
   96         SCTP_BASE_SYSCTL(sctp_do_drain) = SCTPCTL_DO_SCTP_DRAIN_DEFAULT;
   97         SCTP_BASE_SYSCTL(sctp_hb_maxburst) = SCTPCTL_HB_MAX_BURST_DEFAULT;
   98         SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit) = SCTPCTL_ABORT_AT_LIMIT_DEFAULT;
   99         SCTP_BASE_SYSCTL(sctp_strict_data_order) = SCTPCTL_STRICT_DATA_ORDER_DEFAULT;
  100         SCTP_BASE_SYSCTL(sctp_min_residual) = SCTPCTL_MIN_RESIDUAL_DEFAULT;
  101         SCTP_BASE_SYSCTL(sctp_max_retran_chunk) = SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT;
  102         SCTP_BASE_SYSCTL(sctp_logging_level) = SCTPCTL_LOGGING_LEVEL_DEFAULT;
  103         /* JRS - Variable for default congestion control module */
  104         SCTP_BASE_SYSCTL(sctp_default_cc_module) = SCTPCTL_DEFAULT_CC_MODULE_DEFAULT;
  105         /* RS - Variable for default stream scheduling module */
  106         SCTP_BASE_SYSCTL(sctp_default_ss_module) = SCTPCTL_DEFAULT_SS_MODULE_DEFAULT;
  107         SCTP_BASE_SYSCTL(sctp_default_frag_interleave) = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT;
  108         SCTP_BASE_SYSCTL(sctp_mobility_base) = SCTPCTL_MOBILITY_BASE_DEFAULT;
  109         SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT;
  110         SCTP_BASE_SYSCTL(sctp_vtag_time_wait) = SCTPCTL_TIME_WAIT_DEFAULT;
  111         SCTP_BASE_SYSCTL(sctp_buffer_splitting) = SCTPCTL_BUFFER_SPLITTING_DEFAULT;
  112         SCTP_BASE_SYSCTL(sctp_initial_cwnd) = SCTPCTL_INITIAL_CWND_DEFAULT;
  113         SCTP_BASE_SYSCTL(sctp_rttvar_bw) = SCTPCTL_RTTVAR_BW_DEFAULT;
  114         SCTP_BASE_SYSCTL(sctp_rttvar_rtt) = SCTPCTL_RTTVAR_RTT_DEFAULT;
  115         SCTP_BASE_SYSCTL(sctp_rttvar_eqret) = SCTPCTL_RTTVAR_EQRET_DEFAULT;
  116         SCTP_BASE_SYSCTL(sctp_steady_step) = SCTPCTL_RTTVAR_STEADYS_DEFAULT;
  117         SCTP_BASE_SYSCTL(sctp_use_dccc_ecn) = SCTPCTL_RTTVAR_DCCCECN_DEFAULT;
  118         SCTP_BASE_SYSCTL(sctp_blackhole) = SCTPCTL_BLACKHOLE_DEFAULT;
  119         SCTP_BASE_SYSCTL(sctp_diag_info_code) = SCTPCTL_DIAG_INFO_CODE_DEFAULT;
  120 #if defined(SCTP_LOCAL_TRACE_BUF)
  121         memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
  122 #endif
  123         SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = SCTPCTL_UDP_TUNNELING_PORT_DEFAULT;
  124         SCTP_BASE_SYSCTL(sctp_enable_sack_immediately) = SCTPCTL_SACK_IMMEDIATELY_ENABLE_DEFAULT;
  125         SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly) = SCTPCTL_NAT_FRIENDLY_INITS_DEFAULT;
  126 #if defined(SCTP_DEBUG)
  127         SCTP_BASE_SYSCTL(sctp_debug_on) = SCTPCTL_DEBUG_DEFAULT;
  128 #endif
  129 #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
  130         SCTP_BASE_SYSCTL(sctp_output_unlocked) = SCTPCTL_OUTPUT_UNLOCKED_DEFAULT;
  131 #endif
  132 }
  133 
  134 
  135 /* It returns an upper limit. No filtering is done here */
  136 static unsigned int
  137 number_of_addresses(struct sctp_inpcb *inp)
  138 {
  139         unsigned int cnt;
  140         struct sctp_vrf *vrf;
  141         struct sctp_ifn *sctp_ifn;
  142         struct sctp_ifa *sctp_ifa;
  143         struct sctp_laddr *laddr;
  144 
  145         cnt = 0;
  146         /* neither Mac OS X nor FreeBSD support mulitple routing functions */
  147         if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) {
  148                 return (0);
  149         }
  150         if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
  151                 LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
  152                         LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
  153                                 switch (sctp_ifa->address.sa.sa_family) {
  154 #ifdef INET
  155                                 case AF_INET:
  156 #endif
  157 #ifdef INET6
  158                                 case AF_INET6:
  159 #endif
  160                                         cnt++;
  161                                         break;
  162                                 default:
  163                                         break;
  164                                 }
  165                         }
  166                 }
  167         } else {
  168                 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
  169                         switch (laddr->ifa->address.sa.sa_family) {
  170 #ifdef INET
  171                         case AF_INET:
  172 #endif
  173 #ifdef INET6
  174                         case AF_INET6:
  175 #endif
  176                                 cnt++;
  177                                 break;
  178                         default:
  179                                 break;
  180                         }
  181                 }
  182         }
  183         return (cnt);
  184 }
  185 
  186 static int
  187 copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sysctl_req *req)
  188 {
  189         struct sctp_ifn *sctp_ifn;
  190         struct sctp_ifa *sctp_ifa;
  191         int loopback_scope, ipv4_local_scope, local_scope, site_scope;
  192         int ipv4_addr_legal, ipv6_addr_legal;
  193         struct sctp_vrf *vrf;
  194         struct xsctp_laddr xladdr;
  195         struct sctp_laddr *laddr;
  196         int error;
  197 
  198         /* Turn on all the appropriate scope */
  199         if (stcb) {
  200                 /* use association specific values */
  201                 loopback_scope = stcb->asoc.scope.loopback_scope;
  202                 ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope;
  203                 local_scope = stcb->asoc.scope.local_scope;
  204                 site_scope = stcb->asoc.scope.site_scope;
  205                 ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal;
  206                 ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal;
  207         } else {
  208                 /* Use generic values for endpoints. */
  209                 loopback_scope = 1;
  210                 ipv4_local_scope = 1;
  211                 local_scope = 1;
  212                 site_scope = 1;
  213                 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
  214                         ipv6_addr_legal = 1;
  215                         if (SCTP_IPV6_V6ONLY(inp)) {
  216                                 ipv4_addr_legal = 0;
  217                         } else {
  218                                 ipv4_addr_legal = 1;
  219                         }
  220                 } else {
  221                         ipv6_addr_legal = 0;
  222                         ipv4_addr_legal = 1;
  223                 }
  224         }
  225 
  226         /* neither Mac OS X nor FreeBSD support mulitple routing functions */
  227         if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) {
  228                 SCTP_INP_RUNLOCK(inp);
  229                 SCTP_INP_INFO_RUNLOCK();
  230                 return (-1);
  231         }
  232         if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
  233                 LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
  234                         if ((loopback_scope == 0) && SCTP_IFN_IS_IFT_LOOP(sctp_ifn))
  235                                 /* Skip loopback if loopback_scope not set */
  236                                 continue;
  237                         LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
  238                                 if (stcb) {
  239                                         /*
  240                                          * ignore if blacklisted at
  241                                          * association level
  242                                          */
  243                                         if (sctp_is_addr_restricted(stcb, sctp_ifa))
  244                                                 continue;
  245                                 }
  246                                 switch (sctp_ifa->address.sa.sa_family) {
  247 #ifdef INET
  248                                 case AF_INET:
  249                                         if (ipv4_addr_legal) {
  250                                                 struct sockaddr_in *sin;
  251 
  252                                                 sin = (struct sockaddr_in *)&sctp_ifa->address.sa;
  253                                                 if (sin->sin_addr.s_addr == 0)
  254                                                         continue;
  255                                                 if (prison_check_ip4(inp->ip_inp.inp.inp_cred,
  256                                                     &sin->sin_addr) != 0) {
  257                                                         continue;
  258                                                 }
  259                                                 if ((ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)))
  260                                                         continue;
  261                                         } else {
  262                                                 continue;
  263                                         }
  264                                         break;
  265 #endif
  266 #ifdef INET6
  267                                 case AF_INET6:
  268                                         if (ipv6_addr_legal) {
  269                                                 struct sockaddr_in6 *sin6;
  270 
  271                                                 sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sa;
  272                                                 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
  273                                                         continue;
  274                                                 if (prison_check_ip6(inp->ip_inp.inp.inp_cred,
  275                                                     &sin6->sin6_addr) != 0) {
  276                                                         continue;
  277                                                 }
  278                                                 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
  279                                                         if (local_scope == 0)
  280                                                                 continue;
  281                                                         if (sin6->sin6_scope_id == 0) {
  282                                                                 /*
  283                                                                  * bad link
  284                                                                  * local
  285                                                                  * address
  286                                                                  */
  287                                                                 if (sa6_recoverscope(sin6) != 0)
  288                                                                         continue;
  289                                                         }
  290                                                 }
  291                                                 if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)))
  292                                                         continue;
  293                                         } else {
  294                                                 continue;
  295                                         }
  296                                         break;
  297 #endif
  298                                 default:
  299                                         continue;
  300                                 }
  301                                 memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
  302                                 memcpy((void *)&xladdr.address, (const void *)&sctp_ifa->address, sizeof(union sctp_sockstore));
  303                                 SCTP_INP_RUNLOCK(inp);
  304                                 SCTP_INP_INFO_RUNLOCK();
  305                                 error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
  306                                 if (error) {
  307                                         return (error);
  308                                 } else {
  309                                         SCTP_INP_INFO_RLOCK();
  310                                         SCTP_INP_RLOCK(inp);
  311                                 }
  312                         }
  313                 }
  314         } else {
  315                 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
  316                         /* ignore if blacklisted at association level */
  317                         if (stcb && sctp_is_addr_restricted(stcb, laddr->ifa))
  318                                 continue;
  319                         memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
  320                         memcpy((void *)&xladdr.address, (const void *)&laddr->ifa->address, sizeof(union sctp_sockstore));
  321                         xladdr.start_time.tv_sec = (uint32_t) laddr->start_time.tv_sec;
  322                         xladdr.start_time.tv_usec = (uint32_t) laddr->start_time.tv_usec;
  323                         SCTP_INP_RUNLOCK(inp);
  324                         SCTP_INP_INFO_RUNLOCK();
  325                         error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
  326                         if (error) {
  327                                 return (error);
  328                         } else {
  329                                 SCTP_INP_INFO_RLOCK();
  330                                 SCTP_INP_RLOCK(inp);
  331                         }
  332                 }
  333         }
  334         memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
  335         xladdr.last = 1;
  336         SCTP_INP_RUNLOCK(inp);
  337         SCTP_INP_INFO_RUNLOCK();
  338         error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
  339 
  340         if (error) {
  341                 return (error);
  342         } else {
  343                 SCTP_INP_INFO_RLOCK();
  344                 SCTP_INP_RLOCK(inp);
  345                 return (0);
  346         }
  347 }
  348 
  349 /*
  350  * sysctl functions
  351  */
  352 static int
  353 sctp_assoclist(SYSCTL_HANDLER_ARGS)
  354 {
  355         unsigned int number_of_endpoints;
  356         unsigned int number_of_local_addresses;
  357         unsigned int number_of_associations;
  358         unsigned int number_of_remote_addresses;
  359         unsigned int n;
  360         int error;
  361         struct sctp_inpcb *inp;
  362         struct sctp_tcb *stcb;
  363         struct sctp_nets *net;
  364         struct xsctp_inpcb xinpcb;
  365         struct xsctp_tcb xstcb;
  366         struct xsctp_raddr xraddr;
  367         struct socket *so;
  368 
  369         number_of_endpoints = 0;
  370         number_of_local_addresses = 0;
  371         number_of_associations = 0;
  372         number_of_remote_addresses = 0;
  373 
  374         SCTP_INP_INFO_RLOCK();
  375         if (req->oldptr == USER_ADDR_NULL) {
  376                 LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) {
  377                         SCTP_INP_RLOCK(inp);
  378                         number_of_endpoints++;
  379                         number_of_local_addresses += number_of_addresses(inp);
  380                         LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
  381                                 number_of_associations++;
  382                                 number_of_local_addresses += number_of_addresses(inp);
  383                                 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
  384                                         number_of_remote_addresses++;
  385                                 }
  386                         }
  387                         SCTP_INP_RUNLOCK(inp);
  388                 }
  389                 SCTP_INP_INFO_RUNLOCK();
  390                 n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) +
  391                     (number_of_local_addresses + number_of_endpoints + number_of_associations) * sizeof(struct xsctp_laddr) +
  392                     (number_of_associations + number_of_endpoints) * sizeof(struct xsctp_tcb) +
  393                     (number_of_remote_addresses + number_of_associations) * sizeof(struct xsctp_raddr);
  394 
  395                 /* request some more memory than needed */
  396                 req->oldidx = (n + n / 8);
  397                 return (0);
  398         }
  399         if (req->newptr != USER_ADDR_NULL) {
  400                 SCTP_INP_INFO_RUNLOCK();
  401                 SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_SYSCTL, EPERM);
  402                 return (EPERM);
  403         }
  404         LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) {
  405                 SCTP_INP_RLOCK(inp);
  406                 if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) {
  407                         /* if its allgone it is being freed - skip it  */
  408                         goto skip;
  409                 }
  410                 xinpcb.last = 0;
  411                 xinpcb.local_port = ntohs(inp->sctp_lport);
  412                 xinpcb.flags = inp->sctp_flags;
  413                 xinpcb.features = (uint32_t) inp->sctp_features;
  414                 xinpcb.total_sends = inp->total_sends;
  415                 xinpcb.total_recvs = inp->total_recvs;
  416                 xinpcb.total_nospaces = inp->total_nospaces;
  417                 xinpcb.fragmentation_point = inp->sctp_frag_point;
  418                 so = inp->sctp_socket;
  419                 if ((so == NULL) ||
  420                     (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
  421                         xinpcb.qlen = 0;
  422                         xinpcb.maxqlen = 0;
  423                 } else {
  424                         xinpcb.qlen = so->so_qlen;
  425                         xinpcb.maxqlen = so->so_qlimit;
  426                 }
  427                 SCTP_INP_INCR_REF(inp);
  428                 SCTP_INP_RUNLOCK(inp);
  429                 SCTP_INP_INFO_RUNLOCK();
  430                 error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
  431                 if (error) {
  432                         SCTP_INP_DECR_REF(inp);
  433                         return (error);
  434                 }
  435                 SCTP_INP_INFO_RLOCK();
  436                 SCTP_INP_RLOCK(inp);
  437                 error = copy_out_local_addresses(inp, NULL, req);
  438                 if (error) {
  439                         SCTP_INP_DECR_REF(inp);
  440                         return (error);
  441                 }
  442                 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
  443                         SCTP_TCB_LOCK(stcb);
  444                         atomic_add_int(&stcb->asoc.refcnt, 1);
  445                         SCTP_TCB_UNLOCK(stcb);
  446                         xstcb.last = 0;
  447                         xstcb.local_port = ntohs(inp->sctp_lport);
  448                         xstcb.remote_port = ntohs(stcb->rport);
  449                         if (stcb->asoc.primary_destination != NULL)
  450                                 xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr;
  451                         xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay;
  452                         xstcb.state = SCTP_GET_STATE(&stcb->asoc);      /* FIXME */
  453                         /* 7.0 does not support these */
  454                         xstcb.assoc_id = sctp_get_associd(stcb);
  455                         xstcb.peers_rwnd = stcb->asoc.peers_rwnd;
  456                         xstcb.in_streams = stcb->asoc.streamincnt;
  457                         xstcb.out_streams = stcb->asoc.streamoutcnt;
  458                         xstcb.max_nr_retrans = stcb->asoc.overall_error_count;
  459                         xstcb.primary_process = 0;      /* not really supported
  460                                                          * yet */
  461                         xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie;
  462                         xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack;
  463                         xstcb.retransmitted_tsns = stcb->asoc.marked_retrans;
  464                         xstcb.start_time.tv_sec = (uint32_t) stcb->asoc.start_time.tv_sec;
  465                         xstcb.start_time.tv_usec = (uint32_t) stcb->asoc.start_time.tv_usec;
  466                         xstcb.discontinuity_time.tv_sec = (uint32_t) stcb->asoc.discontinuity_time.tv_sec;
  467                         xstcb.discontinuity_time.tv_usec = (uint32_t) stcb->asoc.discontinuity_time.tv_usec;
  468                         xstcb.total_sends = stcb->total_sends;
  469                         xstcb.total_recvs = stcb->total_recvs;
  470                         xstcb.local_tag = stcb->asoc.my_vtag;
  471                         xstcb.remote_tag = stcb->asoc.peer_vtag;
  472                         xstcb.initial_tsn = stcb->asoc.init_seq_number;
  473                         xstcb.highest_tsn = stcb->asoc.sending_seq - 1;
  474                         xstcb.cumulative_tsn = stcb->asoc.last_acked_seq;
  475                         xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn;
  476                         xstcb.mtu = stcb->asoc.smallest_mtu;
  477                         xstcb.refcnt = stcb->asoc.refcnt;
  478                         SCTP_INP_RUNLOCK(inp);
  479                         SCTP_INP_INFO_RUNLOCK();
  480                         error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
  481                         if (error) {
  482                                 SCTP_INP_DECR_REF(inp);
  483                                 atomic_subtract_int(&stcb->asoc.refcnt, 1);
  484                                 return (error);
  485                         }
  486                         SCTP_INP_INFO_RLOCK();
  487                         SCTP_INP_RLOCK(inp);
  488                         error = copy_out_local_addresses(inp, stcb, req);
  489                         if (error) {
  490                                 SCTP_INP_DECR_REF(inp);
  491                                 atomic_subtract_int(&stcb->asoc.refcnt, 1);
  492                                 return (error);
  493                         }
  494                         TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
  495                                 xraddr.last = 0;
  496                                 xraddr.address = net->ro._l_addr;
  497                                 xraddr.active = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE);
  498                                 xraddr.confirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0);
  499                                 xraddr.heartbeat_enabled = ((net->dest_state & SCTP_ADDR_NOHB) == 0);
  500                                 xraddr.potentially_failed = ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF);
  501                                 xraddr.rto = net->RTO;
  502                                 xraddr.max_path_rtx = net->failure_threshold;
  503                                 xraddr.rtx = net->marked_retrans;
  504                                 xraddr.error_counter = net->error_count;
  505                                 xraddr.cwnd = net->cwnd;
  506                                 xraddr.flight_size = net->flight_size;
  507                                 xraddr.mtu = net->mtu;
  508                                 xraddr.rtt = net->rtt / 1000;
  509                                 xraddr.heartbeat_interval = net->heart_beat_delay;
  510                                 xraddr.start_time.tv_sec = (uint32_t) net->start_time.tv_sec;
  511                                 xraddr.start_time.tv_usec = (uint32_t) net->start_time.tv_usec;
  512                                 SCTP_INP_RUNLOCK(inp);
  513                                 SCTP_INP_INFO_RUNLOCK();
  514                                 error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
  515                                 if (error) {
  516                                         SCTP_INP_DECR_REF(inp);
  517                                         atomic_subtract_int(&stcb->asoc.refcnt, 1);
  518                                         return (error);
  519                                 }
  520                                 SCTP_INP_INFO_RLOCK();
  521                                 SCTP_INP_RLOCK(inp);
  522                         }
  523                         atomic_subtract_int(&stcb->asoc.refcnt, 1);
  524                         memset((void *)&xraddr, 0, sizeof(struct xsctp_raddr));
  525                         xraddr.last = 1;
  526                         SCTP_INP_RUNLOCK(inp);
  527                         SCTP_INP_INFO_RUNLOCK();
  528                         error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
  529                         if (error) {
  530                                 SCTP_INP_DECR_REF(inp);
  531                                 return (error);
  532                         }
  533                         SCTP_INP_INFO_RLOCK();
  534                         SCTP_INP_RLOCK(inp);
  535                 }
  536                 SCTP_INP_DECR_REF(inp);
  537                 SCTP_INP_RUNLOCK(inp);
  538                 SCTP_INP_INFO_RUNLOCK();
  539                 memset((void *)&xstcb, 0, sizeof(struct xsctp_tcb));
  540                 xstcb.last = 1;
  541                 error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
  542                 if (error) {
  543                         return (error);
  544                 }
  545 skip:
  546                 SCTP_INP_INFO_RLOCK();
  547         }
  548         SCTP_INP_INFO_RUNLOCK();
  549 
  550         memset((void *)&xinpcb, 0, sizeof(struct xsctp_inpcb));
  551         xinpcb.last = 1;
  552         error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
  553         return (error);
  554 }
  555 
  556 
  557 #define RANGECHK(var, min, max) \
  558         if ((var) < (min)) { (var) = (min); } \
  559         else if ((var) > (max)) { (var) = (max); }
  560 
  561 static int
  562 sysctl_sctp_udp_tunneling_check(SYSCTL_HANDLER_ARGS)
  563 {
  564         int error;
  565         uint32_t old_sctp_udp_tunneling_port;
  566 
  567         SCTP_INP_INFO_RLOCK();
  568         old_sctp_udp_tunneling_port = SCTP_BASE_SYSCTL(sctp_udp_tunneling_port);
  569         SCTP_INP_INFO_RUNLOCK();
  570         error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
  571         if (error == 0) {
  572                 RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), SCTPCTL_UDP_TUNNELING_PORT_MIN, SCTPCTL_UDP_TUNNELING_PORT_MAX);
  573                 if (old_sctp_udp_tunneling_port == SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) {
  574                         error = 0;
  575                         goto out;
  576                 }
  577                 SCTP_INP_INFO_WLOCK();
  578                 if (old_sctp_udp_tunneling_port) {
  579                         sctp_over_udp_stop();
  580                 }
  581                 if (SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) {
  582                         if (sctp_over_udp_start()) {
  583                                 SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = 0;
  584                         }
  585                 }
  586                 SCTP_INP_INFO_WUNLOCK();
  587         }
  588 out:
  589         return (error);
  590 }
  591 
  592 
  593 static int
  594 sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
  595 {
  596         int error;
  597 
  598 #ifdef VIMAGE
  599         error = vnet_sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
  600 #else
  601         error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
  602 #endif
  603         if (error == 0) {
  604                 RANGECHK(SCTP_BASE_SYSCTL(sctp_sendspace), SCTPCTL_MAXDGRAM_MIN, SCTPCTL_MAXDGRAM_MAX);
  605                 RANGECHK(SCTP_BASE_SYSCTL(sctp_recvspace), SCTPCTL_RECVSPACE_MIN, SCTPCTL_RECVSPACE_MAX);
  606                 RANGECHK(SCTP_BASE_SYSCTL(sctp_auto_asconf), SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX);
  607                 RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX);
  608                 RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX);
  609                 RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX);
  610                 RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX);
  611                 RANGECHK(SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), SCTPCTL_FRMAXBURST_MIN, SCTPCTL_FRMAXBURST_MAX);
  612                 RANGECHK(SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), SCTPCTL_MAXCHUNKS_MIN, SCTPCTL_MAXCHUNKS_MAX);
  613                 RANGECHK(SCTP_BASE_SYSCTL(sctp_hashtblsize), SCTPCTL_TCBHASHSIZE_MIN, SCTPCTL_TCBHASHSIZE_MAX);
  614                 RANGECHK(SCTP_BASE_SYSCTL(sctp_pcbtblsize), SCTPCTL_PCBHASHSIZE_MIN, SCTPCTL_PCBHASHSIZE_MAX);
  615                 RANGECHK(SCTP_BASE_SYSCTL(sctp_min_split_point), SCTPCTL_MIN_SPLIT_POINT_MIN, SCTPCTL_MIN_SPLIT_POINT_MAX);
  616                 RANGECHK(SCTP_BASE_SYSCTL(sctp_chunkscale), SCTPCTL_CHUNKSCALE_MIN, SCTPCTL_CHUNKSCALE_MAX);
  617                 RANGECHK(SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default), SCTPCTL_DELAYED_SACK_TIME_MIN, SCTPCTL_DELAYED_SACK_TIME_MAX);
  618                 RANGECHK(SCTP_BASE_SYSCTL(sctp_sack_freq_default), SCTPCTL_SACK_FREQ_MIN, SCTPCTL_SACK_FREQ_MAX);
  619                 RANGECHK(SCTP_BASE_SYSCTL(sctp_system_free_resc_limit), SCTPCTL_SYS_RESOURCE_MIN, SCTPCTL_SYS_RESOURCE_MAX);
  620                 RANGECHK(SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit), SCTPCTL_ASOC_RESOURCE_MIN, SCTPCTL_ASOC_RESOURCE_MAX);
  621                 RANGECHK(SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default), SCTPCTL_HEARTBEAT_INTERVAL_MIN, SCTPCTL_HEARTBEAT_INTERVAL_MAX);
  622                 RANGECHK(SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default), SCTPCTL_PMTU_RAISE_TIME_MIN, SCTPCTL_PMTU_RAISE_TIME_MAX);
  623                 RANGECHK(SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default), SCTPCTL_SHUTDOWN_GUARD_TIME_MIN, SCTPCTL_SHUTDOWN_GUARD_TIME_MAX);
  624                 RANGECHK(SCTP_BASE_SYSCTL(sctp_secret_lifetime_default), SCTPCTL_SECRET_LIFETIME_MIN, SCTPCTL_SECRET_LIFETIME_MAX);
  625                 RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_max_default), SCTPCTL_RTO_MAX_MIN, SCTPCTL_RTO_MAX_MAX);
  626                 RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_min_default), SCTPCTL_RTO_MIN_MIN, SCTPCTL_RTO_MIN_MAX);
  627                 RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_initial_default), SCTPCTL_RTO_INITIAL_MIN, SCTPCTL_RTO_INITIAL_MAX);
  628                 RANGECHK(SCTP_BASE_SYSCTL(sctp_init_rto_max_default), SCTPCTL_INIT_RTO_MAX_MIN, SCTPCTL_INIT_RTO_MAX_MAX);
  629                 RANGECHK(SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default), SCTPCTL_VALID_COOKIE_LIFE_MIN, SCTPCTL_VALID_COOKIE_LIFE_MAX);
  630                 RANGECHK(SCTP_BASE_SYSCTL(sctp_init_rtx_max_default), SCTPCTL_INIT_RTX_MAX_MIN, SCTPCTL_INIT_RTX_MAX_MAX);
  631                 RANGECHK(SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default), SCTPCTL_ASSOC_RTX_MAX_MIN, SCTPCTL_ASSOC_RTX_MAX_MAX);
  632                 RANGECHK(SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), SCTPCTL_PATH_RTX_MAX_MIN, SCTPCTL_PATH_RTX_MAX_MAX);
  633                 RANGECHK(SCTP_BASE_SYSCTL(sctp_path_pf_threshold), SCTPCTL_PATH_PF_THRESHOLD_MIN, SCTPCTL_PATH_PF_THRESHOLD_MAX);
  634                 RANGECHK(SCTP_BASE_SYSCTL(sctp_add_more_threshold), SCTPCTL_ADD_MORE_ON_OUTPUT_MIN, SCTPCTL_ADD_MORE_ON_OUTPUT_MAX);
  635                 RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_incoming_streams_default), SCTPCTL_INCOMING_STREAMS_MIN, SCTPCTL_INCOMING_STREAMS_MAX);
  636                 RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), SCTPCTL_OUTGOING_STREAMS_MIN, SCTPCTL_OUTGOING_STREAMS_MAX);
  637                 RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_on_off), SCTPCTL_CMT_ON_OFF_MIN, SCTPCTL_CMT_ON_OFF_MAX);
  638                 /* EY */
  639                 RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), SCTPCTL_NR_SACK_ON_OFF_MIN, SCTPCTL_NR_SACK_ON_OFF_MAX);
  640                 RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_use_dac), SCTPCTL_CMT_USE_DAC_MIN, SCTPCTL_CMT_USE_DAC_MAX);
  641                 RANGECHK(SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), SCTPCTL_CWND_MAXBURST_MIN, SCTPCTL_CWND_MAXBURST_MAX);
  642                 RANGECHK(SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), SCTPCTL_ASCONF_AUTH_NOCHK_MIN, SCTPCTL_ASCONF_AUTH_NOCHK_MAX);
  643                 RANGECHK(SCTP_BASE_SYSCTL(sctp_auth_disable), SCTPCTL_AUTH_DISABLE_MIN, SCTPCTL_AUTH_DISABLE_MAX);
  644                 RANGECHK(SCTP_BASE_SYSCTL(sctp_nat_friendly), SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX);
  645                 RANGECHK(SCTP_BASE_SYSCTL(sctp_L2_abc_variable), SCTPCTL_ABC_L_VAR_MIN, SCTPCTL_ABC_L_VAR_MAX);
  646                 RANGECHK(SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count), SCTPCTL_MAX_CHAINED_MBUFS_MIN, SCTPCTL_MAX_CHAINED_MBUFS_MAX);
  647                 RANGECHK(SCTP_BASE_SYSCTL(sctp_do_drain), SCTPCTL_DO_SCTP_DRAIN_MIN, SCTPCTL_DO_SCTP_DRAIN_MAX);
  648                 RANGECHK(SCTP_BASE_SYSCTL(sctp_hb_maxburst), SCTPCTL_HB_MAX_BURST_MIN, SCTPCTL_HB_MAX_BURST_MAX);
  649                 RANGECHK(SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit), SCTPCTL_ABORT_AT_LIMIT_MIN, SCTPCTL_ABORT_AT_LIMIT_MAX);
  650                 RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_data_order), SCTPCTL_STRICT_DATA_ORDER_MIN, SCTPCTL_STRICT_DATA_ORDER_MAX);
  651                 RANGECHK(SCTP_BASE_SYSCTL(sctp_min_residual), SCTPCTL_MIN_RESIDUAL_MIN, SCTPCTL_MIN_RESIDUAL_MAX);
  652                 RANGECHK(SCTP_BASE_SYSCTL(sctp_max_retran_chunk), SCTPCTL_MAX_RETRAN_CHUNK_MIN, SCTPCTL_MAX_RETRAN_CHUNK_MAX);
  653                 RANGECHK(SCTP_BASE_SYSCTL(sctp_logging_level), SCTPCTL_LOGGING_LEVEL_MIN, SCTPCTL_LOGGING_LEVEL_MAX);
  654                 RANGECHK(SCTP_BASE_SYSCTL(sctp_default_cc_module), SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX);
  655                 RANGECHK(SCTP_BASE_SYSCTL(sctp_default_ss_module), SCTPCTL_DEFAULT_SS_MODULE_MIN, SCTPCTL_DEFAULT_SS_MODULE_MAX);
  656                 RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX);
  657                 RANGECHK(SCTP_BASE_SYSCTL(sctp_vtag_time_wait), SCTPCTL_TIME_WAIT_MIN, SCTPCTL_TIME_WAIT_MAX);
  658                 RANGECHK(SCTP_BASE_SYSCTL(sctp_buffer_splitting), SCTPCTL_BUFFER_SPLITTING_MIN, SCTPCTL_BUFFER_SPLITTING_MAX);
  659                 RANGECHK(SCTP_BASE_SYSCTL(sctp_initial_cwnd), SCTPCTL_INITIAL_CWND_MIN, SCTPCTL_INITIAL_CWND_MAX);
  660                 RANGECHK(SCTP_BASE_SYSCTL(sctp_rttvar_bw), SCTPCTL_RTTVAR_BW_MIN, SCTPCTL_RTTVAR_BW_MAX);
  661                 RANGECHK(SCTP_BASE_SYSCTL(sctp_rttvar_rtt), SCTPCTL_RTTVAR_RTT_MIN, SCTPCTL_RTTVAR_RTT_MAX);
  662                 RANGECHK(SCTP_BASE_SYSCTL(sctp_rttvar_eqret), SCTPCTL_RTTVAR_EQRET_MIN, SCTPCTL_RTTVAR_EQRET_MAX);
  663                 RANGECHK(SCTP_BASE_SYSCTL(sctp_steady_step), SCTPCTL_RTTVAR_STEADYS_MIN, SCTPCTL_RTTVAR_STEADYS_MAX);
  664                 RANGECHK(SCTP_BASE_SYSCTL(sctp_use_dccc_ecn), SCTPCTL_RTTVAR_DCCCECN_MIN, SCTPCTL_RTTVAR_DCCCECN_MAX);
  665                 RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX);
  666                 RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX);
  667                 RANGECHK(SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), SCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN, SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX);
  668                 RANGECHK(SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), SCTPCTL_NAT_FRIENDLY_INITS_MIN, SCTPCTL_NAT_FRIENDLY_INITS_MAX);
  669                 RANGECHK(SCTP_BASE_SYSCTL(sctp_blackhole), SCTPCTL_BLACKHOLE_MIN, SCTPCTL_BLACKHOLE_MAX);
  670                 RANGECHK(SCTP_BASE_SYSCTL(sctp_diag_info_code), SCTPCTL_DIAG_INFO_CODE_MIN, SCTPCTL_DIAG_INFO_CODE_MAX);
  671 
  672 #ifdef SCTP_DEBUG
  673                 RANGECHK(SCTP_BASE_SYSCTL(sctp_debug_on), SCTPCTL_DEBUG_MIN, SCTPCTL_DEBUG_MAX);
  674 #endif
  675 #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
  676                 RANGECHK(SCTP_BASE_SYSCTL(sctp_output_unlocked), SCTPCTL_OUTPUT_UNLOCKED_MIN, SCTPCTL_OUTPUT_UNLOCKED_MAX);
  677 #endif
  678         }
  679         return (error);
  680 }
  681 
  682 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
  683 static int
  684 sysctl_stat_get(SYSCTL_HANDLER_ARGS)
  685 {
  686         int cpu, error;
  687         struct sctpstat sb, sb_temp, *sarry, *cpin = NULL;
  688 
  689         if ((req->newptr) && (req->newlen == sizeof(struct sctpstat))) {
  690                 /*
  691                  * User wants us to clear or at least reset the counters to
  692                  * the specified values.
  693                  */
  694                 cpin = &sb_temp;
  695                 memset(&sb_temp, 0, sizeof(sb_temp));
  696                 error = SYSCTL_IN(req, &sb_temp, sizeof(sb_temp));
  697                 if (error != 0)
  698                         return (error);
  699         } else if (req->newptr) {
  700                 /* Must be a stat structure */
  701                 return (EINVAL);
  702         }
  703         memset(&sb, 0, sizeof(sb));
  704         for (cpu = 0; cpu < mp_maxid; cpu++) {
  705                 sarry = &SCTP_BASE_STATS[cpu];
  706                 if (sarry->sctps_discontinuitytime.tv_sec > sb.sctps_discontinuitytime.tv_sec) {
  707                         sb.sctps_discontinuitytime.tv_sec = sarry->sctps_discontinuitytime.tv_sec;
  708                         sb.sctps_discontinuitytime.tv_usec = sarry->sctps_discontinuitytime.tv_usec;
  709                 }
  710                 sb.sctps_currestab += sarry->sctps_currestab;
  711                 sb.sctps_activeestab += sarry->sctps_activeestab;
  712                 sb.sctps_restartestab += sarry->sctps_restartestab;
  713                 sb.sctps_collisionestab += sarry->sctps_collisionestab;
  714                 sb.sctps_passiveestab += sarry->sctps_passiveestab;
  715                 sb.sctps_aborted += sarry->sctps_aborted;
  716                 sb.sctps_shutdown += sarry->sctps_shutdown;
  717                 sb.sctps_outoftheblue += sarry->sctps_outoftheblue;
  718                 sb.sctps_checksumerrors += sarry->sctps_checksumerrors;
  719                 sb.sctps_outcontrolchunks += sarry->sctps_outcontrolchunks;
  720                 sb.sctps_outorderchunks += sarry->sctps_outorderchunks;
  721                 sb.sctps_outunorderchunks += sarry->sctps_outunorderchunks;
  722                 sb.sctps_incontrolchunks += sarry->sctps_incontrolchunks;
  723                 sb.sctps_inorderchunks += sarry->sctps_inorderchunks;
  724                 sb.sctps_inunorderchunks += sarry->sctps_inunorderchunks;
  725                 sb.sctps_fragusrmsgs += sarry->sctps_fragusrmsgs;
  726                 sb.sctps_reasmusrmsgs += sarry->sctps_reasmusrmsgs;
  727                 sb.sctps_outpackets += sarry->sctps_outpackets;
  728                 sb.sctps_inpackets += sarry->sctps_inpackets;
  729                 sb.sctps_recvpackets += sarry->sctps_recvpackets;
  730                 sb.sctps_recvdatagrams += sarry->sctps_recvdatagrams;
  731                 sb.sctps_recvpktwithdata += sarry->sctps_recvpktwithdata;
  732                 sb.sctps_recvsacks += sarry->sctps_recvsacks;
  733                 sb.sctps_recvdata += sarry->sctps_recvdata;
  734                 sb.sctps_recvdupdata += sarry->sctps_recvdupdata;
  735                 sb.sctps_recvheartbeat += sarry->sctps_recvheartbeat;
  736                 sb.sctps_recvheartbeatack += sarry->sctps_recvheartbeatack;
  737                 sb.sctps_recvecne += sarry->sctps_recvecne;
  738                 sb.sctps_recvauth += sarry->sctps_recvauth;
  739                 sb.sctps_recvauthmissing += sarry->sctps_recvauthmissing;
  740                 sb.sctps_recvivalhmacid += sarry->sctps_recvivalhmacid;
  741                 sb.sctps_recvivalkeyid += sarry->sctps_recvivalkeyid;
  742                 sb.sctps_recvauthfailed += sarry->sctps_recvauthfailed;
  743                 sb.sctps_recvexpress += sarry->sctps_recvexpress;
  744                 sb.sctps_recvexpressm += sarry->sctps_recvexpressm;
  745                 sb.sctps_recvnocrc += sarry->sctps_recvnocrc;
  746                 sb.sctps_recvswcrc += sarry->sctps_recvswcrc;
  747                 sb.sctps_recvhwcrc += sarry->sctps_recvhwcrc;
  748                 sb.sctps_sendpackets += sarry->sctps_sendpackets;
  749                 sb.sctps_sendsacks += sarry->sctps_sendsacks;
  750                 sb.sctps_senddata += sarry->sctps_senddata;
  751                 sb.sctps_sendretransdata += sarry->sctps_sendretransdata;
  752                 sb.sctps_sendfastretrans += sarry->sctps_sendfastretrans;
  753                 sb.sctps_sendmultfastretrans += sarry->sctps_sendmultfastretrans;
  754                 sb.sctps_sendheartbeat += sarry->sctps_sendheartbeat;
  755                 sb.sctps_sendecne += sarry->sctps_sendecne;
  756                 sb.sctps_sendauth += sarry->sctps_sendauth;
  757                 sb.sctps_senderrors += sarry->sctps_senderrors;
  758                 sb.sctps_sendnocrc += sarry->sctps_sendnocrc;
  759                 sb.sctps_sendswcrc += sarry->sctps_sendswcrc;
  760                 sb.sctps_sendhwcrc += sarry->sctps_sendhwcrc;
  761                 sb.sctps_pdrpfmbox += sarry->sctps_pdrpfmbox;
  762                 sb.sctps_pdrpfehos += sarry->sctps_pdrpfehos;
  763                 sb.sctps_pdrpmbda += sarry->sctps_pdrpmbda;
  764                 sb.sctps_pdrpmbct += sarry->sctps_pdrpmbct;
  765                 sb.sctps_pdrpbwrpt += sarry->sctps_pdrpbwrpt;
  766                 sb.sctps_pdrpcrupt += sarry->sctps_pdrpcrupt;
  767                 sb.sctps_pdrpnedat += sarry->sctps_pdrpnedat;
  768                 sb.sctps_pdrppdbrk += sarry->sctps_pdrppdbrk;
  769                 sb.sctps_pdrptsnnf += sarry->sctps_pdrptsnnf;
  770                 sb.sctps_pdrpdnfnd += sarry->sctps_pdrpdnfnd;
  771                 sb.sctps_pdrpdiwnp += sarry->sctps_pdrpdiwnp;
  772                 sb.sctps_pdrpdizrw += sarry->sctps_pdrpdizrw;
  773                 sb.sctps_pdrpbadd += sarry->sctps_pdrpbadd;
  774                 sb.sctps_pdrpmark += sarry->sctps_pdrpmark;
  775                 sb.sctps_timoiterator += sarry->sctps_timoiterator;
  776                 sb.sctps_timodata += sarry->sctps_timodata;
  777                 sb.sctps_timowindowprobe += sarry->sctps_timowindowprobe;
  778                 sb.sctps_timoinit += sarry->sctps_timoinit;
  779                 sb.sctps_timosack += sarry->sctps_timosack;
  780                 sb.sctps_timoshutdown += sarry->sctps_timoshutdown;
  781                 sb.sctps_timoheartbeat += sarry->sctps_timoheartbeat;
  782                 sb.sctps_timocookie += sarry->sctps_timocookie;
  783                 sb.sctps_timosecret += sarry->sctps_timosecret;
  784                 sb.sctps_timopathmtu += sarry->sctps_timopathmtu;
  785                 sb.sctps_timoshutdownack += sarry->sctps_timoshutdownack;
  786                 sb.sctps_timoshutdownguard += sarry->sctps_timoshutdownguard;
  787                 sb.sctps_timostrmrst += sarry->sctps_timostrmrst;
  788                 sb.sctps_timoearlyfr += sarry->sctps_timoearlyfr;
  789                 sb.sctps_timoasconf += sarry->sctps_timoasconf;
  790                 sb.sctps_timodelprim += sarry->sctps_timodelprim;
  791                 sb.sctps_timoautoclose += sarry->sctps_timoautoclose;
  792                 sb.sctps_timoassockill += sarry->sctps_timoassockill;
  793                 sb.sctps_timoinpkill += sarry->sctps_timoinpkill;
  794                 sb.sctps_hdrops += sarry->sctps_hdrops;
  795                 sb.sctps_badsum += sarry->sctps_badsum;
  796                 sb.sctps_noport += sarry->sctps_noport;
  797                 sb.sctps_badvtag += sarry->sctps_badvtag;
  798                 sb.sctps_badsid += sarry->sctps_badsid;
  799                 sb.sctps_nomem += sarry->sctps_nomem;
  800                 sb.sctps_fastretransinrtt += sarry->sctps_fastretransinrtt;
  801                 sb.sctps_markedretrans += sarry->sctps_markedretrans;
  802                 sb.sctps_naglesent += sarry->sctps_naglesent;
  803                 sb.sctps_naglequeued += sarry->sctps_naglequeued;
  804                 sb.sctps_maxburstqueued += sarry->sctps_maxburstqueued;
  805                 sb.sctps_ifnomemqueued += sarry->sctps_ifnomemqueued;
  806                 sb.sctps_windowprobed += sarry->sctps_windowprobed;
  807                 sb.sctps_lowlevelerr += sarry->sctps_lowlevelerr;
  808                 sb.sctps_lowlevelerrusr += sarry->sctps_lowlevelerrusr;
  809                 sb.sctps_datadropchklmt += sarry->sctps_datadropchklmt;
  810                 sb.sctps_datadroprwnd += sarry->sctps_datadroprwnd;
  811                 sb.sctps_ecnereducedcwnd += sarry->sctps_ecnereducedcwnd;
  812                 sb.sctps_vtagexpress += sarry->sctps_vtagexpress;
  813                 sb.sctps_vtagbogus += sarry->sctps_vtagbogus;
  814                 sb.sctps_primary_randry += sarry->sctps_primary_randry;
  815                 sb.sctps_cmt_randry += sarry->sctps_cmt_randry;
  816                 sb.sctps_slowpath_sack += sarry->sctps_slowpath_sack;
  817                 sb.sctps_wu_sacks_sent += sarry->sctps_wu_sacks_sent;
  818                 sb.sctps_sends_with_flags += sarry->sctps_sends_with_flags;
  819                 sb.sctps_sends_with_unord += sarry->sctps_sends_with_unord;
  820                 sb.sctps_sends_with_eof += sarry->sctps_sends_with_eof;
  821                 sb.sctps_sends_with_abort += sarry->sctps_sends_with_abort;
  822                 sb.sctps_protocol_drain_calls += sarry->sctps_protocol_drain_calls;
  823                 sb.sctps_protocol_drains_done += sarry->sctps_protocol_drains_done;
  824                 sb.sctps_read_peeks += sarry->sctps_read_peeks;
  825                 sb.sctps_cached_chk += sarry->sctps_cached_chk;
  826                 sb.sctps_cached_strmoq += sarry->sctps_cached_strmoq;
  827                 sb.sctps_left_abandon += sarry->sctps_left_abandon;
  828                 sb.sctps_send_burst_avoid += sarry->sctps_send_burst_avoid;
  829                 sb.sctps_send_cwnd_avoid += sarry->sctps_send_cwnd_avoid;
  830                 sb.sctps_fwdtsn_map_over += sarry->sctps_fwdtsn_map_over;
  831                 if (cpin) {
  832                         memcpy(sarry, cpin, sizeof(struct sctpstat));
  833                 }
  834         }
  835         error = SYSCTL_OUT(req, &sb, sizeof(sb));
  836         return (error);
  837 }
  838 
  839 #endif
  840 
  841 #if defined(SCTP_LOCAL_TRACE_BUF)
  842 static int
  843 sysctl_sctp_cleartrace(SYSCTL_HANDLER_ARGS)
  844 {
  845         int error = 0;
  846 
  847         memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
  848         return (error);
  849 }
  850 
  851 #endif
  852 
  853 
  854 /*
  855  * sysctl definitions
  856  */
  857 
  858 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, sendspace, CTLTYPE_UINT | CTLFLAG_RW,
  859     &SCTP_BASE_SYSCTL(sctp_sendspace), 0, sysctl_sctp_check, "IU",
  860     SCTPCTL_MAXDGRAM_DESC);
  861 
  862 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, recvspace, CTLTYPE_UINT | CTLFLAG_RW,
  863     &SCTP_BASE_SYSCTL(sctp_recvspace), 0, sysctl_sctp_check, "IU",
  864     SCTPCTL_RECVSPACE_DESC);
  865 
  866 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, auto_asconf, CTLTYPE_UINT | CTLFLAG_RW,
  867     &SCTP_BASE_SYSCTL(sctp_auto_asconf), 0, sysctl_sctp_check, "IU",
  868     SCTPCTL_AUTOASCONF_DESC);
  869 
  870 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, ecn_enable, CTLTYPE_UINT | CTLFLAG_RW,
  871     &SCTP_BASE_SYSCTL(sctp_ecn_enable), 0, sysctl_sctp_check, "IU",
  872     SCTPCTL_ECN_ENABLE_DESC);
  873 
  874 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_UINT | CTLFLAG_RW,
  875     &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU",
  876     SCTPCTL_STRICT_SACKS_DESC);
  877 
  878 
  879 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_UINT | CTLFLAG_RW,
  880     &SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), 0, sysctl_sctp_check, "IU",
  881     SCTPCTL_PEER_CHKOH_DESC);
  882 
  883 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, maxburst, CTLTYPE_UINT | CTLFLAG_RW,
  884     &SCTP_BASE_SYSCTL(sctp_max_burst_default), 0, sysctl_sctp_check, "IU",
  885     SCTPCTL_MAXBURST_DESC);
  886 
  887 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, fr_maxburst, CTLTYPE_UINT | CTLFLAG_RW,
  888     &SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), 0, sysctl_sctp_check, "IU",
  889     SCTPCTL_FRMAXBURST_DESC);
  890 
  891 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, maxchunks, CTLTYPE_UINT | CTLFLAG_RW,
  892     &SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), 0, sysctl_sctp_check, "IU",
  893     SCTPCTL_MAXCHUNKS_DESC);
  894 
  895 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, tcbhashsize, CTLTYPE_UINT | CTLFLAG_RW,
  896     &SCTP_BASE_SYSCTL(sctp_hashtblsize), 0, sysctl_sctp_check, "IU",
  897     SCTPCTL_TCBHASHSIZE_DESC);
  898 
  899 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, pcbhashsize, CTLTYPE_UINT | CTLFLAG_RW,
  900     &SCTP_BASE_SYSCTL(sctp_pcbtblsize), 0, sysctl_sctp_check, "IU",
  901     SCTPCTL_PCBHASHSIZE_DESC);
  902 
  903 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, min_split_point, CTLTYPE_UINT | CTLFLAG_RW,
  904     &SCTP_BASE_SYSCTL(sctp_min_split_point), 0, sysctl_sctp_check, "IU",
  905     SCTPCTL_MIN_SPLIT_POINT_DESC);
  906 
  907 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, chunkscale, CTLTYPE_UINT | CTLFLAG_RW,
  908     &SCTP_BASE_SYSCTL(sctp_chunkscale), 0, sysctl_sctp_check, "IU",
  909     SCTPCTL_CHUNKSCALE_DESC);
  910 
  911 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, delayed_sack_time, CTLTYPE_UINT | CTLFLAG_RW,
  912     &SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default), 0, sysctl_sctp_check, "IU",
  913     SCTPCTL_DELAYED_SACK_TIME_DESC);
  914 
  915 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, sack_freq, CTLTYPE_UINT | CTLFLAG_RW,
  916     &SCTP_BASE_SYSCTL(sctp_sack_freq_default), 0, sysctl_sctp_check, "IU",
  917     SCTPCTL_SACK_FREQ_DESC);
  918 
  919 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, sys_resource, CTLTYPE_UINT | CTLFLAG_RW,
  920     &SCTP_BASE_SYSCTL(sctp_system_free_resc_limit), 0, sysctl_sctp_check, "IU",
  921     SCTPCTL_SYS_RESOURCE_DESC);
  922 
  923 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, asoc_resource, CTLTYPE_UINT | CTLFLAG_RW,
  924     &SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit), 0, sysctl_sctp_check, "IU",
  925     SCTPCTL_ASOC_RESOURCE_DESC);
  926 
  927 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, heartbeat_interval, CTLTYPE_UINT | CTLFLAG_RW,
  928     &SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default), 0, sysctl_sctp_check, "IU",
  929     SCTPCTL_HEARTBEAT_INTERVAL_DESC);
  930 
  931 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, pmtu_raise_time, CTLTYPE_UINT | CTLFLAG_RW,
  932     &SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default), 0, sysctl_sctp_check, "IU",
  933     SCTPCTL_PMTU_RAISE_TIME_DESC);
  934 
  935 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, shutdown_guard_time, CTLTYPE_UINT | CTLFLAG_RW,
  936     &SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default), 0, sysctl_sctp_check, "IU",
  937     SCTPCTL_SHUTDOWN_GUARD_TIME_DESC);
  938 
  939 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, secret_lifetime, CTLTYPE_UINT | CTLFLAG_RW,
  940     &SCTP_BASE_SYSCTL(sctp_secret_lifetime_default), 0, sysctl_sctp_check, "IU",
  941     SCTPCTL_SECRET_LIFETIME_DESC);
  942 
  943 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rto_max, CTLTYPE_UINT | CTLFLAG_RW,
  944     &SCTP_BASE_SYSCTL(sctp_rto_max_default), 0, sysctl_sctp_check, "IU",
  945     SCTPCTL_RTO_MAX_DESC);
  946 
  947 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rto_min, CTLTYPE_UINT | CTLFLAG_RW,
  948     &SCTP_BASE_SYSCTL(sctp_rto_min_default), 0, sysctl_sctp_check, "IU",
  949     SCTPCTL_RTO_MIN_DESC);
  950 
  951 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rto_initial, CTLTYPE_UINT | CTLFLAG_RW,
  952     &SCTP_BASE_SYSCTL(sctp_rto_initial_default), 0, sysctl_sctp_check, "IU",
  953     SCTPCTL_RTO_INITIAL_DESC);
  954 
  955 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, init_rto_max, CTLTYPE_UINT | CTLFLAG_RW,
  956     &SCTP_BASE_SYSCTL(sctp_init_rto_max_default), 0, sysctl_sctp_check, "IU",
  957     SCTPCTL_INIT_RTO_MAX_DESC);
  958 
  959 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, valid_cookie_life, CTLTYPE_UINT | CTLFLAG_RW,
  960     &SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default), 0, sysctl_sctp_check, "IU",
  961     SCTPCTL_VALID_COOKIE_LIFE_DESC);
  962 
  963 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, init_rtx_max, CTLTYPE_UINT | CTLFLAG_RW,
  964     &SCTP_BASE_SYSCTL(sctp_init_rtx_max_default), 0, sysctl_sctp_check, "IU",
  965     SCTPCTL_INIT_RTX_MAX_DESC);
  966 
  967 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, assoc_rtx_max, CTLTYPE_UINT | CTLFLAG_RW,
  968     &SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default), 0, sysctl_sctp_check, "IU",
  969     SCTPCTL_ASSOC_RTX_MAX_DESC);
  970 
  971 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, path_rtx_max, CTLTYPE_UINT | CTLFLAG_RW,
  972     &SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), 0, sysctl_sctp_check, "IU",
  973     SCTPCTL_PATH_RTX_MAX_DESC);
  974 
  975 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, path_pf_threshold, CTLTYPE_UINT | CTLFLAG_RW,
  976     &SCTP_BASE_SYSCTL(sctp_path_pf_threshold), 0, sysctl_sctp_check, "IU",
  977     SCTPCTL_PATH_PF_THRESHOLD_DESC);
  978 
  979 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, add_more_on_output, CTLTYPE_UINT | CTLFLAG_RW,
  980     &SCTP_BASE_SYSCTL(sctp_add_more_threshold), 0, sysctl_sctp_check, "IU",
  981     SCTPCTL_ADD_MORE_ON_OUTPUT_DESC);
  982 
  983 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, incoming_streams, CTLTYPE_UINT | CTLFLAG_RW,
  984     &SCTP_BASE_SYSCTL(sctp_nr_incoming_streams_default), 0, sysctl_sctp_check, "IU",
  985     SCTPCTL_INCOMING_STREAMS_DESC);
  986 
  987 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLTYPE_UINT | CTLFLAG_RW,
  988     &SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), 0, sysctl_sctp_check, "IU",
  989     SCTPCTL_OUTGOING_STREAMS_DESC);
  990 
  991 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLTYPE_UINT | CTLFLAG_RW,
  992     &SCTP_BASE_SYSCTL(sctp_cmt_on_off), 0, sysctl_sctp_check, "IU",
  993     SCTPCTL_CMT_ON_OFF_DESC);
  994 
  995 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, nr_sack_on_off, CTLTYPE_UINT | CTLFLAG_RW,
  996     &SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), 0, sysctl_sctp_check, "IU",
  997     SCTPCTL_NR_SACK_ON_OFF_DESC);
  998 
  999 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLTYPE_UINT | CTLFLAG_RW,
 1000     &SCTP_BASE_SYSCTL(sctp_cmt_use_dac), 0, sysctl_sctp_check, "IU",
 1001     SCTPCTL_CMT_USE_DAC_DESC);
 1002 
 1003 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, cwnd_maxburst, CTLTYPE_UINT | CTLFLAG_RW,
 1004     &SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), 0, sysctl_sctp_check, "IU",
 1005     SCTPCTL_CWND_MAXBURST_DESC);
 1006 
 1007 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLTYPE_UINT | CTLFLAG_RW,
 1008     &SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), 0, sysctl_sctp_check, "IU",
 1009     SCTPCTL_ASCONF_AUTH_NOCHK_DESC);
 1010 
 1011 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, auth_disable, CTLTYPE_UINT | CTLFLAG_RW,
 1012     &SCTP_BASE_SYSCTL(sctp_auth_disable), 0, sysctl_sctp_check, "IU",
 1013     SCTPCTL_AUTH_DISABLE_DESC);
 1014 
 1015 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, nat_friendly, CTLTYPE_UINT | CTLFLAG_RW,
 1016     &SCTP_BASE_SYSCTL(sctp_nat_friendly), 0, sysctl_sctp_check, "IU",
 1017     SCTPCTL_NAT_FRIENDLY_DESC);
 1018 
 1019 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, abc_l_var, CTLTYPE_UINT | CTLFLAG_RW,
 1020     &SCTP_BASE_SYSCTL(sctp_L2_abc_variable), 0, sysctl_sctp_check, "IU",
 1021     SCTPCTL_ABC_L_VAR_DESC);
 1022 
 1023 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, max_chained_mbufs, CTLTYPE_UINT | CTLFLAG_RW,
 1024     &SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count), 0, sysctl_sctp_check, "IU",
 1025     SCTPCTL_MAX_CHAINED_MBUFS_DESC);
 1026 
 1027 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, do_sctp_drain, CTLTYPE_UINT | CTLFLAG_RW,
 1028     &SCTP_BASE_SYSCTL(sctp_do_drain), 0, sysctl_sctp_check, "IU",
 1029     SCTPCTL_DO_SCTP_DRAIN_DESC);
 1030 
 1031 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, hb_max_burst, CTLTYPE_UINT | CTLFLAG_RW,
 1032     &SCTP_BASE_SYSCTL(sctp_hb_maxburst), 0, sysctl_sctp_check, "IU",
 1033     SCTPCTL_HB_MAX_BURST_DESC);
 1034 
 1035 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, abort_at_limit, CTLTYPE_UINT | CTLFLAG_RW,
 1036     &SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit), 0, sysctl_sctp_check, "IU",
 1037     SCTPCTL_ABORT_AT_LIMIT_DESC);
 1038 
 1039 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, strict_data_order, CTLTYPE_UINT | CTLFLAG_RW,
 1040     &SCTP_BASE_SYSCTL(sctp_strict_data_order), 0, sysctl_sctp_check, "IU",
 1041     SCTPCTL_STRICT_DATA_ORDER_DESC);
 1042 
 1043 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, min_residual, CTLTYPE_UINT | CTLFLAG_RW,
 1044     &SCTP_BASE_SYSCTL(sctp_min_residual), 0, sysctl_sctp_check, "IU",
 1045     SCTPCTL_MIN_RESIDUAL_DESC);
 1046 
 1047 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLTYPE_UINT | CTLFLAG_RW,
 1048     &SCTP_BASE_SYSCTL(sctp_max_retran_chunk), 0, sysctl_sctp_check, "IU",
 1049     SCTPCTL_MAX_RETRAN_CHUNK_DESC);
 1050 
 1051 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, log_level, CTLTYPE_UINT | CTLFLAG_RW,
 1052     &SCTP_BASE_SYSCTL(sctp_logging_level), 0, sysctl_sctp_check, "IU",
 1053     SCTPCTL_LOGGING_LEVEL_DESC);
 1054 
 1055 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, default_cc_module, CTLTYPE_UINT | CTLFLAG_RW,
 1056     &SCTP_BASE_SYSCTL(sctp_default_cc_module), 0, sysctl_sctp_check, "IU",
 1057     SCTPCTL_DEFAULT_CC_MODULE_DESC);
 1058 
 1059 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, default_ss_module, CTLTYPE_UINT | CTLFLAG_RW,
 1060     &SCTP_BASE_SYSCTL(sctp_default_ss_module), 0, sysctl_sctp_check, "IU",
 1061     SCTPCTL_DEFAULT_SS_MODULE_DESC);
 1062 
 1063 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, default_frag_interleave, CTLTYPE_UINT | CTLFLAG_RW,
 1064     &SCTP_BASE_SYSCTL(sctp_default_frag_interleave), 0, sysctl_sctp_check, "IU",
 1065     SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DESC);
 1066 
 1067 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, mobility_base, CTLTYPE_UINT | CTLFLAG_RW,
 1068     &SCTP_BASE_SYSCTL(sctp_mobility_base), 0, sysctl_sctp_check, "IU",
 1069     SCTPCTL_MOBILITY_BASE_DESC);
 1070 
 1071 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, mobility_fasthandoff, CTLTYPE_UINT | CTLFLAG_RW,
 1072     &SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), 0, sysctl_sctp_check, "IU",
 1073     SCTPCTL_MOBILITY_FASTHANDOFF_DESC);
 1074 
 1075 #if defined(SCTP_LOCAL_TRACE_BUF)
 1076 SYSCTL_VNET_STRUCT(_net_inet_sctp, OID_AUTO, log, CTLFLAG_RD,
 1077     &SCTP_BASE_SYSCTL(sctp_log), sctp_log,
 1078     "SCTP logging (struct sctp_log)");
 1079 
 1080 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, clear_trace, CTLTYPE_UINT | CTLFLAG_RW,
 1081     &SCTP_BASE_SYSCTL(sctp_log), 0, sysctl_sctp_cleartrace, "IU",
 1082     "Clear SCTP Logging buffer");
 1083 #endif
 1084 
 1085 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_port, CTLTYPE_UINT | CTLFLAG_RW,
 1086     &SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), 0, sysctl_sctp_udp_tunneling_check, "IU",
 1087     SCTPCTL_UDP_TUNNELING_PORT_DESC);
 1088 
 1089 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, enable_sack_immediately, CTLTYPE_UINT | CTLFLAG_RW,
 1090     &SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), 0, sysctl_sctp_check, "IU",
 1091     SCTPCTL_SACK_IMMEDIATELY_ENABLE_DESC);
 1092 
 1093 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, nat_friendly_init, CTLTYPE_UINT | CTLFLAG_RW,
 1094     &SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), 0, sysctl_sctp_check, "IU",
 1095     SCTPCTL_NAT_FRIENDLY_INITS_DESC);
 1096 
 1097 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, vtag_time_wait, CTLTYPE_UINT | CTLFLAG_RW,
 1098     &SCTP_BASE_SYSCTL(sctp_vtag_time_wait), 0, sysctl_sctp_check, "IU",
 1099     SCTPCTL_TIME_WAIT_DESC);
 1100 
 1101 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, buffer_splitting, CTLTYPE_UINT | CTLFLAG_RW,
 1102     &SCTP_BASE_SYSCTL(sctp_buffer_splitting), 0, sysctl_sctp_check, "IU",
 1103     SCTPCTL_BUFFER_SPLITTING_DESC);
 1104 
 1105 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, initial_cwnd, CTLTYPE_UINT | CTLFLAG_RW,
 1106     &SCTP_BASE_SYSCTL(sctp_initial_cwnd), 0, sysctl_sctp_check, "IU",
 1107     SCTPCTL_INITIAL_CWND_DESC);
 1108 
 1109 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rttvar_bw, CTLTYPE_UINT | CTLFLAG_RW,
 1110     &SCTP_BASE_SYSCTL(sctp_rttvar_bw), 0, sysctl_sctp_check, "IU",
 1111     SCTPCTL_RTTVAR_BW_DESC);
 1112 
 1113 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rttvar_rtt, CTLTYPE_UINT | CTLFLAG_RW,
 1114     &SCTP_BASE_SYSCTL(sctp_rttvar_rtt), 0, sysctl_sctp_check, "IU",
 1115     SCTPCTL_RTTVAR_RTT_DESC);
 1116 
 1117 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rttvar_eqret, CTLTYPE_UINT | CTLFLAG_RW,
 1118     &SCTP_BASE_SYSCTL(sctp_rttvar_eqret), 0, sysctl_sctp_check, "IU",
 1119     SCTPCTL_RTTVAR_EQRET_DESC);
 1120 
 1121 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rttvar_steady_step, CTLTYPE_UINT | CTLFLAG_RW,
 1122     &SCTP_BASE_SYSCTL(sctp_steady_step), 0, sysctl_sctp_check, "IU",
 1123     SCTPCTL_RTTVAR_STEADYS_DESC);
 1124 
 1125 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, use_dcccecn, CTLTYPE_UINT | CTLFLAG_RW,
 1126     &SCTP_BASE_SYSCTL(sctp_use_dccc_ecn), 0, sysctl_sctp_check, "IU",
 1127     SCTPCTL_RTTVAR_DCCCECN_DESC);
 1128 
 1129 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, blackhole, CTLTYPE_UINT | CTLFLAG_RW,
 1130     &SCTP_BASE_SYSCTL(sctp_blackhole), 0, sysctl_sctp_check, "IU",
 1131     SCTPCTL_BLACKHOLE_DESC);
 1132 
 1133 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, diag_info_code, CTLTYPE_UINT | CTLFLAG_RW,
 1134     &SCTP_BASE_SYSCTL(sctp_diag_info_code), 0, sysctl_sctp_check, "IU",
 1135     SCTPCTL_DIAG_INFO_CODE_DESC);
 1136 
 1137 #ifdef SCTP_DEBUG
 1138 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_UINT | CTLFLAG_RW,
 1139     &SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU",
 1140     SCTPCTL_DEBUG_DESC);
 1141 #endif
 1142 
 1143 
 1144 #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
 1145 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, output_unlocked, CTLTYPE_UINT | CTLFLAG_RW,
 1146     &SCTP_BASE_SYSCTL(sctp_output_unlocked), 0, sysctl_sctp_check, "IU",
 1147     SCTPCTL_OUTPUT_UNLOCKED_DESC);
 1148 #endif
 1149 
 1150 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
 1151 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, stats,
 1152     CTLTYPE_STRUCT | CTLFLAG_RW,
 1153     0, 0, sysctl_stat_get, "S,sctpstat",
 1154     "SCTP statistics (struct sctp_stat)");
 1155 #else
 1156 SYSCTL_VNET_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW,
 1157     &SCTP_BASE_STATS_SYSCTL, sctpstat,
 1158     "SCTP statistics (struct sctp_stat)");
 1159 #endif
 1160 
 1161 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLTYPE_OPAQUE | CTLFLAG_RD,
 1162     0, 0, sctp_assoclist,
 1163     "S,xassoc", "List of active SCTP associations");

Cache object: 5b8adf8d4a8b443cc52d30d177d7d1c8


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.