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$");
   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 
   42 /*
   43  * sysctl tunable variables
   44  */
   45 
   46 void
   47 sctp_init_sysctls()
   48 {
   49         SCTP_BASE_SYSCTL(sctp_sendspace) = SCTPCTL_MAXDGRAM_DEFAULT;
   50         SCTP_BASE_SYSCTL(sctp_recvspace) = SCTPCTL_RECVSPACE_DEFAULT;
   51         SCTP_BASE_SYSCTL(sctp_auto_asconf) = SCTPCTL_AUTOASCONF_DEFAULT;
   52         SCTP_BASE_SYSCTL(sctp_multiple_asconfs) = SCTPCTL_MULTIPLEASCONFS_DEFAULT;
   53         SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT;
   54         SCTP_BASE_SYSCTL(sctp_ecn_nonce) = SCTPCTL_ECN_NONCE_DEFAULT;
   55         SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT;
   56         SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT;
   57         SCTP_BASE_SYSCTL(sctp_strict_init) = SCTPCTL_STRICT_INIT_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_max_chunks_on_queue) = SCTPCTL_MAXCHUNKS_DEFAULT;
   61         SCTP_BASE_SYSCTL(sctp_hashtblsize) = SCTPCTL_TCBHASHSIZE_DEFAULT;
   62         SCTP_BASE_SYSCTL(sctp_pcbtblsize) = SCTPCTL_PCBHASHSIZE_DEFAULT;
   63         SCTP_BASE_SYSCTL(sctp_min_split_point) = SCTPCTL_MIN_SPLIT_POINT_DEFAULT;
   64         SCTP_BASE_SYSCTL(sctp_chunkscale) = SCTPCTL_CHUNKSCALE_DEFAULT;
   65         SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default) = SCTPCTL_DELAYED_SACK_TIME_DEFAULT;
   66         SCTP_BASE_SYSCTL(sctp_sack_freq_default) = SCTPCTL_SACK_FREQ_DEFAULT;
   67         SCTP_BASE_SYSCTL(sctp_system_free_resc_limit) = SCTPCTL_SYS_RESOURCE_DEFAULT;
   68         SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit) = SCTPCTL_ASOC_RESOURCE_DEFAULT;
   69         SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default) = SCTPCTL_HEARTBEAT_INTERVAL_DEFAULT;
   70         SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default) = SCTPCTL_PMTU_RAISE_TIME_DEFAULT;
   71         SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default) = SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULT;
   72         SCTP_BASE_SYSCTL(sctp_secret_lifetime_default) = SCTPCTL_SECRET_LIFETIME_DEFAULT;
   73         SCTP_BASE_SYSCTL(sctp_rto_max_default) = SCTPCTL_RTO_MAX_DEFAULT;
   74         SCTP_BASE_SYSCTL(sctp_rto_min_default) = SCTPCTL_RTO_MIN_DEFAULT;
   75         SCTP_BASE_SYSCTL(sctp_rto_initial_default) = SCTPCTL_RTO_INITIAL_DEFAULT;
   76         SCTP_BASE_SYSCTL(sctp_init_rto_max_default) = SCTPCTL_INIT_RTO_MAX_DEFAULT;
   77         SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default) = SCTPCTL_VALID_COOKIE_LIFE_DEFAULT;
   78         SCTP_BASE_SYSCTL(sctp_init_rtx_max_default) = SCTPCTL_INIT_RTX_MAX_DEFAULT;
   79         SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default) = SCTPCTL_ASSOC_RTX_MAX_DEFAULT;
   80         SCTP_BASE_SYSCTL(sctp_path_rtx_max_default) = SCTPCTL_PATH_RTX_MAX_DEFAULT;
   81         SCTP_BASE_SYSCTL(sctp_add_more_threshold) = SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT;
   82         SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default) = SCTPCTL_OUTGOING_STREAMS_DEFAULT;
   83         SCTP_BASE_SYSCTL(sctp_cmt_on_off) = SCTPCTL_CMT_ON_OFF_DEFAULT;
   84         /* EY */
   85         SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) = SCTPCTL_NR_SACK_ON_OFF_DEFAULT;
   86         SCTP_BASE_SYSCTL(sctp_cmt_use_dac) = SCTPCTL_CMT_USE_DAC_DEFAULT;
   87         SCTP_BASE_SYSCTL(sctp_cmt_pf) = SCTPCTL_CMT_PF_DEFAULT;
   88         SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst) = SCTPCTL_CWND_MAXBURST_DEFAULT;
   89         SCTP_BASE_SYSCTL(sctp_early_fr) = SCTPCTL_EARLY_FAST_RETRAN_DEFAULT;
   90         SCTP_BASE_SYSCTL(sctp_early_fr_msec) = SCTPCTL_EARLY_FAST_RETRAN_MSEC_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         SCTP_BASE_SYSCTL(sctp_default_frag_interleave) = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT;
  106         SCTP_BASE_SYSCTL(sctp_mobility_base) = SCTPCTL_MOBILITY_BASE_DEFAULT;
  107         SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT;
  108 #if defined(SCTP_LOCAL_TRACE_BUF)
  109         memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
  110 #endif
  111         SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable) = SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_DEFAULT;
  112         SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = SCTPCTL_UDP_TUNNELING_PORT_DEFAULT;
  113         SCTP_BASE_SYSCTL(sctp_enable_sack_immediately) = SCTPCTL_SACK_IMMEDIATELY_ENABLE_DEFAULT;
  114         SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly) = SCTPCTL_NAT_FRIENDLY_DEFAULT;
  115 #if defined(SCTP_DEBUG)
  116         SCTP_BASE_SYSCTL(sctp_debug_on) = SCTPCTL_DEBUG_DEFAULT;
  117 #endif
  118 #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
  119         SCTP_BASE_SYSCTL(sctp_output_unlocked) = SCTPCTL_OUTPUT_UNLOCKED_DEFAULT;
  120 #endif
  121 }
  122 
  123 /* It returns an upper limit. No filtering is done here */
  124 static unsigned int
  125 number_of_addresses(struct sctp_inpcb *inp)
  126 {
  127         int cnt;
  128         struct sctp_vrf *vrf;
  129         struct sctp_ifn *sctp_ifn;
  130         struct sctp_ifa *sctp_ifa;
  131         struct sctp_laddr *laddr;
  132 
  133         cnt = 0;
  134         /* neither Mac OS X nor FreeBSD support mulitple routing functions */
  135         if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) {
  136                 return (0);
  137         }
  138         if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
  139                 LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
  140                         LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
  141                                 if ((sctp_ifa->address.sa.sa_family == AF_INET) ||
  142                                     (sctp_ifa->address.sa.sa_family == AF_INET6)) {
  143                                         cnt++;
  144                                 }
  145                         }
  146                 }
  147         } else {
  148                 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
  149                         if ((laddr->ifa->address.sa.sa_family == AF_INET) ||
  150                             (laddr->ifa->address.sa.sa_family == AF_INET6)) {
  151                                 cnt++;
  152                         }
  153                 }
  154         }
  155         return (cnt);
  156 }
  157 
  158 static int
  159 copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sysctl_req *req)
  160 {
  161         struct sctp_ifn *sctp_ifn;
  162         struct sctp_ifa *sctp_ifa;
  163         int loopback_scope, ipv4_local_scope, local_scope, site_scope;
  164         int ipv4_addr_legal, ipv6_addr_legal;
  165         struct sctp_vrf *vrf;
  166         struct xsctp_laddr xladdr;
  167         struct sctp_laddr *laddr;
  168         int error;
  169 
  170         /* Turn on all the appropriate scope */
  171         if (stcb) {
  172                 /* use association specific values */
  173                 loopback_scope = stcb->asoc.loopback_scope;
  174                 ipv4_local_scope = stcb->asoc.ipv4_local_scope;
  175                 local_scope = stcb->asoc.local_scope;
  176                 site_scope = stcb->asoc.site_scope;
  177         } else {
  178                 /* use generic values for endpoints */
  179                 loopback_scope = 1;
  180                 ipv4_local_scope = 1;
  181                 local_scope = 1;
  182                 site_scope = 1;
  183         }
  184 
  185         /* use only address families of interest */
  186         if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
  187                 ipv6_addr_legal = 1;
  188                 if (SCTP_IPV6_V6ONLY(inp)) {
  189                         ipv4_addr_legal = 0;
  190                 } else {
  191                         ipv4_addr_legal = 1;
  192                 }
  193         } else {
  194                 ipv4_addr_legal = 1;
  195                 ipv6_addr_legal = 0;
  196         }
  197 
  198         error = 0;
  199 
  200         /* neither Mac OS X nor FreeBSD support mulitple routing functions */
  201         if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) {
  202                 SCTP_INP_RUNLOCK(inp);
  203                 SCTP_INP_INFO_RUNLOCK();
  204                 return (-1);
  205         }
  206         if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
  207                 LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
  208                         if ((loopback_scope == 0) && SCTP_IFN_IS_IFT_LOOP(sctp_ifn))
  209                                 /* Skip loopback if loopback_scope not set */
  210                                 continue;
  211                         LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
  212                                 if (stcb) {
  213                                         /*
  214                                          * ignore if blacklisted at
  215                                          * association level
  216                                          */
  217                                         if (sctp_is_addr_restricted(stcb, sctp_ifa))
  218                                                 continue;
  219                                 }
  220                                 switch (sctp_ifa->address.sa.sa_family) {
  221                                 case AF_INET:
  222                                         if (ipv4_addr_legal) {
  223                                                 struct sockaddr_in *sin;
  224 
  225                                                 sin = (struct sockaddr_in *)&sctp_ifa->address.sa;
  226                                                 if (sin->sin_addr.s_addr == 0)
  227                                                         continue;
  228                                                 if ((ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)))
  229                                                         continue;
  230                                         } else {
  231                                                 continue;
  232                                         }
  233                                         break;
  234 #ifdef INET6
  235                                 case AF_INET6:
  236                                         if (ipv6_addr_legal) {
  237                                                 struct sockaddr_in6 *sin6;
  238 
  239                                                 sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sa;
  240                                                 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
  241                                                         continue;
  242                                                 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
  243                                                         if (local_scope == 0)
  244                                                                 continue;
  245                                                         if (sin6->sin6_scope_id == 0) {
  246                                                                 /*
  247                                                                  * bad link
  248                                                                  * local
  249                                                                  * address
  250                                                                  */
  251                                                                 if (sa6_recoverscope(sin6) != 0)
  252                                                                         continue;
  253                                                         }
  254                                                 }
  255                                                 if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)))
  256                                                         continue;
  257                                         } else {
  258                                                 continue;
  259                                         }
  260                                         break;
  261 #endif
  262                                 default:
  263                                         continue;
  264                                 }
  265                                 memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
  266                                 memcpy((void *)&xladdr.address, (const void *)&sctp_ifa->address, sizeof(union sctp_sockstore));
  267                                 SCTP_INP_RUNLOCK(inp);
  268                                 SCTP_INP_INFO_RUNLOCK();
  269                                 error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
  270                                 if (error) {
  271                                         return (error);
  272                                 } else {
  273                                         SCTP_INP_INFO_RLOCK();
  274                                         SCTP_INP_RLOCK(inp);
  275                                 }
  276                         }
  277                 }
  278         } else {
  279                 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
  280                         /* ignore if blacklisted at association level */
  281                         if (stcb && sctp_is_addr_restricted(stcb, laddr->ifa))
  282                                 continue;
  283                         memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
  284                         memcpy((void *)&xladdr.address, (const void *)&laddr->ifa->address, sizeof(union sctp_sockstore));
  285                         xladdr.start_time.tv_sec = (uint32_t) laddr->start_time.tv_sec;
  286                         xladdr.start_time.tv_usec = (uint32_t) laddr->start_time.tv_usec;
  287                         SCTP_INP_RUNLOCK(inp);
  288                         SCTP_INP_INFO_RUNLOCK();
  289                         error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
  290                         if (error) {
  291                                 return (error);
  292                         } else {
  293                                 SCTP_INP_INFO_RLOCK();
  294                                 SCTP_INP_RLOCK(inp);
  295                         }
  296                 }
  297         }
  298         memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
  299         xladdr.last = 1;
  300         SCTP_INP_RUNLOCK(inp);
  301         SCTP_INP_INFO_RUNLOCK();
  302         error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
  303 
  304         if (error) {
  305                 return (error);
  306         } else {
  307                 SCTP_INP_INFO_RLOCK();
  308                 SCTP_INP_RLOCK(inp);
  309                 return (0);
  310         }
  311 }
  312 
  313 /*
  314  * sysctl functions
  315  */
  316 static int
  317 sctp_assoclist(SYSCTL_HANDLER_ARGS)
  318 {
  319         unsigned int number_of_endpoints;
  320         unsigned int number_of_local_addresses;
  321         unsigned int number_of_associations;
  322         unsigned int number_of_remote_addresses;
  323         unsigned int n;
  324         int error;
  325         struct sctp_inpcb *inp;
  326         struct sctp_tcb *stcb;
  327         struct sctp_nets *net;
  328         struct xsctp_inpcb xinpcb;
  329         struct xsctp_tcb xstcb;
  330         struct xsctp_raddr xraddr;
  331 
  332         number_of_endpoints = 0;
  333         number_of_local_addresses = 0;
  334         number_of_associations = 0;
  335         number_of_remote_addresses = 0;
  336 
  337         SCTP_INP_INFO_RLOCK();
  338         if (req->oldptr == USER_ADDR_NULL) {
  339                 LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) {
  340                         SCTP_INP_RLOCK(inp);
  341                         number_of_endpoints++;
  342                         number_of_local_addresses += number_of_addresses(inp);
  343                         LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
  344                                 number_of_associations++;
  345                                 number_of_local_addresses += number_of_addresses(inp);
  346                                 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
  347                                         number_of_remote_addresses++;
  348                                 }
  349                         }
  350                         SCTP_INP_RUNLOCK(inp);
  351                 }
  352                 SCTP_INP_INFO_RUNLOCK();
  353                 n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) +
  354                     (number_of_local_addresses + number_of_endpoints + number_of_associations) * sizeof(struct xsctp_laddr) +
  355                     (number_of_associations + number_of_endpoints) * sizeof(struct xsctp_tcb) +
  356                     (number_of_remote_addresses + number_of_associations) * sizeof(struct xsctp_raddr);
  357 
  358                 /* request some more memory than needed */
  359                 req->oldidx = (n + n / 8);
  360                 return 0;
  361         }
  362         if (req->newptr != USER_ADDR_NULL) {
  363                 SCTP_INP_INFO_RUNLOCK();
  364                 SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_SYSCTL, EPERM);
  365                 return EPERM;
  366         }
  367         LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) {
  368                 SCTP_INP_RLOCK(inp);
  369                 xinpcb.last = 0;
  370                 xinpcb.local_port = ntohs(inp->sctp_lport);
  371                 xinpcb.flags = inp->sctp_flags;
  372                 xinpcb.features = inp->sctp_features;
  373                 xinpcb.total_sends = inp->total_sends;
  374                 xinpcb.total_recvs = inp->total_recvs;
  375                 xinpcb.total_nospaces = inp->total_nospaces;
  376                 xinpcb.fragmentation_point = inp->sctp_frag_point;
  377                 if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
  378                     (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
  379                         xinpcb.qlen = 0;
  380                         xinpcb.maxqlen = 0;
  381                 } else {
  382                         xinpcb.qlen = inp->sctp_socket->so_qlen;
  383                         xinpcb.maxqlen = inp->sctp_socket->so_qlimit;
  384                 }
  385                 SCTP_INP_INCR_REF(inp);
  386                 SCTP_INP_RUNLOCK(inp);
  387                 SCTP_INP_INFO_RUNLOCK();
  388                 error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
  389                 if (error) {
  390                         SCTP_INP_DECR_REF(inp);
  391                         return error;
  392                 }
  393                 SCTP_INP_INFO_RLOCK();
  394                 SCTP_INP_RLOCK(inp);
  395                 error = copy_out_local_addresses(inp, NULL, req);
  396                 if (error) {
  397                         SCTP_INP_DECR_REF(inp);
  398                         return error;
  399                 }
  400                 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
  401                         SCTP_TCB_LOCK(stcb);
  402                         atomic_add_int(&stcb->asoc.refcnt, 1);
  403                         SCTP_TCB_UNLOCK(stcb);
  404                         xstcb.last = 0;
  405                         xstcb.local_port = ntohs(inp->sctp_lport);
  406                         xstcb.remote_port = ntohs(stcb->rport);
  407                         if (stcb->asoc.primary_destination != NULL)
  408                                 xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr;
  409                         xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay;
  410                         xstcb.state = SCTP_GET_STATE(&stcb->asoc);      /* FIXME */
  411                         xstcb.in_streams = stcb->asoc.streamincnt;
  412                         xstcb.out_streams = stcb->asoc.streamoutcnt;
  413                         xstcb.max_nr_retrans = stcb->asoc.overall_error_count;
  414                         xstcb.primary_process = 0;      /* not really supported
  415                                                          * yet */
  416                         xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie;
  417                         xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack;
  418                         xstcb.retransmitted_tsns = stcb->asoc.marked_retrans;
  419                         xstcb.start_time.tv_sec = (uint32_t) stcb->asoc.start_time.tv_sec;
  420                         xstcb.start_time.tv_usec = (uint32_t) stcb->asoc.start_time.tv_usec;
  421                         xstcb.discontinuity_time.tv_sec = (uint32_t) stcb->asoc.discontinuity_time.tv_sec;
  422                         xstcb.discontinuity_time.tv_usec = (uint32_t) stcb->asoc.discontinuity_time.tv_usec;
  423                         xstcb.total_sends = stcb->total_sends;
  424                         xstcb.total_recvs = stcb->total_recvs;
  425                         xstcb.local_tag = stcb->asoc.my_vtag;
  426                         xstcb.remote_tag = stcb->asoc.peer_vtag;
  427                         xstcb.initial_tsn = stcb->asoc.init_seq_number;
  428                         xstcb.highest_tsn = stcb->asoc.sending_seq - 1;
  429                         xstcb.cumulative_tsn = stcb->asoc.last_acked_seq;
  430                         xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn;
  431                         xstcb.mtu = stcb->asoc.smallest_mtu;
  432                         xstcb.refcnt = stcb->asoc.refcnt;
  433                         SCTP_INP_RUNLOCK(inp);
  434                         SCTP_INP_INFO_RUNLOCK();
  435                         error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
  436                         if (error) {
  437                                 SCTP_INP_DECR_REF(inp);
  438                                 atomic_subtract_int(&stcb->asoc.refcnt, 1);
  439                                 return error;
  440                         }
  441                         SCTP_INP_INFO_RLOCK();
  442                         SCTP_INP_RLOCK(inp);
  443                         error = copy_out_local_addresses(inp, stcb, req);
  444                         if (error) {
  445                                 SCTP_INP_DECR_REF(inp);
  446                                 atomic_subtract_int(&stcb->asoc.refcnt, 1);
  447                                 return error;
  448                         }
  449                         TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
  450                                 xraddr.last = 0;
  451                                 xraddr.address = net->ro._l_addr;
  452                                 xraddr.active = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE);
  453                                 xraddr.confirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0);
  454                                 xraddr.heartbeat_enabled = ((net->dest_state & SCTP_ADDR_NOHB) == 0);
  455                                 xraddr.rto = net->RTO;
  456                                 xraddr.max_path_rtx = net->failure_threshold;
  457                                 xraddr.rtx = net->marked_retrans;
  458                                 xraddr.error_counter = net->error_count;
  459                                 xraddr.cwnd = net->cwnd;
  460                                 xraddr.flight_size = net->flight_size;
  461                                 xraddr.mtu = net->mtu;
  462                                 xraddr.start_time.tv_sec = (uint32_t) net->start_time.tv_sec;
  463                                 xraddr.start_time.tv_usec = (uint32_t) net->start_time.tv_usec;
  464                                 SCTP_INP_RUNLOCK(inp);
  465                                 SCTP_INP_INFO_RUNLOCK();
  466                                 error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
  467                                 if (error) {
  468                                         SCTP_INP_DECR_REF(inp);
  469                                         atomic_subtract_int(&stcb->asoc.refcnt, 1);
  470                                         return error;
  471                                 }
  472                                 SCTP_INP_INFO_RLOCK();
  473                                 SCTP_INP_RLOCK(inp);
  474                         }
  475                         atomic_subtract_int(&stcb->asoc.refcnt, 1);
  476                         memset((void *)&xraddr, 0, sizeof(struct xsctp_raddr));
  477                         xraddr.last = 1;
  478                         SCTP_INP_RUNLOCK(inp);
  479                         SCTP_INP_INFO_RUNLOCK();
  480                         error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
  481                         if (error) {
  482                                 SCTP_INP_DECR_REF(inp);
  483                                 return error;
  484                         }
  485                         SCTP_INP_INFO_RLOCK();
  486                         SCTP_INP_RLOCK(inp);
  487                 }
  488                 SCTP_INP_DECR_REF(inp);
  489                 SCTP_INP_RUNLOCK(inp);
  490                 SCTP_INP_INFO_RUNLOCK();
  491                 memset((void *)&xstcb, 0, sizeof(struct xsctp_tcb));
  492                 xstcb.last = 1;
  493                 error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
  494                 if (error) {
  495                         return error;
  496                 }
  497                 SCTP_INP_INFO_RLOCK();
  498         }
  499         SCTP_INP_INFO_RUNLOCK();
  500 
  501         memset((void *)&xinpcb, 0, sizeof(struct xsctp_inpcb));
  502         xinpcb.last = 1;
  503         error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
  504         return error;
  505 }
  506 
  507 
  508 
  509 #define RANGECHK(var, min, max) \
  510         if ((var) < (min)) { (var) = (min); } \
  511         else if ((var) > (max)) { (var) = (max); }
  512 
  513 static int
  514 sysctl_sctp_udp_tunneling_check(SYSCTL_HANDLER_ARGS)
  515 {
  516         int error;
  517         uint32_t old_sctp_udp_tunneling_port;
  518 
  519         old_sctp_udp_tunneling_port = SCTP_BASE_SYSCTL(sctp_udp_tunneling_port);
  520         error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
  521         if (error == 0) {
  522                 RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), SCTPCTL_UDP_TUNNELING_PORT_MIN, SCTPCTL_UDP_TUNNELING_PORT_MAX);
  523                 if (old_sctp_udp_tunneling_port) {
  524                         sctp_over_udp_stop();
  525                 }
  526                 if (SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) {
  527                         if (sctp_over_udp_start()) {
  528                                 SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = 0;
  529                         }
  530                 }
  531         }
  532         return (error);
  533 }
  534 
  535 
  536 static int
  537 sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
  538 {
  539         int error;
  540 
  541         error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
  542         if (error == 0) {
  543                 RANGECHK(SCTP_BASE_SYSCTL(sctp_sendspace), SCTPCTL_MAXDGRAM_MIN, SCTPCTL_MAXDGRAM_MAX);
  544                 RANGECHK(SCTP_BASE_SYSCTL(sctp_recvspace), SCTPCTL_RECVSPACE_MIN, SCTPCTL_RECVSPACE_MAX);
  545 #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
  546                 RANGECHK(SCTP_BASE_SYSCTL(sctp_auto_asconf), SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX);
  547 #endif
  548                 RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX);
  549                 RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_nonce), SCTPCTL_ECN_NONCE_MIN, SCTPCTL_ECN_NONCE_MAX);
  550                 RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX);
  551                 RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX);
  552                 RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_init), SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX);
  553                 RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX);
  554                 RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX);
  555                 RANGECHK(SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), SCTPCTL_MAXCHUNKS_MIN, SCTPCTL_MAXCHUNKS_MAX);
  556                 RANGECHK(SCTP_BASE_SYSCTL(sctp_hashtblsize), SCTPCTL_TCBHASHSIZE_MIN, SCTPCTL_TCBHASHSIZE_MAX);
  557                 RANGECHK(SCTP_BASE_SYSCTL(sctp_pcbtblsize), SCTPCTL_PCBHASHSIZE_MIN, SCTPCTL_PCBHASHSIZE_MAX);
  558                 RANGECHK(SCTP_BASE_SYSCTL(sctp_min_split_point), SCTPCTL_MIN_SPLIT_POINT_MIN, SCTPCTL_MIN_SPLIT_POINT_MAX);
  559                 RANGECHK(SCTP_BASE_SYSCTL(sctp_chunkscale), SCTPCTL_CHUNKSCALE_MIN, SCTPCTL_CHUNKSCALE_MAX);
  560                 RANGECHK(SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default), SCTPCTL_DELAYED_SACK_TIME_MIN, SCTPCTL_DELAYED_SACK_TIME_MAX);
  561                 RANGECHK(SCTP_BASE_SYSCTL(sctp_sack_freq_default), SCTPCTL_SACK_FREQ_MIN, SCTPCTL_SACK_FREQ_MAX);
  562                 RANGECHK(SCTP_BASE_SYSCTL(sctp_system_free_resc_limit), SCTPCTL_SYS_RESOURCE_MIN, SCTPCTL_SYS_RESOURCE_MAX);
  563                 RANGECHK(SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit), SCTPCTL_ASOC_RESOURCE_MIN, SCTPCTL_ASOC_RESOURCE_MAX);
  564                 RANGECHK(SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default), SCTPCTL_HEARTBEAT_INTERVAL_MIN, SCTPCTL_HEARTBEAT_INTERVAL_MAX);
  565                 RANGECHK(SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default), SCTPCTL_PMTU_RAISE_TIME_MIN, SCTPCTL_PMTU_RAISE_TIME_MAX);
  566                 RANGECHK(SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default), SCTPCTL_SHUTDOWN_GUARD_TIME_MIN, SCTPCTL_SHUTDOWN_GUARD_TIME_MAX);
  567                 RANGECHK(SCTP_BASE_SYSCTL(sctp_secret_lifetime_default), SCTPCTL_SECRET_LIFETIME_MIN, SCTPCTL_SECRET_LIFETIME_MAX);
  568                 RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_max_default), SCTPCTL_RTO_MAX_MIN, SCTPCTL_RTO_MAX_MAX);
  569                 RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_min_default), SCTPCTL_RTO_MIN_MIN, SCTPCTL_RTO_MIN_MAX);
  570                 RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_initial_default), SCTPCTL_RTO_INITIAL_MIN, SCTPCTL_RTO_INITIAL_MAX);
  571                 RANGECHK(SCTP_BASE_SYSCTL(sctp_init_rto_max_default), SCTPCTL_INIT_RTO_MAX_MIN, SCTPCTL_INIT_RTO_MAX_MAX);
  572                 RANGECHK(SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default), SCTPCTL_VALID_COOKIE_LIFE_MIN, SCTPCTL_VALID_COOKIE_LIFE_MAX);
  573                 RANGECHK(SCTP_BASE_SYSCTL(sctp_init_rtx_max_default), SCTPCTL_INIT_RTX_MAX_MIN, SCTPCTL_INIT_RTX_MAX_MAX);
  574                 RANGECHK(SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default), SCTPCTL_ASSOC_RTX_MAX_MIN, SCTPCTL_ASSOC_RTX_MAX_MAX);
  575                 RANGECHK(SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), SCTPCTL_PATH_RTX_MAX_MIN, SCTPCTL_PATH_RTX_MAX_MAX);
  576                 RANGECHK(SCTP_BASE_SYSCTL(sctp_add_more_threshold), SCTPCTL_ADD_MORE_ON_OUTPUT_MIN, SCTPCTL_ADD_MORE_ON_OUTPUT_MAX);
  577                 RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), SCTPCTL_OUTGOING_STREAMS_MIN, SCTPCTL_OUTGOING_STREAMS_MAX);
  578                 RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_on_off), SCTPCTL_CMT_ON_OFF_MIN, SCTPCTL_CMT_ON_OFF_MAX);
  579                 /* EY */
  580                 RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), SCTPCTL_NR_SACK_ON_OFF_MIN, SCTPCTL_NR_SACK_ON_OFF_MAX);
  581                 RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_use_dac), SCTPCTL_CMT_USE_DAC_MIN, SCTPCTL_CMT_USE_DAC_MAX);
  582                 RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_pf), SCTPCTL_CMT_PF_MIN, SCTPCTL_CMT_PF_MAX);
  583                 RANGECHK(SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), SCTPCTL_CWND_MAXBURST_MIN, SCTPCTL_CWND_MAXBURST_MAX);
  584                 RANGECHK(SCTP_BASE_SYSCTL(sctp_early_fr), SCTPCTL_EARLY_FAST_RETRAN_MIN, SCTPCTL_EARLY_FAST_RETRAN_MAX);
  585                 RANGECHK(SCTP_BASE_SYSCTL(sctp_early_fr_msec), SCTPCTL_EARLY_FAST_RETRAN_MSEC_MIN, SCTPCTL_EARLY_FAST_RETRAN_MSEC_MAX);
  586                 RANGECHK(SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), SCTPCTL_ASCONF_AUTH_NOCHK_MIN, SCTPCTL_ASCONF_AUTH_NOCHK_MAX);
  587                 RANGECHK(SCTP_BASE_SYSCTL(sctp_auth_disable), SCTPCTL_AUTH_DISABLE_MIN, SCTPCTL_AUTH_DISABLE_MAX);
  588                 RANGECHK(SCTP_BASE_SYSCTL(sctp_nat_friendly), SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX);
  589                 RANGECHK(SCTP_BASE_SYSCTL(sctp_L2_abc_variable), SCTPCTL_ABC_L_VAR_MIN, SCTPCTL_ABC_L_VAR_MAX);
  590                 RANGECHK(SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count), SCTPCTL_MAX_CHAINED_MBUFS_MIN, SCTPCTL_MAX_CHAINED_MBUFS_MAX);
  591                 RANGECHK(SCTP_BASE_SYSCTL(sctp_do_drain), SCTPCTL_DO_SCTP_DRAIN_MIN, SCTPCTL_DO_SCTP_DRAIN_MAX);
  592                 RANGECHK(SCTP_BASE_SYSCTL(sctp_hb_maxburst), SCTPCTL_HB_MAX_BURST_MIN, SCTPCTL_HB_MAX_BURST_MAX);
  593                 RANGECHK(SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit), SCTPCTL_ABORT_AT_LIMIT_MIN, SCTPCTL_ABORT_AT_LIMIT_MAX);
  594                 RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_data_order), SCTPCTL_STRICT_DATA_ORDER_MIN, SCTPCTL_STRICT_DATA_ORDER_MAX);
  595                 RANGECHK(SCTP_BASE_SYSCTL(sctp_min_residual), SCTPCTL_MIN_RESIDUAL_MIN, SCTPCTL_MIN_RESIDUAL_MAX);
  596                 RANGECHK(SCTP_BASE_SYSCTL(sctp_max_retran_chunk), SCTPCTL_MAX_RETRAN_CHUNK_MIN, SCTPCTL_MAX_RETRAN_CHUNK_MAX);
  597                 RANGECHK(SCTP_BASE_SYSCTL(sctp_logging_level), SCTPCTL_LOGGING_LEVEL_MIN, SCTPCTL_LOGGING_LEVEL_MAX);
  598                 RANGECHK(SCTP_BASE_SYSCTL(sctp_default_cc_module), SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX);
  599                 RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX);
  600 #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
  601                 RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX);
  602 #endif
  603 #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF)
  604                 RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX);
  605 #endif
  606                 RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable), SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MIN, SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MAX);
  607                 RANGECHK(SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), SCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN, SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX);
  608                 RANGECHK(SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX);
  609 
  610 #ifdef SCTP_DEBUG
  611                 RANGECHK(SCTP_BASE_SYSCTL(sctp_debug_on), SCTPCTL_DEBUG_MIN, SCTPCTL_DEBUG_MAX);
  612 #endif
  613 #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
  614                 RANGECHK(SCTP_BASE_SYSCTL(sctp_output_unlocked), SCTPCTL_OUTPUT_UNLOCKED_MIN, SCTPCTL_OUTPUT_UNLOCKED_MAX);
  615 #endif
  616         }
  617         return (error);
  618 }
  619 
  620 
  621 
  622 #if defined(SCTP_LOCAL_TRACE_BUF)
  623 static int
  624 sysctl_sctp_cleartrace(SYSCTL_HANDLER_ARGS)
  625 {
  626         memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
  627         return (0);
  628 }
  629 
  630 #endif
  631 
  632 
  633 
  634 /*
  635  * sysctl definitions
  636  */
  637 
  638 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sendspace, CTLTYPE_INT | CTLFLAG_RW,
  639     &SCTP_BASE_SYSCTL(sctp_sendspace), 0, sysctl_sctp_check, "IU",
  640     SCTPCTL_MAXDGRAM_DESC);
  641 
  642 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, recvspace, CTLTYPE_INT | CTLFLAG_RW,
  643     &SCTP_BASE_SYSCTL(sctp_recvspace), 0, sysctl_sctp_check, "IU",
  644     SCTPCTL_RECVSPACE_DESC);
  645 
  646 #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
  647 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auto_asconf, CTLTYPE_INT | CTLFLAG_RW,
  648     &SCTP_BASE_SYSCTL(sctp_auto_asconf), 0, sysctl_sctp_check, "IU",
  649     SCTPCTL_AUTOASCONF_DESC);
  650 #endif
  651 
  652 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_enable, CTLTYPE_INT | CTLFLAG_RW,
  653     &SCTP_BASE_SYSCTL(sctp_ecn_enable), 0, sysctl_sctp_check, "IU",
  654     SCTPCTL_ECN_ENABLE_DESC);
  655 
  656 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_nonce, CTLTYPE_INT | CTLFLAG_RW,
  657     &SCTP_BASE_SYSCTL(sctp_ecn_nonce), 0, sysctl_sctp_check, "IU",
  658     SCTPCTL_ECN_NONCE_DESC);
  659 
  660 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_INT | CTLFLAG_RW,
  661     &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU",
  662     SCTPCTL_STRICT_SACKS_DESC);
  663 
  664 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_INT | CTLFLAG_RW,
  665     &SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), 0, sysctl_sctp_check, "IU",
  666     SCTPCTL_LOOPBACK_NOCSUM_DESC);
  667 
  668 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_INT | CTLFLAG_RW,
  669     &SCTP_BASE_SYSCTL(sctp_strict_init), 0, sysctl_sctp_check, "IU",
  670     SCTPCTL_STRICT_INIT_DESC);
  671 
  672 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_INT | CTLFLAG_RW,
  673     &SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), 0, sysctl_sctp_check, "IU",
  674     SCTPCTL_PEER_CHKOH_DESC);
  675 
  676 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxburst, CTLTYPE_INT | CTLFLAG_RW,
  677     &SCTP_BASE_SYSCTL(sctp_max_burst_default), 0, sysctl_sctp_check, "IU",
  678     SCTPCTL_MAXBURST_DESC);
  679 
  680 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxchunks, CTLTYPE_INT | CTLFLAG_RW,
  681     &SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), 0, sysctl_sctp_check, "IU",
  682     SCTPCTL_MAXCHUNKS_DESC);
  683 
  684 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, tcbhashsize, CTLTYPE_INT | CTLFLAG_RW,
  685     &SCTP_BASE_SYSCTL(sctp_hashtblsize), 0, sysctl_sctp_check, "IU",
  686     SCTPCTL_TCBHASHSIZE_DESC);
  687 
  688 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pcbhashsize, CTLTYPE_INT | CTLFLAG_RW,
  689     &SCTP_BASE_SYSCTL(sctp_pcbtblsize), 0, sysctl_sctp_check, "IU",
  690     SCTPCTL_PCBHASHSIZE_DESC);
  691 
  692 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_split_point, CTLTYPE_INT | CTLFLAG_RW,
  693     &SCTP_BASE_SYSCTL(sctp_min_split_point), 0, sysctl_sctp_check, "IU",
  694     SCTPCTL_MIN_SPLIT_POINT_DESC);
  695 
  696 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, chunkscale, CTLTYPE_INT | CTLFLAG_RW,
  697     &SCTP_BASE_SYSCTL(sctp_chunkscale), 0, sysctl_sctp_check, "IU",
  698     SCTPCTL_CHUNKSCALE_DESC);
  699 
  700 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, delayed_sack_time, CTLTYPE_INT | CTLFLAG_RW,
  701     &SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default), 0, sysctl_sctp_check, "IU",
  702     SCTPCTL_DELAYED_SACK_TIME_DESC);
  703 
  704 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sack_freq, CTLTYPE_INT | CTLFLAG_RW,
  705     &SCTP_BASE_SYSCTL(sctp_sack_freq_default), 0, sysctl_sctp_check, "IU",
  706     SCTPCTL_SACK_FREQ_DESC);
  707 
  708 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sys_resource, CTLTYPE_INT | CTLFLAG_RW,
  709     &SCTP_BASE_SYSCTL(sctp_system_free_resc_limit), 0, sysctl_sctp_check, "IU",
  710     SCTPCTL_SYS_RESOURCE_DESC);
  711 
  712 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asoc_resource, CTLTYPE_INT | CTLFLAG_RW,
  713     &SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit), 0, sysctl_sctp_check, "IU",
  714     SCTPCTL_ASOC_RESOURCE_DESC);
  715 
  716 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, heartbeat_interval, CTLTYPE_INT | CTLFLAG_RW,
  717     &SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default), 0, sysctl_sctp_check, "IU",
  718     SCTPCTL_HEARTBEAT_INTERVAL_DESC);
  719 
  720 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pmtu_raise_time, CTLTYPE_INT | CTLFLAG_RW,
  721     &SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default), 0, sysctl_sctp_check, "IU",
  722     SCTPCTL_PMTU_RAISE_TIME_DESC);
  723 
  724 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, shutdown_guard_time, CTLTYPE_INT | CTLFLAG_RW,
  725     &SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default), 0, sysctl_sctp_check, "IU",
  726     SCTPCTL_SHUTDOWN_GUARD_TIME_DESC);
  727 
  728 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, secret_lifetime, CTLTYPE_INT | CTLFLAG_RW,
  729     &SCTP_BASE_SYSCTL(sctp_secret_lifetime_default), 0, sysctl_sctp_check, "IU",
  730     SCTPCTL_SECRET_LIFETIME_DESC);
  731 
  732 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_max, CTLTYPE_INT | CTLFLAG_RW,
  733     &SCTP_BASE_SYSCTL(sctp_rto_max_default), 0, sysctl_sctp_check, "IU",
  734     SCTPCTL_RTO_MAX_DESC);
  735 
  736 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_min, CTLTYPE_INT | CTLFLAG_RW,
  737     &SCTP_BASE_SYSCTL(sctp_rto_min_default), 0, sysctl_sctp_check, "IU",
  738     SCTPCTL_RTO_MIN_DESC);
  739 
  740 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_initial, CTLTYPE_INT | CTLFLAG_RW,
  741     &SCTP_BASE_SYSCTL(sctp_rto_initial_default), 0, sysctl_sctp_check, "IU",
  742     SCTPCTL_RTO_INITIAL_DESC);
  743 
  744 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rto_max, CTLTYPE_INT | CTLFLAG_RW,
  745     &SCTP_BASE_SYSCTL(sctp_init_rto_max_default), 0, sysctl_sctp_check, "IU",
  746     SCTPCTL_INIT_RTO_MAX_DESC);
  747 
  748 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, valid_cookie_life, CTLTYPE_INT | CTLFLAG_RW,
  749     &SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default), 0, sysctl_sctp_check, "IU",
  750     SCTPCTL_VALID_COOKIE_LIFE_DESC);
  751 
  752 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
  753     &SCTP_BASE_SYSCTL(sctp_init_rtx_max_default), 0, sysctl_sctp_check, "IU",
  754     SCTPCTL_INIT_RTX_MAX_DESC);
  755 
  756 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoc_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
  757     &SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default), 0, sysctl_sctp_check, "IU",
  758     SCTPCTL_ASSOC_RTX_MAX_DESC);
  759 
  760 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, path_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
  761     &SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), 0, sysctl_sctp_check, "IU",
  762     SCTPCTL_PATH_RTX_MAX_DESC);
  763 
  764 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, add_more_on_output, CTLTYPE_INT | CTLFLAG_RW,
  765     &SCTP_BASE_SYSCTL(sctp_add_more_threshold), 0, sysctl_sctp_check, "IU",
  766     SCTPCTL_ADD_MORE_ON_OUTPUT_DESC);
  767 
  768 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLTYPE_INT | CTLFLAG_RW,
  769     &SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), 0, sysctl_sctp_check, "IU",
  770     SCTPCTL_OUTGOING_STREAMS_DESC);
  771 
  772 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLTYPE_INT | CTLFLAG_RW,
  773     &SCTP_BASE_SYSCTL(sctp_cmt_on_off), 0, sysctl_sctp_check, "IU",
  774     SCTPCTL_CMT_ON_OFF_DESC);
  775 
  776 /* EY */
  777 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nr_sack_on_off, CTLTYPE_INT | CTLFLAG_RW,
  778     &SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), 0, sysctl_sctp_check, "IU",
  779     SCTPCTL_NR_SACK_ON_OFF_DESC);
  780 
  781 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLTYPE_INT | CTLFLAG_RW,
  782     &SCTP_BASE_SYSCTL(sctp_cmt_use_dac), 0, sysctl_sctp_check, "IU",
  783     SCTPCTL_CMT_USE_DAC_DESC);
  784 
  785 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_pf, CTLTYPE_INT | CTLFLAG_RW,
  786     &SCTP_BASE_SYSCTL(sctp_cmt_pf), 0, sysctl_sctp_check, "IU",
  787     SCTPCTL_CMT_PF_DESC);
  788 
  789 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cwnd_maxburst, CTLTYPE_INT | CTLFLAG_RW,
  790     &SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), 0, sysctl_sctp_check, "IU",
  791     SCTPCTL_CWND_MAXBURST_DESC);
  792 
  793 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran, CTLTYPE_INT | CTLFLAG_RW,
  794     &SCTP_BASE_SYSCTL(sctp_early_fr), 0, sysctl_sctp_check, "IU",
  795     SCTPCTL_EARLY_FAST_RETRAN_DESC);
  796 
  797 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran_msec, CTLTYPE_INT | CTLFLAG_RW,
  798     &SCTP_BASE_SYSCTL(sctp_early_fr_msec), 0, sysctl_sctp_check, "IU",
  799     SCTPCTL_EARLY_FAST_RETRAN_MSEC_DESC);
  800 
  801 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLTYPE_INT | CTLFLAG_RW,
  802     &SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), 0, sysctl_sctp_check, "IU",
  803     SCTPCTL_ASCONF_AUTH_NOCHK_DESC);
  804 
  805 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auth_disable, CTLTYPE_INT | CTLFLAG_RW,
  806     &SCTP_BASE_SYSCTL(sctp_auth_disable), 0, sysctl_sctp_check, "IU",
  807     SCTPCTL_AUTH_DISABLE_DESC);
  808 
  809 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nat_friendly, CTLTYPE_INT | CTLFLAG_RW,
  810     &SCTP_BASE_SYSCTL(sctp_nat_friendly), 0, sysctl_sctp_check, "IU",
  811     SCTPCTL_NAT_FRIENDLY_DESC);
  812 
  813 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abc_l_var, CTLTYPE_INT | CTLFLAG_RW,
  814     &SCTP_BASE_SYSCTL(sctp_L2_abc_variable), 0, sysctl_sctp_check, "IU",
  815     SCTPCTL_ABC_L_VAR_DESC);
  816 
  817 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_chained_mbufs, CTLTYPE_INT | CTLFLAG_RW,
  818     &SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count), 0, sysctl_sctp_check, "IU",
  819     SCTPCTL_MAX_CHAINED_MBUFS_DESC);
  820 
  821 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, do_sctp_drain, CTLTYPE_INT | CTLFLAG_RW,
  822     &SCTP_BASE_SYSCTL(sctp_do_drain), 0, sysctl_sctp_check, "IU",
  823     SCTPCTL_DO_SCTP_DRAIN_DESC);
  824 
  825 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, hb_max_burst, CTLTYPE_INT | CTLFLAG_RW,
  826     &SCTP_BASE_SYSCTL(sctp_hb_maxburst), 0, sysctl_sctp_check, "IU",
  827     SCTPCTL_HB_MAX_BURST_DESC);
  828 
  829 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abort_at_limit, CTLTYPE_INT | CTLFLAG_RW,
  830     &SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit), 0, sysctl_sctp_check, "IU",
  831     SCTPCTL_ABORT_AT_LIMIT_DESC);
  832 
  833 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_data_order, CTLTYPE_INT | CTLFLAG_RW,
  834     &SCTP_BASE_SYSCTL(sctp_strict_data_order), 0, sysctl_sctp_check, "IU",
  835     SCTPCTL_STRICT_DATA_ORDER_DESC);
  836 
  837 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_residual, CTLTYPE_INT | CTLFLAG_RW,
  838     &SCTP_BASE_SYSCTL(sctp_min_residual), 0, sysctl_sctp_check, "IU",
  839     SCTPCTL_MIN_RESIDUAL_DESC);
  840 
  841 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLTYPE_INT | CTLFLAG_RW,
  842     &SCTP_BASE_SYSCTL(sctp_max_retran_chunk), 0, sysctl_sctp_check, "IU",
  843     SCTPCTL_MAX_RETRAN_CHUNK_DESC);
  844 
  845 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, log_level, CTLTYPE_INT | CTLFLAG_RW,
  846     &SCTP_BASE_SYSCTL(sctp_logging_level), 0, sysctl_sctp_check, "IU",
  847     SCTPCTL_LOGGING_LEVEL_DESC);
  848 
  849 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_cc_module, CTLTYPE_INT | CTLFLAG_RW,
  850     &SCTP_BASE_SYSCTL(sctp_default_cc_module), 0, sysctl_sctp_check, "IU",
  851     SCTPCTL_DEFAULT_CC_MODULE_DESC);
  852 
  853 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_frag_interleave, CTLTYPE_INT | CTLFLAG_RW,
  854     &SCTP_BASE_SYSCTL(sctp_default_frag_interleave), 0, sysctl_sctp_check, "IU",
  855     SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DESC);
  856 
  857 #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
  858 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_base, CTLTYPE_INT | CTLFLAG_RW,
  859     &SCTP_BASE_SYSCTL(sctp_mobility_base), 0, sysctl_sctp_check, "IU",
  860     SCTPCTL_MOBILITY_BASE_DESC);
  861 #endif
  862 
  863 #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF)
  864 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_fasthandoff, CTLTYPE_INT | CTLFLAG_RW,
  865     &SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), 0, sysctl_sctp_check, "IU",
  866     SCTPCTL_MOBILITY_FASTHANDOFF_DESC);
  867 #endif
  868 
  869 #if defined(SCTP_LOCAL_TRACE_BUF)
  870 SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, log, CTLFLAG_RD,
  871     &SCTP_BASE_SYSCTL(sctp_log), sctp_log,
  872     "SCTP logging (struct sctp_log)");
  873 
  874 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, clear_trace, CTLTYPE_OPAQUE | CTLFLAG_RW,
  875     &SCTP_BASE_SYSCTL(sctp_log), 0, sysctl_sctp_cleartrace, "IU",
  876     "Clear SCTP Logging buffer");
  877 
  878 
  879 
  880 #endif
  881 
  882 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_for_client_enable, CTLTYPE_INT | CTLFLAG_RW,
  883     &SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable), 0, sysctl_sctp_check, "IU",
  884     SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_DESC);
  885 
  886 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_port, CTLTYPE_INT | CTLFLAG_RW,
  887     &SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), 0, sysctl_sctp_udp_tunneling_check, "IU",
  888     SCTPCTL_UDP_TUNNELING_PORT_DESC);
  889 
  890 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, enable_sack_immediately, CTLTYPE_INT | CTLFLAG_RW,
  891     &SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), 0, sysctl_sctp_check, "IU",
  892     SCTPCTL_SACK_IMMEDIATELY_ENABLE_DESC);
  893 
  894 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nat_friendly_init, CTLTYPE_INT | CTLFLAG_RW,
  895     &SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), 0, sysctl_sctp_check, "IU",
  896     SCTPCTL_NAT_FRIENDLY_DESC);
  897 
  898 #ifdef SCTP_DEBUG
  899 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW,
  900     &SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU",
  901     SCTPCTL_DEBUG_DESC);
  902 #endif                          /* SCTP_DEBUG */
  903 
  904 
  905 #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
  906 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, output_unlocked, CTLTYPE_INT | CTLFLAG_RW,
  907     &SCTP_BASE_SYSCTL(sctp_output_unlocked), 0, sysctl_sctp_check, "IU",
  908     SCTPCTL_OUTPUT_UNLOCKED_DESC);
  909 #endif
  910 
  911 SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW,
  912     &SCTP_BASE_STATS, sctpstat,
  913     "SCTP statistics (struct sctp_stat)");
  914 
  915 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD,
  916     0, 0, sctp_assoclist,
  917     "S,xassoc", "List of active SCTP associations");

Cache object: 66cc2fbd91f3efad1e3cf28fb3e341bd


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