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

Cache object: a7ef53f9764192a7ba70594a9586e418


[ 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.