142551e99SRandall Stewart /*- 2b1006367SRandall Stewart * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved. 35d40cf5dSRandall Stewart * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. 45d40cf5dSRandall Stewart * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. 542551e99SRandall Stewart * 642551e99SRandall Stewart * Redistribution and use in source and binary forms, with or without 742551e99SRandall Stewart * modification, are permitted provided that the following conditions are met: 842551e99SRandall Stewart * 942551e99SRandall Stewart * a) Redistributions of source code must retain the above copyright notice, 1042551e99SRandall Stewart * this list of conditions and the following disclaimer. 1142551e99SRandall Stewart * 1242551e99SRandall Stewart * b) Redistributions in binary form must reproduce the above copyright 1342551e99SRandall Stewart * notice, this list of conditions and the following disclaimer in 1442551e99SRandall Stewart * the documentation and/or other materials provided with the distribution. 1542551e99SRandall Stewart * 1642551e99SRandall Stewart * c) Neither the name of Cisco Systems, Inc. nor the names of its 1742551e99SRandall Stewart * contributors may be used to endorse or promote products derived 1842551e99SRandall Stewart * from this software without specific prior written permission. 1942551e99SRandall Stewart * 2042551e99SRandall Stewart * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2142551e99SRandall Stewart * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 2242551e99SRandall Stewart * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2342551e99SRandall Stewart * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2442551e99SRandall Stewart * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2542551e99SRandall Stewart * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2642551e99SRandall Stewart * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2742551e99SRandall Stewart * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2842551e99SRandall Stewart * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2942551e99SRandall Stewart * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 3042551e99SRandall Stewart * THE POSSIBILITY OF SUCH DAMAGE. 3142551e99SRandall Stewart */ 3242551e99SRandall Stewart 3342551e99SRandall Stewart #include <sys/cdefs.h> 3442551e99SRandall Stewart __FBSDID("$FreeBSD$"); 3542551e99SRandall Stewart 3642551e99SRandall Stewart #include <netinet/sctp_os.h> 37b3f1ea41SRandall Stewart #include <netinet/sctp.h> 3842551e99SRandall Stewart #include <netinet/sctp_constants.h> 3942551e99SRandall Stewart #include <netinet/sctp_sysctl.h> 4042551e99SRandall Stewart #include <netinet/sctp_pcb.h> 4142551e99SRandall Stewart #include <netinet/sctputil.h> 42d61a0ae0SRandall Stewart #include <netinet/sctp_output.h> 43ff014514SRandall Stewart #include <sys/smp.h> 44b3f1ea41SRandall Stewart 4542551e99SRandall Stewart /* 4642551e99SRandall Stewart * sysctl tunable variables 4742551e99SRandall Stewart */ 485e54f665SRandall Stewart 49b3f1ea41SRandall Stewart void 50b3f1ea41SRandall Stewart sctp_init_sysctls() 51b3f1ea41SRandall Stewart { 52b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_sendspace) = SCTPCTL_MAXDGRAM_DEFAULT; 53b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_recvspace) = SCTPCTL_RECVSPACE_DEFAULT; 54b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_auto_asconf) = SCTPCTL_AUTOASCONF_DEFAULT; 55b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_multiple_asconfs) = SCTPCTL_MULTIPLEASCONFS_DEFAULT; 56b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT; 57b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT; 589c7635e1SMichael Tuexen #if !defined(SCTP_WITH_NO_CSUM) 59b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT; 609c7635e1SMichael Tuexen #endif 61b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_strict_init) = SCTPCTL_STRICT_INIT_DEFAULT; 62b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT; 63b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT; 64899288aeSRandall Stewart SCTP_BASE_SYSCTL(sctp_fr_max_burst_default) = SCTPCTL_FRMAXBURST_DEFAULT; 65b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue) = SCTPCTL_MAXCHUNKS_DEFAULT; 66b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_hashtblsize) = SCTPCTL_TCBHASHSIZE_DEFAULT; 67b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_pcbtblsize) = SCTPCTL_PCBHASHSIZE_DEFAULT; 68b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_min_split_point) = SCTPCTL_MIN_SPLIT_POINT_DEFAULT; 69b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_chunkscale) = SCTPCTL_CHUNKSCALE_DEFAULT; 70b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default) = SCTPCTL_DELAYED_SACK_TIME_DEFAULT; 71b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_sack_freq_default) = SCTPCTL_SACK_FREQ_DEFAULT; 72b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_system_free_resc_limit) = SCTPCTL_SYS_RESOURCE_DEFAULT; 73b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit) = SCTPCTL_ASOC_RESOURCE_DEFAULT; 74b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default) = SCTPCTL_HEARTBEAT_INTERVAL_DEFAULT; 75b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default) = SCTPCTL_PMTU_RAISE_TIME_DEFAULT; 76b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default) = SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULT; 77b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_secret_lifetime_default) = SCTPCTL_SECRET_LIFETIME_DEFAULT; 78b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_rto_max_default) = SCTPCTL_RTO_MAX_DEFAULT; 79b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_rto_min_default) = SCTPCTL_RTO_MIN_DEFAULT; 80b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_rto_initial_default) = SCTPCTL_RTO_INITIAL_DEFAULT; 81b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_init_rto_max_default) = SCTPCTL_INIT_RTO_MAX_DEFAULT; 82b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default) = SCTPCTL_VALID_COOKIE_LIFE_DEFAULT; 83b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_init_rtx_max_default) = SCTPCTL_INIT_RTX_MAX_DEFAULT; 84b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default) = SCTPCTL_ASSOC_RTX_MAX_DEFAULT; 85b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_path_rtx_max_default) = SCTPCTL_PATH_RTX_MAX_DEFAULT; 86ca85e948SMichael Tuexen SCTP_BASE_SYSCTL(sctp_path_pf_threshold) = SCTPCTL_PATH_PF_THRESHOLD_DEFAULT; 87b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_add_more_threshold) = SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT; 88b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default) = SCTPCTL_OUTGOING_STREAMS_DEFAULT; 89b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_cmt_on_off) = SCTPCTL_CMT_ON_OFF_DEFAULT; 90830d754dSRandall Stewart /* EY */ 91830d754dSRandall Stewart SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) = SCTPCTL_NR_SACK_ON_OFF_DEFAULT; 92b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_cmt_use_dac) = SCTPCTL_CMT_USE_DAC_DEFAULT; 93b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst) = SCTPCTL_CWND_MAXBURST_DEFAULT; 94b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk) = SCTPCTL_ASCONF_AUTH_NOCHK_DEFAULT; 95b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_auth_disable) = SCTPCTL_AUTH_DISABLE_DEFAULT; 96b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_nat_friendly) = SCTPCTL_NAT_FRIENDLY_DEFAULT; 97b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_L2_abc_variable) = SCTPCTL_ABC_L_VAR_DEFAULT; 98b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count) = SCTPCTL_MAX_CHAINED_MBUFS_DEFAULT; 99b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_do_drain) = SCTPCTL_DO_SCTP_DRAIN_DEFAULT; 100b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_hb_maxburst) = SCTPCTL_HB_MAX_BURST_DEFAULT; 101b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit) = SCTPCTL_ABORT_AT_LIMIT_DEFAULT; 102b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_strict_data_order) = SCTPCTL_STRICT_DATA_ORDER_DEFAULT; 103b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_min_residual) = SCTPCTL_MIN_RESIDUAL_DEFAULT; 104b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_max_retran_chunk) = SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT; 105b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_logging_level) = SCTPCTL_LOGGING_LEVEL_DEFAULT; 106b54d3a6cSRandall Stewart /* JRS - Variable for default congestion control module */ 107b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_default_cc_module) = SCTPCTL_DEFAULT_CC_MODULE_DEFAULT; 108f7a77f6fSMichael Tuexen /* RS - Variable for default stream scheduling module */ 109f7a77f6fSMichael Tuexen SCTP_BASE_SYSCTL(sctp_default_ss_module) = SCTPCTL_DEFAULT_SS_MODULE_DEFAULT; 110b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_default_frag_interleave) = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT; 111b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_mobility_base) = SCTPCTL_MOBILITY_BASE_DEFAULT; 112b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT; 113a16ccdceSRandall Stewart SCTP_BASE_SYSCTL(sctp_vtag_time_wait) = SCTPCTL_TIME_WAIT_DEFAULT; 11425a2a187SMichael Tuexen SCTP_BASE_SYSCTL(sctp_buffer_splitting) = SCTPCTL_BUFFER_SPLITTING_DEFAULT; 115dcfc0625SMichael Tuexen SCTP_BASE_SYSCTL(sctp_initial_cwnd) = SCTPCTL_INITIAL_CWND_DEFAULT; 116299108c5SRandall Stewart SCTP_BASE_SYSCTL(sctp_rttvar_bw) = SCTPCTL_RTTVAR_BW_DEFAULT; 117299108c5SRandall Stewart SCTP_BASE_SYSCTL(sctp_rttvar_rtt) = SCTPCTL_RTTVAR_RTT_DEFAULT; 118299108c5SRandall Stewart SCTP_BASE_SYSCTL(sctp_rttvar_eqret) = SCTPCTL_RTTVAR_EQRET_DEFAULT; 119f79aab18SRandall Stewart SCTP_BASE_SYSCTL(sctp_steady_step) = SCTPCTL_RTTVAR_STEADYS_DEFAULT; 120f79aab18SRandall Stewart SCTP_BASE_SYSCTL(sctp_use_dccc_ecn) = SCTPCTL_RTTVAR_DCCCECN_DEFAULT; 121f79aab18SRandall Stewart 122b27a6b7dSRandall Stewart #if defined(SCTP_LOCAL_TRACE_BUF) 123b3f1ea41SRandall Stewart memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); 124b27a6b7dSRandall Stewart #endif 125b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = SCTPCTL_UDP_TUNNELING_PORT_DEFAULT; 126b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_enable_sack_immediately) = SCTPCTL_SACK_IMMEDIATELY_ENABLE_DEFAULT; 127bf3d5177SMichael Tuexen SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly) = SCTPCTL_NAT_FRIENDLY_INITS_DEFAULT; 128b3f1ea41SRandall Stewart #if defined(SCTP_DEBUG) 129b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_debug_on) = SCTPCTL_DEBUG_DEFAULT; 13042551e99SRandall Stewart #endif 131b3f1ea41SRandall Stewart #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 132b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_output_unlocked) = SCTPCTL_OUTPUT_UNLOCKED_DEFAULT; 133b3f1ea41SRandall Stewart #endif 134b3f1ea41SRandall Stewart } 135d61a0ae0SRandall Stewart 136a99b6783SRandall Stewart 137d61a0ae0SRandall Stewart /* It returns an upper limit. No filtering is done here */ 138d61a0ae0SRandall Stewart static unsigned int 139d61a0ae0SRandall Stewart number_of_addresses(struct sctp_inpcb *inp) 140d61a0ae0SRandall Stewart { 141*7215cc1bSMichael Tuexen unsigned int cnt; 142d61a0ae0SRandall Stewart struct sctp_vrf *vrf; 143d61a0ae0SRandall Stewart struct sctp_ifn *sctp_ifn; 144d61a0ae0SRandall Stewart struct sctp_ifa *sctp_ifa; 145d61a0ae0SRandall Stewart struct sctp_laddr *laddr; 146d61a0ae0SRandall Stewart 147d61a0ae0SRandall Stewart cnt = 0; 148d61a0ae0SRandall Stewart /* neither Mac OS X nor FreeBSD support mulitple routing functions */ 149d61a0ae0SRandall Stewart if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) { 150d61a0ae0SRandall Stewart return (0); 151d61a0ae0SRandall Stewart } 152d61a0ae0SRandall Stewart if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { 153d61a0ae0SRandall Stewart LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { 154d61a0ae0SRandall Stewart LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) { 155e6194c2eSMichael Tuexen switch (sctp_ifa->address.sa.sa_family) { 156e6194c2eSMichael Tuexen #ifdef INET 157e6194c2eSMichael Tuexen case AF_INET: 158e6194c2eSMichael Tuexen #endif 159e6194c2eSMichael Tuexen #ifdef INET6 160e6194c2eSMichael Tuexen case AF_INET6: 161e6194c2eSMichael Tuexen #endif 162d61a0ae0SRandall Stewart cnt++; 163e6194c2eSMichael Tuexen break; 164e6194c2eSMichael Tuexen default: 165e6194c2eSMichael Tuexen break; 166d61a0ae0SRandall Stewart } 167d61a0ae0SRandall Stewart } 168d61a0ae0SRandall Stewart } 169d61a0ae0SRandall Stewart } else { 170d61a0ae0SRandall Stewart LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { 171e6194c2eSMichael Tuexen switch (laddr->ifa->address.sa.sa_family) { 172e6194c2eSMichael Tuexen #ifdef INET 173e6194c2eSMichael Tuexen case AF_INET: 174e6194c2eSMichael Tuexen #endif 175e6194c2eSMichael Tuexen #ifdef INET6 176e6194c2eSMichael Tuexen case AF_INET6: 177e6194c2eSMichael Tuexen #endif 178d61a0ae0SRandall Stewart cnt++; 179e6194c2eSMichael Tuexen break; 180e6194c2eSMichael Tuexen default: 181e6194c2eSMichael Tuexen break; 182d61a0ae0SRandall Stewart } 183d61a0ae0SRandall Stewart } 184d61a0ae0SRandall Stewart } 185d61a0ae0SRandall Stewart return (cnt); 186d61a0ae0SRandall Stewart } 187d61a0ae0SRandall Stewart 188d61a0ae0SRandall Stewart static int 189d61a0ae0SRandall Stewart copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sysctl_req *req) 190d61a0ae0SRandall Stewart { 191d61a0ae0SRandall Stewart struct sctp_ifn *sctp_ifn; 192d61a0ae0SRandall Stewart struct sctp_ifa *sctp_ifa; 193d61a0ae0SRandall Stewart int loopback_scope, ipv4_local_scope, local_scope, site_scope; 194d61a0ae0SRandall Stewart int ipv4_addr_legal, ipv6_addr_legal; 195d61a0ae0SRandall Stewart struct sctp_vrf *vrf; 196d61a0ae0SRandall Stewart struct xsctp_laddr xladdr; 197d61a0ae0SRandall Stewart struct sctp_laddr *laddr; 198d61a0ae0SRandall Stewart int error; 199d61a0ae0SRandall Stewart 200d61a0ae0SRandall Stewart /* Turn on all the appropriate scope */ 201d61a0ae0SRandall Stewart if (stcb) { 202d61a0ae0SRandall Stewart /* use association specific values */ 203d61a0ae0SRandall Stewart loopback_scope = stcb->asoc.loopback_scope; 204d61a0ae0SRandall Stewart ipv4_local_scope = stcb->asoc.ipv4_local_scope; 205d61a0ae0SRandall Stewart local_scope = stcb->asoc.local_scope; 206d61a0ae0SRandall Stewart site_scope = stcb->asoc.site_scope; 207d61a0ae0SRandall Stewart } else { 208d61a0ae0SRandall Stewart /* use generic values for endpoints */ 209d61a0ae0SRandall Stewart loopback_scope = 1; 210d61a0ae0SRandall Stewart ipv4_local_scope = 1; 211d61a0ae0SRandall Stewart local_scope = 1; 212d61a0ae0SRandall Stewart site_scope = 1; 213d61a0ae0SRandall Stewart } 214d61a0ae0SRandall Stewart 215d61a0ae0SRandall Stewart /* use only address families of interest */ 216d61a0ae0SRandall Stewart if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { 217d61a0ae0SRandall Stewart ipv6_addr_legal = 1; 218d61a0ae0SRandall Stewart if (SCTP_IPV6_V6ONLY(inp)) { 219d61a0ae0SRandall Stewart ipv4_addr_legal = 0; 220d61a0ae0SRandall Stewart } else { 221d61a0ae0SRandall Stewart ipv4_addr_legal = 1; 222d61a0ae0SRandall Stewart } 223d61a0ae0SRandall Stewart } else { 224d61a0ae0SRandall Stewart ipv4_addr_legal = 1; 225d61a0ae0SRandall Stewart ipv6_addr_legal = 0; 226d61a0ae0SRandall Stewart } 227d61a0ae0SRandall Stewart 228d61a0ae0SRandall Stewart /* neither Mac OS X nor FreeBSD support mulitple routing functions */ 229d61a0ae0SRandall Stewart if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) { 2305f26a41dSRandall Stewart SCTP_INP_RUNLOCK(inp); 2315f26a41dSRandall Stewart SCTP_INP_INFO_RUNLOCK(); 232d61a0ae0SRandall Stewart return (-1); 233d61a0ae0SRandall Stewart } 234d61a0ae0SRandall Stewart if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { 235d61a0ae0SRandall Stewart LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { 236d61a0ae0SRandall Stewart if ((loopback_scope == 0) && SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) 237d61a0ae0SRandall Stewart /* Skip loopback if loopback_scope not set */ 238d61a0ae0SRandall Stewart continue; 239d61a0ae0SRandall Stewart LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) { 240d61a0ae0SRandall Stewart if (stcb) { 241d61a0ae0SRandall Stewart /* 242d61a0ae0SRandall Stewart * ignore if blacklisted at 243d61a0ae0SRandall Stewart * association level 244d61a0ae0SRandall Stewart */ 245d61a0ae0SRandall Stewart if (sctp_is_addr_restricted(stcb, sctp_ifa)) 246d61a0ae0SRandall Stewart continue; 247d61a0ae0SRandall Stewart } 2485e2c2d87SRandall Stewart switch (sctp_ifa->address.sa.sa_family) { 249e6194c2eSMichael Tuexen #ifdef INET 2505e2c2d87SRandall Stewart case AF_INET: 2515e2c2d87SRandall Stewart if (ipv4_addr_legal) { 252d61a0ae0SRandall Stewart struct sockaddr_in *sin; 253d61a0ae0SRandall Stewart 254d61a0ae0SRandall Stewart sin = (struct sockaddr_in *)&sctp_ifa->address.sa; 255d61a0ae0SRandall Stewart if (sin->sin_addr.s_addr == 0) 256d61a0ae0SRandall Stewart continue; 257d61a0ae0SRandall Stewart if ((ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr))) 258d61a0ae0SRandall Stewart continue; 2595e2c2d87SRandall Stewart } else { 2605e2c2d87SRandall Stewart continue; 2615e2c2d87SRandall Stewart } 2625e2c2d87SRandall Stewart break; 263e6194c2eSMichael Tuexen #endif 2645e2c2d87SRandall Stewart #ifdef INET6 2655e2c2d87SRandall Stewart case AF_INET6: 2665e2c2d87SRandall Stewart if (ipv6_addr_legal) { 267d61a0ae0SRandall Stewart struct sockaddr_in6 *sin6; 268d61a0ae0SRandall Stewart 269d61a0ae0SRandall Stewart sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sa; 270d61a0ae0SRandall Stewart if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) 271d61a0ae0SRandall Stewart continue; 272d61a0ae0SRandall Stewart if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { 273d61a0ae0SRandall Stewart if (local_scope == 0) 274d61a0ae0SRandall Stewart continue; 275d61a0ae0SRandall Stewart if (sin6->sin6_scope_id == 0) { 276d61a0ae0SRandall Stewart /* 2775e2c2d87SRandall Stewart * bad link 2785e2c2d87SRandall Stewart * local 279d61a0ae0SRandall Stewart * address 280d61a0ae0SRandall Stewart */ 281d61a0ae0SRandall Stewart if (sa6_recoverscope(sin6) != 0) 282d61a0ae0SRandall Stewart continue; 283d61a0ae0SRandall Stewart } 284d61a0ae0SRandall Stewart } 285d61a0ae0SRandall Stewart if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) 286d61a0ae0SRandall Stewart continue; 2875e2c2d87SRandall Stewart } else { 288d61a0ae0SRandall Stewart continue; 2895e2c2d87SRandall Stewart } 2905e2c2d87SRandall Stewart break; 2915e2c2d87SRandall Stewart #endif 2925e2c2d87SRandall Stewart default: 2935e2c2d87SRandall Stewart continue; 2945e2c2d87SRandall Stewart } 295851b7298SRandall Stewart memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr)); 296d61a0ae0SRandall Stewart memcpy((void *)&xladdr.address, (const void *)&sctp_ifa->address, sizeof(union sctp_sockstore)); 297d61a0ae0SRandall Stewart SCTP_INP_RUNLOCK(inp); 298d61a0ae0SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 299d61a0ae0SRandall Stewart error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr)); 300851b7298SRandall Stewart if (error) { 301d61a0ae0SRandall Stewart return (error); 302851b7298SRandall Stewart } else { 303d61a0ae0SRandall Stewart SCTP_INP_INFO_RLOCK(); 304d61a0ae0SRandall Stewart SCTP_INP_RLOCK(inp); 305d61a0ae0SRandall Stewart } 306d61a0ae0SRandall Stewart } 307d61a0ae0SRandall Stewart } 308d61a0ae0SRandall Stewart } else { 309d61a0ae0SRandall Stewart LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { 310d61a0ae0SRandall Stewart /* ignore if blacklisted at association level */ 311d61a0ae0SRandall Stewart if (stcb && sctp_is_addr_restricted(stcb, laddr->ifa)) 312d61a0ae0SRandall Stewart continue; 313851b7298SRandall Stewart memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr)); 314d61a0ae0SRandall Stewart memcpy((void *)&xladdr.address, (const void *)&laddr->ifa->address, sizeof(union sctp_sockstore)); 315851b7298SRandall Stewart xladdr.start_time.tv_sec = (uint32_t) laddr->start_time.tv_sec; 316851b7298SRandall Stewart xladdr.start_time.tv_usec = (uint32_t) laddr->start_time.tv_usec; 317d61a0ae0SRandall Stewart SCTP_INP_RUNLOCK(inp); 318d61a0ae0SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 319d61a0ae0SRandall Stewart error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr)); 320851b7298SRandall Stewart if (error) { 321d61a0ae0SRandall Stewart return (error); 322851b7298SRandall Stewart } else { 323d61a0ae0SRandall Stewart SCTP_INP_INFO_RLOCK(); 324d61a0ae0SRandall Stewart SCTP_INP_RLOCK(inp); 325d61a0ae0SRandall Stewart } 326d61a0ae0SRandall Stewart } 327d61a0ae0SRandall Stewart } 328851b7298SRandall Stewart memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr)); 329d61a0ae0SRandall Stewart xladdr.last = 1; 3305f26a41dSRandall Stewart SCTP_INP_RUNLOCK(inp); 3315f26a41dSRandall Stewart SCTP_INP_INFO_RUNLOCK(); 332d61a0ae0SRandall Stewart error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr)); 3335f26a41dSRandall Stewart 334851b7298SRandall Stewart if (error) { 335d61a0ae0SRandall Stewart return (error); 336851b7298SRandall Stewart } else { 3375f26a41dSRandall Stewart SCTP_INP_INFO_RLOCK(); 3385f26a41dSRandall Stewart SCTP_INP_RLOCK(inp); 339d61a0ae0SRandall Stewart return (0); 340d61a0ae0SRandall Stewart } 3415f26a41dSRandall Stewart } 342d61a0ae0SRandall Stewart 34342551e99SRandall Stewart /* 34442551e99SRandall Stewart * sysctl functions 34542551e99SRandall Stewart */ 34642551e99SRandall Stewart static int 34742551e99SRandall Stewart sctp_assoclist(SYSCTL_HANDLER_ARGS) 34842551e99SRandall Stewart { 34942551e99SRandall Stewart unsigned int number_of_endpoints; 35042551e99SRandall Stewart unsigned int number_of_local_addresses; 35142551e99SRandall Stewart unsigned int number_of_associations; 35242551e99SRandall Stewart unsigned int number_of_remote_addresses; 35342551e99SRandall Stewart unsigned int n; 35442551e99SRandall Stewart int error; 35542551e99SRandall Stewart struct sctp_inpcb *inp; 35642551e99SRandall Stewart struct sctp_tcb *stcb; 35742551e99SRandall Stewart struct sctp_nets *net; 35842551e99SRandall Stewart struct xsctp_inpcb xinpcb; 35942551e99SRandall Stewart struct xsctp_tcb xstcb; 36042551e99SRandall Stewart struct xsctp_raddr xraddr; 3618ce4a9a2SRandall Stewart struct socket *so; 36242551e99SRandall Stewart 36342551e99SRandall Stewart number_of_endpoints = 0; 36442551e99SRandall Stewart number_of_local_addresses = 0; 36542551e99SRandall Stewart number_of_associations = 0; 36642551e99SRandall Stewart number_of_remote_addresses = 0; 36742551e99SRandall Stewart 36842551e99SRandall Stewart SCTP_INP_INFO_RLOCK(); 36942551e99SRandall Stewart if (req->oldptr == USER_ADDR_NULL) { 370b3f1ea41SRandall Stewart LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) { 37142551e99SRandall Stewart SCTP_INP_RLOCK(inp); 37242551e99SRandall Stewart number_of_endpoints++; 373d61a0ae0SRandall Stewart number_of_local_addresses += number_of_addresses(inp); 37442551e99SRandall Stewart LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { 37542551e99SRandall Stewart number_of_associations++; 376d61a0ae0SRandall Stewart number_of_local_addresses += number_of_addresses(inp); 37742551e99SRandall Stewart TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { 37842551e99SRandall Stewart number_of_remote_addresses++; 37942551e99SRandall Stewart } 38042551e99SRandall Stewart } 38142551e99SRandall Stewart SCTP_INP_RUNLOCK(inp); 38242551e99SRandall Stewart } 38342551e99SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 38442551e99SRandall Stewart n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) + 385d61a0ae0SRandall Stewart (number_of_local_addresses + number_of_endpoints + number_of_associations) * sizeof(struct xsctp_laddr) + 386d61a0ae0SRandall Stewart (number_of_associations + number_of_endpoints) * sizeof(struct xsctp_tcb) + 387d61a0ae0SRandall Stewart (number_of_remote_addresses + number_of_associations) * sizeof(struct xsctp_raddr); 388d61a0ae0SRandall Stewart 38942551e99SRandall Stewart /* request some more memory than needed */ 39042551e99SRandall Stewart req->oldidx = (n + n / 8); 39142551e99SRandall Stewart return 0; 39242551e99SRandall Stewart } 39342551e99SRandall Stewart if (req->newptr != USER_ADDR_NULL) { 39442551e99SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 395c4739e2fSRandall Stewart SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_SYSCTL, EPERM); 39642551e99SRandall Stewart return EPERM; 39742551e99SRandall Stewart } 398b3f1ea41SRandall Stewart LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) { 39942551e99SRandall Stewart SCTP_INP_RLOCK(inp); 4008ce4a9a2SRandall Stewart if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { 4018ce4a9a2SRandall Stewart /* if its allgone it is being freed - skip it */ 4028ce4a9a2SRandall Stewart goto skip; 4038ce4a9a2SRandall Stewart } 40442551e99SRandall Stewart xinpcb.last = 0; 40542551e99SRandall Stewart xinpcb.local_port = ntohs(inp->sctp_lport); 40642551e99SRandall Stewart xinpcb.flags = inp->sctp_flags; 40742551e99SRandall Stewart xinpcb.features = inp->sctp_features; 40842551e99SRandall Stewart xinpcb.total_sends = inp->total_sends; 40942551e99SRandall Stewart xinpcb.total_recvs = inp->total_recvs; 41042551e99SRandall Stewart xinpcb.total_nospaces = inp->total_nospaces; 41117205eccSRandall Stewart xinpcb.fragmentation_point = inp->sctp_frag_point; 4128ce4a9a2SRandall Stewart so = inp->sctp_socket; 4138ce4a9a2SRandall Stewart if ((so == NULL) || 414851b7298SRandall Stewart (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) { 415851b7298SRandall Stewart xinpcb.qlen = 0; 416851b7298SRandall Stewart xinpcb.maxqlen = 0; 417851b7298SRandall Stewart } else { 4188ce4a9a2SRandall Stewart xinpcb.qlen = so->so_qlen; 4198ce4a9a2SRandall Stewart xinpcb.maxqlen = so->so_qlimit; 420851b7298SRandall Stewart } 42142551e99SRandall Stewart SCTP_INP_INCR_REF(inp); 42242551e99SRandall Stewart SCTP_INP_RUNLOCK(inp); 42342551e99SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 42442551e99SRandall Stewart error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb)); 42542551e99SRandall Stewart if (error) { 426d61a0ae0SRandall Stewart SCTP_INP_DECR_REF(inp); 42742551e99SRandall Stewart return error; 42842551e99SRandall Stewart } 42942551e99SRandall Stewart SCTP_INP_INFO_RLOCK(); 43042551e99SRandall Stewart SCTP_INP_RLOCK(inp); 431d61a0ae0SRandall Stewart error = copy_out_local_addresses(inp, NULL, req); 432d61a0ae0SRandall Stewart if (error) { 433d61a0ae0SRandall Stewart SCTP_INP_DECR_REF(inp); 434d61a0ae0SRandall Stewart return error; 435d61a0ae0SRandall Stewart } 43642551e99SRandall Stewart LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { 43742551e99SRandall Stewart SCTP_TCB_LOCK(stcb); 43842551e99SRandall Stewart atomic_add_int(&stcb->asoc.refcnt, 1); 43942551e99SRandall Stewart SCTP_TCB_UNLOCK(stcb); 440d61a0ae0SRandall Stewart xstcb.last = 0; 441d61a0ae0SRandall Stewart xstcb.local_port = ntohs(inp->sctp_lport); 442d61a0ae0SRandall Stewart xstcb.remote_port = ntohs(stcb->rport); 44342551e99SRandall Stewart if (stcb->asoc.primary_destination != NULL) 444d61a0ae0SRandall Stewart xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr; 445d61a0ae0SRandall Stewart xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay; 446d61a0ae0SRandall Stewart xstcb.state = SCTP_GET_STATE(&stcb->asoc); /* FIXME */ 4474f6b4933SRandall Stewart /* 7.0 does not support these */ 448a99b6783SRandall Stewart xstcb.assoc_id = sctp_get_associd(stcb); 4494f6b4933SRandall Stewart xstcb.peers_rwnd = stcb->asoc.peers_rwnd; 450d61a0ae0SRandall Stewart xstcb.in_streams = stcb->asoc.streamincnt; 451d61a0ae0SRandall Stewart xstcb.out_streams = stcb->asoc.streamoutcnt; 452d61a0ae0SRandall Stewart xstcb.max_nr_retrans = stcb->asoc.overall_error_count; 453d61a0ae0SRandall Stewart xstcb.primary_process = 0; /* not really supported 454d61a0ae0SRandall Stewart * yet */ 455d61a0ae0SRandall Stewart xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie; 456d61a0ae0SRandall Stewart xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack; 457d61a0ae0SRandall Stewart xstcb.retransmitted_tsns = stcb->asoc.marked_retrans; 458851b7298SRandall Stewart xstcb.start_time.tv_sec = (uint32_t) stcb->asoc.start_time.tv_sec; 459851b7298SRandall Stewart xstcb.start_time.tv_usec = (uint32_t) stcb->asoc.start_time.tv_usec; 460851b7298SRandall Stewart xstcb.discontinuity_time.tv_sec = (uint32_t) stcb->asoc.discontinuity_time.tv_sec; 461851b7298SRandall Stewart xstcb.discontinuity_time.tv_usec = (uint32_t) stcb->asoc.discontinuity_time.tv_usec; 46242551e99SRandall Stewart xstcb.total_sends = stcb->total_sends; 46342551e99SRandall Stewart xstcb.total_recvs = stcb->total_recvs; 46442551e99SRandall Stewart xstcb.local_tag = stcb->asoc.my_vtag; 46542551e99SRandall Stewart xstcb.remote_tag = stcb->asoc.peer_vtag; 46642551e99SRandall Stewart xstcb.initial_tsn = stcb->asoc.init_seq_number; 46742551e99SRandall Stewart xstcb.highest_tsn = stcb->asoc.sending_seq - 1; 46842551e99SRandall Stewart xstcb.cumulative_tsn = stcb->asoc.last_acked_seq; 46942551e99SRandall Stewart xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn; 47017205eccSRandall Stewart xstcb.mtu = stcb->asoc.smallest_mtu; 471207304d4SRandall Stewart xstcb.refcnt = stcb->asoc.refcnt; 47242551e99SRandall Stewart SCTP_INP_RUNLOCK(inp); 47342551e99SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 47442551e99SRandall Stewart error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb)); 47542551e99SRandall Stewart if (error) { 476d61a0ae0SRandall Stewart SCTP_INP_DECR_REF(inp); 477851b7298SRandall Stewart atomic_subtract_int(&stcb->asoc.refcnt, 1); 478d61a0ae0SRandall Stewart return error; 479d61a0ae0SRandall Stewart } 480d61a0ae0SRandall Stewart SCTP_INP_INFO_RLOCK(); 481d61a0ae0SRandall Stewart SCTP_INP_RLOCK(inp); 482d61a0ae0SRandall Stewart error = copy_out_local_addresses(inp, stcb, req); 483d61a0ae0SRandall Stewart if (error) { 484d61a0ae0SRandall Stewart SCTP_INP_DECR_REF(inp); 485851b7298SRandall Stewart atomic_subtract_int(&stcb->asoc.refcnt, 1); 48642551e99SRandall Stewart return error; 48742551e99SRandall Stewart } 48842551e99SRandall Stewart TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { 489d61a0ae0SRandall Stewart xraddr.last = 0; 490d61a0ae0SRandall Stewart xraddr.address = net->ro._l_addr; 491d61a0ae0SRandall Stewart xraddr.active = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE); 492d61a0ae0SRandall Stewart xraddr.confirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0); 493d61a0ae0SRandall Stewart xraddr.heartbeat_enabled = ((net->dest_state & SCTP_ADDR_NOHB) == 0); 494ca85e948SMichael Tuexen xraddr.potentially_failed = ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF); 495d61a0ae0SRandall Stewart xraddr.rto = net->RTO; 496d61a0ae0SRandall Stewart xraddr.max_path_rtx = net->failure_threshold; 497d61a0ae0SRandall Stewart xraddr.rtx = net->marked_retrans; 498d61a0ae0SRandall Stewart xraddr.error_counter = net->error_count; 499d61a0ae0SRandall Stewart xraddr.cwnd = net->cwnd; 500d61a0ae0SRandall Stewart xraddr.flight_size = net->flight_size; 501d61a0ae0SRandall Stewart xraddr.mtu = net->mtu; 502be1d9176SMichael Tuexen xraddr.rtt = net->rtt / 1000; 503ca85e948SMichael Tuexen xraddr.heartbeat_interval = net->heart_beat_delay; 504851b7298SRandall Stewart xraddr.start_time.tv_sec = (uint32_t) net->start_time.tv_sec; 505851b7298SRandall Stewart xraddr.start_time.tv_usec = (uint32_t) net->start_time.tv_usec; 506d61a0ae0SRandall Stewart SCTP_INP_RUNLOCK(inp); 507d61a0ae0SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 50842551e99SRandall Stewart error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr)); 50942551e99SRandall Stewart if (error) { 510d61a0ae0SRandall Stewart SCTP_INP_DECR_REF(inp); 511851b7298SRandall Stewart atomic_subtract_int(&stcb->asoc.refcnt, 1); 51242551e99SRandall Stewart return error; 51342551e99SRandall Stewart } 51442551e99SRandall Stewart SCTP_INP_INFO_RLOCK(); 51542551e99SRandall Stewart SCTP_INP_RLOCK(inp); 51642551e99SRandall Stewart } 517851b7298SRandall Stewart atomic_subtract_int(&stcb->asoc.refcnt, 1); 518d61a0ae0SRandall Stewart memset((void *)&xraddr, 0, sizeof(struct xsctp_raddr)); 519d61a0ae0SRandall Stewart xraddr.last = 1; 52042551e99SRandall Stewart SCTP_INP_RUNLOCK(inp); 521d61a0ae0SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 522d61a0ae0SRandall Stewart error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr)); 523d61a0ae0SRandall Stewart if (error) { 524d61a0ae0SRandall Stewart SCTP_INP_DECR_REF(inp); 525d61a0ae0SRandall Stewart return error; 526d61a0ae0SRandall Stewart } 527d61a0ae0SRandall Stewart SCTP_INP_INFO_RLOCK(); 528d61a0ae0SRandall Stewart SCTP_INP_RLOCK(inp); 529d61a0ae0SRandall Stewart } 530851b7298SRandall Stewart SCTP_INP_DECR_REF(inp); 531d61a0ae0SRandall Stewart SCTP_INP_RUNLOCK(inp); 532d61a0ae0SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 533d61a0ae0SRandall Stewart memset((void *)&xstcb, 0, sizeof(struct xsctp_tcb)); 534d61a0ae0SRandall Stewart xstcb.last = 1; 535d61a0ae0SRandall Stewart error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb)); 536d61a0ae0SRandall Stewart if (error) { 537d61a0ae0SRandall Stewart return error; 538d61a0ae0SRandall Stewart } 5398ce4a9a2SRandall Stewart skip: 540d61a0ae0SRandall Stewart SCTP_INP_INFO_RLOCK(); 54142551e99SRandall Stewart } 54242551e99SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 54342551e99SRandall Stewart 544d61a0ae0SRandall Stewart memset((void *)&xinpcb, 0, sizeof(struct xsctp_inpcb)); 54542551e99SRandall Stewart xinpcb.last = 1; 54642551e99SRandall Stewart error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb)); 54742551e99SRandall Stewart return error; 54842551e99SRandall Stewart } 54942551e99SRandall Stewart 550c54a18d2SRandall Stewart 551851b7298SRandall Stewart #define RANGECHK(var, min, max) \ 552851b7298SRandall Stewart if ((var) < (min)) { (var) = (min); } \ 553851b7298SRandall Stewart else if ((var) > (max)) { (var) = (max); } 554851b7298SRandall Stewart 555e6194c2eSMichael Tuexen /* XXX: Remove the #if after tunneling over IPv6 works also on FreeBSD. */ 556e6194c2eSMichael Tuexen #if !defined(__FreeBSD__) || defined(INET) 557851b7298SRandall Stewart static int 558c54a18d2SRandall Stewart sysctl_sctp_udp_tunneling_check(SYSCTL_HANDLER_ARGS) 559c54a18d2SRandall Stewart { 560c54a18d2SRandall Stewart int error; 561c54a18d2SRandall Stewart uint32_t old_sctp_udp_tunneling_port; 562c54a18d2SRandall Stewart 563be27fdd0SRandall Stewart SCTP_INP_INFO_RLOCK(); 564b3f1ea41SRandall Stewart old_sctp_udp_tunneling_port = SCTP_BASE_SYSCTL(sctp_udp_tunneling_port); 565be27fdd0SRandall Stewart SCTP_INP_INFO_RUNLOCK(); 566c54a18d2SRandall Stewart error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); 567c54a18d2SRandall Stewart if (error == 0) { 568b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), SCTPCTL_UDP_TUNNELING_PORT_MIN, SCTPCTL_UDP_TUNNELING_PORT_MAX); 569a99b6783SRandall Stewart if (old_sctp_udp_tunneling_port == SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) { 570a99b6783SRandall Stewart error = 0; 571a99b6783SRandall Stewart goto out; 572a99b6783SRandall Stewart } 573be27fdd0SRandall Stewart SCTP_INP_INFO_WLOCK(); 574c54a18d2SRandall Stewart if (old_sctp_udp_tunneling_port) { 575c54a18d2SRandall Stewart sctp_over_udp_stop(); 576c54a18d2SRandall Stewart } 577b3f1ea41SRandall Stewart if (SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) { 578c54a18d2SRandall Stewart if (sctp_over_udp_start()) { 579b3f1ea41SRandall Stewart SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = 0; 580c54a18d2SRandall Stewart } 581c54a18d2SRandall Stewart } 582be27fdd0SRandall Stewart SCTP_INP_INFO_WUNLOCK(); 583c54a18d2SRandall Stewart } 584a99b6783SRandall Stewart out: 585c54a18d2SRandall Stewart return (error); 586c54a18d2SRandall Stewart } 587c54a18d2SRandall Stewart 588e6194c2eSMichael Tuexen #endif 589e6194c2eSMichael Tuexen 590b3f1ea41SRandall Stewart 591c54a18d2SRandall Stewart static int 592851b7298SRandall Stewart sysctl_sctp_check(SYSCTL_HANDLER_ARGS) 593851b7298SRandall Stewart { 594851b7298SRandall Stewart int error; 595851b7298SRandall Stewart 596f0878bdcSMichael Tuexen #ifdef VIMAGE 597f0878bdcSMichael Tuexen error = vnet_sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); 598f0878bdcSMichael Tuexen #else 599851b7298SRandall Stewart error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); 600f0878bdcSMichael Tuexen #endif 601851b7298SRandall Stewart if (error == 0) { 602b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_sendspace), SCTPCTL_MAXDGRAM_MIN, SCTPCTL_MAXDGRAM_MAX); 603b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_recvspace), SCTPCTL_RECVSPACE_MIN, SCTPCTL_RECVSPACE_MAX); 604b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_auto_asconf), SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX); 605b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX); 606b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX); 6079c7635e1SMichael Tuexen #if !defined(SCTP_WITH_NO_CSUM) 608b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX); 6099c7635e1SMichael Tuexen #endif 610b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_init), SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX); 611b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX); 612b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX); 613899288aeSRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), SCTPCTL_FRMAXBURST_MIN, SCTPCTL_FRMAXBURST_MAX); 614b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), SCTPCTL_MAXCHUNKS_MIN, SCTPCTL_MAXCHUNKS_MAX); 615b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_hashtblsize), SCTPCTL_TCBHASHSIZE_MIN, SCTPCTL_TCBHASHSIZE_MAX); 616b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_pcbtblsize), SCTPCTL_PCBHASHSIZE_MIN, SCTPCTL_PCBHASHSIZE_MAX); 617b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_min_split_point), SCTPCTL_MIN_SPLIT_POINT_MIN, SCTPCTL_MIN_SPLIT_POINT_MAX); 618b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_chunkscale), SCTPCTL_CHUNKSCALE_MIN, SCTPCTL_CHUNKSCALE_MAX); 619b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default), SCTPCTL_DELAYED_SACK_TIME_MIN, SCTPCTL_DELAYED_SACK_TIME_MAX); 620b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_sack_freq_default), SCTPCTL_SACK_FREQ_MIN, SCTPCTL_SACK_FREQ_MAX); 621b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_system_free_resc_limit), SCTPCTL_SYS_RESOURCE_MIN, SCTPCTL_SYS_RESOURCE_MAX); 622b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit), SCTPCTL_ASOC_RESOURCE_MIN, SCTPCTL_ASOC_RESOURCE_MAX); 623b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default), SCTPCTL_HEARTBEAT_INTERVAL_MIN, SCTPCTL_HEARTBEAT_INTERVAL_MAX); 624b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default), SCTPCTL_PMTU_RAISE_TIME_MIN, SCTPCTL_PMTU_RAISE_TIME_MAX); 625b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default), SCTPCTL_SHUTDOWN_GUARD_TIME_MIN, SCTPCTL_SHUTDOWN_GUARD_TIME_MAX); 626b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_secret_lifetime_default), SCTPCTL_SECRET_LIFETIME_MIN, SCTPCTL_SECRET_LIFETIME_MAX); 627b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_max_default), SCTPCTL_RTO_MAX_MIN, SCTPCTL_RTO_MAX_MAX); 628b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_min_default), SCTPCTL_RTO_MIN_MIN, SCTPCTL_RTO_MIN_MAX); 629b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_initial_default), SCTPCTL_RTO_INITIAL_MIN, SCTPCTL_RTO_INITIAL_MAX); 630b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_init_rto_max_default), SCTPCTL_INIT_RTO_MAX_MIN, SCTPCTL_INIT_RTO_MAX_MAX); 631b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default), SCTPCTL_VALID_COOKIE_LIFE_MIN, SCTPCTL_VALID_COOKIE_LIFE_MAX); 632b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_init_rtx_max_default), SCTPCTL_INIT_RTX_MAX_MIN, SCTPCTL_INIT_RTX_MAX_MAX); 633b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default), SCTPCTL_ASSOC_RTX_MAX_MIN, SCTPCTL_ASSOC_RTX_MAX_MAX); 634b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), SCTPCTL_PATH_RTX_MAX_MIN, SCTPCTL_PATH_RTX_MAX_MAX); 635ca85e948SMichael Tuexen RANGECHK(SCTP_BASE_SYSCTL(sctp_path_pf_threshold), SCTPCTL_PATH_PF_THRESHOLD_MIN, SCTPCTL_PATH_PF_THRESHOLD_MAX); 636b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_add_more_threshold), SCTPCTL_ADD_MORE_ON_OUTPUT_MIN, SCTPCTL_ADD_MORE_ON_OUTPUT_MAX); 637b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), SCTPCTL_OUTGOING_STREAMS_MIN, SCTPCTL_OUTGOING_STREAMS_MAX); 638b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_on_off), SCTPCTL_CMT_ON_OFF_MIN, SCTPCTL_CMT_ON_OFF_MAX); 639830d754dSRandall Stewart /* EY */ 640830d754dSRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), SCTPCTL_NR_SACK_ON_OFF_MIN, SCTPCTL_NR_SACK_ON_OFF_MAX); 641b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_use_dac), SCTPCTL_CMT_USE_DAC_MIN, SCTPCTL_CMT_USE_DAC_MAX); 642b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), SCTPCTL_CWND_MAXBURST_MIN, SCTPCTL_CWND_MAXBURST_MAX); 643b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), SCTPCTL_ASCONF_AUTH_NOCHK_MIN, SCTPCTL_ASCONF_AUTH_NOCHK_MAX); 644b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_auth_disable), SCTPCTL_AUTH_DISABLE_MIN, SCTPCTL_AUTH_DISABLE_MAX); 645b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_nat_friendly), SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX); 646b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_L2_abc_variable), SCTPCTL_ABC_L_VAR_MIN, SCTPCTL_ABC_L_VAR_MAX); 647b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count), SCTPCTL_MAX_CHAINED_MBUFS_MIN, SCTPCTL_MAX_CHAINED_MBUFS_MAX); 648b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_do_drain), SCTPCTL_DO_SCTP_DRAIN_MIN, SCTPCTL_DO_SCTP_DRAIN_MAX); 649b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_hb_maxburst), SCTPCTL_HB_MAX_BURST_MIN, SCTPCTL_HB_MAX_BURST_MAX); 650b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit), SCTPCTL_ABORT_AT_LIMIT_MIN, SCTPCTL_ABORT_AT_LIMIT_MAX); 651b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_data_order), SCTPCTL_STRICT_DATA_ORDER_MIN, SCTPCTL_STRICT_DATA_ORDER_MAX); 652b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_min_residual), SCTPCTL_MIN_RESIDUAL_MIN, SCTPCTL_MIN_RESIDUAL_MAX); 653b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_max_retran_chunk), SCTPCTL_MAX_RETRAN_CHUNK_MIN, SCTPCTL_MAX_RETRAN_CHUNK_MAX); 654b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_logging_level), SCTPCTL_LOGGING_LEVEL_MIN, SCTPCTL_LOGGING_LEVEL_MAX); 655b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_default_cc_module), SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX); 656f7a77f6fSMichael Tuexen RANGECHK(SCTP_BASE_SYSCTL(sctp_default_ss_module), SCTPCTL_DEFAULT_SS_MODULE_MIN, SCTPCTL_DEFAULT_SS_MODULE_MAX); 657b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX); 658a16ccdceSRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_vtag_time_wait), SCTPCTL_TIME_WAIT_MIN, SCTPCTL_TIME_WAIT_MAX); 65925a2a187SMichael Tuexen RANGECHK(SCTP_BASE_SYSCTL(sctp_buffer_splitting), SCTPCTL_BUFFER_SPLITTING_MIN, SCTPCTL_BUFFER_SPLITTING_MAX); 660dcfc0625SMichael Tuexen RANGECHK(SCTP_BASE_SYSCTL(sctp_initial_cwnd), SCTPCTL_INITIAL_CWND_MIN, SCTPCTL_INITIAL_CWND_MAX); 661299108c5SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_rttvar_bw), SCTPCTL_RTTVAR_BW_MIN, SCTPCTL_RTTVAR_BW_MAX); 662299108c5SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_rttvar_rtt), SCTPCTL_RTTVAR_RTT_MIN, SCTPCTL_RTTVAR_RTT_MAX); 663299108c5SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_rttvar_eqret), SCTPCTL_RTTVAR_EQRET_MIN, SCTPCTL_RTTVAR_EQRET_MAX); 664f79aab18SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_steady_step), SCTPCTL_RTTVAR_STEADYS_MIN, SCTPCTL_RTTVAR_STEADYS_MAX); 665f79aab18SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_use_dccc_ecn), SCTPCTL_RTTVAR_DCCCECN_MIN, SCTPCTL_RTTVAR_DCCCECN_MAX); 666b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX); 667b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX); 668b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), SCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN, SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX); 669bf3d5177SMichael Tuexen RANGECHK(SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), SCTPCTL_NAT_FRIENDLY_INITS_MIN, SCTPCTL_NAT_FRIENDLY_INITS_MAX); 670830d754dSRandall Stewart 671851b7298SRandall Stewart #ifdef SCTP_DEBUG 672b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_debug_on), SCTPCTL_DEBUG_MIN, SCTPCTL_DEBUG_MAX); 673b3f1ea41SRandall Stewart #endif 674b3f1ea41SRandall Stewart #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 675b3f1ea41SRandall Stewart RANGECHK(SCTP_BASE_SYSCTL(sctp_output_unlocked), SCTPCTL_OUTPUT_UNLOCKED_MIN, SCTPCTL_OUTPUT_UNLOCKED_MAX); 676851b7298SRandall Stewart #endif 677851b7298SRandall Stewart } 678851b7298SRandall Stewart return (error); 679851b7298SRandall Stewart } 68042551e99SRandall Stewart 681ff014514SRandall Stewart #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) 682ff014514SRandall Stewart static int 683ff014514SRandall Stewart sysctl_stat_get(SYSCTL_HANDLER_ARGS) 684ff014514SRandall Stewart { 685ff014514SRandall Stewart int cpu, error; 686ae26e0a4SRandall Stewart struct sctpstat sb, *sarry, *cpin = NULL; 687b3f1ea41SRandall Stewart 688ae26e0a4SRandall Stewart if ((req->newptr) && (req->newlen == sizeof(struct sctpstat))) { 689ae26e0a4SRandall Stewart /* 690ae26e0a4SRandall Stewart * User wants us to clear or at least reset the counters to 691ae26e0a4SRandall Stewart * the specified values. 692ae26e0a4SRandall Stewart */ 693ae26e0a4SRandall Stewart cpin = (struct sctpstat *)req->newptr; 694ae26e0a4SRandall Stewart } else if (req->newptr) { 695ae26e0a4SRandall Stewart /* Must be a stat structure */ 696ae26e0a4SRandall Stewart return (EINVAL); 697ae26e0a4SRandall Stewart } 698ff014514SRandall Stewart memset(&sb, 0, sizeof(sb)); 699dec0177dSRandall Stewart for (cpu = 0; cpu < mp_maxid; cpu++) { 700ff014514SRandall Stewart sarry = &SCTP_BASE_STATS[cpu]; 701ff014514SRandall Stewart if (sarry->sctps_discontinuitytime.tv_sec > sb.sctps_discontinuitytime.tv_sec) { 702ff014514SRandall Stewart sb.sctps_discontinuitytime.tv_sec = sarry->sctps_discontinuitytime.tv_sec; 703ff014514SRandall Stewart sb.sctps_discontinuitytime.tv_usec = sarry->sctps_discontinuitytime.tv_usec; 704ff014514SRandall Stewart } 705ff014514SRandall Stewart sb.sctps_currestab += sarry->sctps_currestab; 706ff014514SRandall Stewart sb.sctps_activeestab += sarry->sctps_activeestab; 707ff014514SRandall Stewart sb.sctps_restartestab += sarry->sctps_restartestab; 708ff014514SRandall Stewart sb.sctps_collisionestab += sarry->sctps_collisionestab; 709ff014514SRandall Stewart sb.sctps_passiveestab += sarry->sctps_passiveestab; 710ff014514SRandall Stewart sb.sctps_aborted += sarry->sctps_aborted; 711ff014514SRandall Stewart sb.sctps_shutdown += sarry->sctps_shutdown; 712ff014514SRandall Stewart sb.sctps_outoftheblue += sarry->sctps_outoftheblue; 713ff014514SRandall Stewart sb.sctps_checksumerrors += sarry->sctps_checksumerrors; 714ff014514SRandall Stewart sb.sctps_outcontrolchunks += sarry->sctps_outcontrolchunks; 715ff014514SRandall Stewart sb.sctps_outorderchunks += sarry->sctps_outorderchunks; 716ff014514SRandall Stewart sb.sctps_outunorderchunks += sarry->sctps_outunorderchunks; 717ff014514SRandall Stewart sb.sctps_incontrolchunks += sarry->sctps_incontrolchunks; 718ff014514SRandall Stewart sb.sctps_inorderchunks += sarry->sctps_inorderchunks; 719ff014514SRandall Stewart sb.sctps_inunorderchunks += sarry->sctps_inunorderchunks; 720ff014514SRandall Stewart sb.sctps_fragusrmsgs += sarry->sctps_fragusrmsgs; 721ff014514SRandall Stewart sb.sctps_reasmusrmsgs += sarry->sctps_reasmusrmsgs; 722ff014514SRandall Stewart sb.sctps_outpackets += sarry->sctps_outpackets; 723ff014514SRandall Stewart sb.sctps_inpackets += sarry->sctps_inpackets; 724ff014514SRandall Stewart sb.sctps_recvpackets += sarry->sctps_recvpackets; 725ff014514SRandall Stewart sb.sctps_recvdatagrams += sarry->sctps_recvdatagrams; 726ff014514SRandall Stewart sb.sctps_recvpktwithdata += sarry->sctps_recvpktwithdata; 727ff014514SRandall Stewart sb.sctps_recvsacks += sarry->sctps_recvsacks; 728ff014514SRandall Stewart sb.sctps_recvdata += sarry->sctps_recvdata; 729ff014514SRandall Stewart sb.sctps_recvdupdata += sarry->sctps_recvdupdata; 730ff014514SRandall Stewart sb.sctps_recvheartbeat += sarry->sctps_recvheartbeat; 731ff014514SRandall Stewart sb.sctps_recvheartbeatack += sarry->sctps_recvheartbeatack; 732ff014514SRandall Stewart sb.sctps_recvecne += sarry->sctps_recvecne; 733ff014514SRandall Stewart sb.sctps_recvauth += sarry->sctps_recvauth; 734ff014514SRandall Stewart sb.sctps_recvauthmissing += sarry->sctps_recvauthmissing; 735ff014514SRandall Stewart sb.sctps_recvivalhmacid += sarry->sctps_recvivalhmacid; 736ff014514SRandall Stewart sb.sctps_recvivalkeyid += sarry->sctps_recvivalkeyid; 737ff014514SRandall Stewart sb.sctps_recvauthfailed += sarry->sctps_recvauthfailed; 738ff014514SRandall Stewart sb.sctps_recvexpress += sarry->sctps_recvexpress; 739ff014514SRandall Stewart sb.sctps_recvexpressm += sarry->sctps_recvexpressm; 740ff014514SRandall Stewart sb.sctps_recvnocrc += sarry->sctps_recvnocrc; 741ff014514SRandall Stewart sb.sctps_recvswcrc += sarry->sctps_recvswcrc; 742ff014514SRandall Stewart sb.sctps_recvhwcrc += sarry->sctps_recvhwcrc; 743ff014514SRandall Stewart sb.sctps_sendpackets += sarry->sctps_sendpackets; 744ff014514SRandall Stewart sb.sctps_sendsacks += sarry->sctps_sendsacks; 745ff014514SRandall Stewart sb.sctps_senddata += sarry->sctps_senddata; 746ff014514SRandall Stewart sb.sctps_sendretransdata += sarry->sctps_sendretransdata; 747ff014514SRandall Stewart sb.sctps_sendfastretrans += sarry->sctps_sendfastretrans; 748ff014514SRandall Stewart sb.sctps_sendmultfastretrans += sarry->sctps_sendmultfastretrans; 749ff014514SRandall Stewart sb.sctps_sendheartbeat += sarry->sctps_sendheartbeat; 750ff014514SRandall Stewart sb.sctps_sendecne += sarry->sctps_sendecne; 751ff014514SRandall Stewart sb.sctps_sendauth += sarry->sctps_sendauth; 752ff014514SRandall Stewart sb.sctps_senderrors += sarry->sctps_senderrors; 753ff014514SRandall Stewart sb.sctps_sendnocrc += sarry->sctps_sendnocrc; 754ff014514SRandall Stewart sb.sctps_sendswcrc += sarry->sctps_sendswcrc; 755ff014514SRandall Stewart sb.sctps_sendhwcrc += sarry->sctps_sendhwcrc; 756ff014514SRandall Stewart sb.sctps_pdrpfmbox += sarry->sctps_pdrpfmbox; 757ff014514SRandall Stewart sb.sctps_pdrpfehos += sarry->sctps_pdrpfehos; 758ff014514SRandall Stewart sb.sctps_pdrpmbda += sarry->sctps_pdrpmbda; 759ff014514SRandall Stewart sb.sctps_pdrpmbct += sarry->sctps_pdrpmbct; 760ff014514SRandall Stewart sb.sctps_pdrpbwrpt += sarry->sctps_pdrpbwrpt; 761ff014514SRandall Stewart sb.sctps_pdrpcrupt += sarry->sctps_pdrpcrupt; 762ff014514SRandall Stewart sb.sctps_pdrpnedat += sarry->sctps_pdrpnedat; 763ff014514SRandall Stewart sb.sctps_pdrppdbrk += sarry->sctps_pdrppdbrk; 764ff014514SRandall Stewart sb.sctps_pdrptsnnf += sarry->sctps_pdrptsnnf; 765ff014514SRandall Stewart sb.sctps_pdrpdnfnd += sarry->sctps_pdrpdnfnd; 766ff014514SRandall Stewart sb.sctps_pdrpdiwnp += sarry->sctps_pdrpdiwnp; 767ff014514SRandall Stewart sb.sctps_pdrpdizrw += sarry->sctps_pdrpdizrw; 768ff014514SRandall Stewart sb.sctps_pdrpbadd += sarry->sctps_pdrpbadd; 769ff014514SRandall Stewart sb.sctps_pdrpmark += sarry->sctps_pdrpmark; 770ff014514SRandall Stewart sb.sctps_timoiterator += sarry->sctps_timoiterator; 771ff014514SRandall Stewart sb.sctps_timodata += sarry->sctps_timodata; 772ff014514SRandall Stewart sb.sctps_timowindowprobe += sarry->sctps_timowindowprobe; 773ff014514SRandall Stewart sb.sctps_timoinit += sarry->sctps_timoinit; 774ff014514SRandall Stewart sb.sctps_timosack += sarry->sctps_timosack; 775ff014514SRandall Stewart sb.sctps_timoshutdown += sarry->sctps_timoshutdown; 776ff014514SRandall Stewart sb.sctps_timoheartbeat += sarry->sctps_timoheartbeat; 777ff014514SRandall Stewart sb.sctps_timocookie += sarry->sctps_timocookie; 778ff014514SRandall Stewart sb.sctps_timosecret += sarry->sctps_timosecret; 779ff014514SRandall Stewart sb.sctps_timopathmtu += sarry->sctps_timopathmtu; 780ff014514SRandall Stewart sb.sctps_timoshutdownack += sarry->sctps_timoshutdownack; 781ff014514SRandall Stewart sb.sctps_timoshutdownguard += sarry->sctps_timoshutdownguard; 782ff014514SRandall Stewart sb.sctps_timostrmrst += sarry->sctps_timostrmrst; 783ff014514SRandall Stewart sb.sctps_timoearlyfr += sarry->sctps_timoearlyfr; 784ff014514SRandall Stewart sb.sctps_timoasconf += sarry->sctps_timoasconf; 785ff014514SRandall Stewart sb.sctps_timodelprim += sarry->sctps_timodelprim; 786ff014514SRandall Stewart sb.sctps_timoautoclose += sarry->sctps_timoautoclose; 787ff014514SRandall Stewart sb.sctps_timoassockill += sarry->sctps_timoassockill; 788ff014514SRandall Stewart sb.sctps_timoinpkill += sarry->sctps_timoinpkill; 789ff014514SRandall Stewart sb.sctps_hdrops += sarry->sctps_hdrops; 790ff014514SRandall Stewart sb.sctps_badsum += sarry->sctps_badsum; 791ff014514SRandall Stewart sb.sctps_noport += sarry->sctps_noport; 792ff014514SRandall Stewart sb.sctps_badvtag += sarry->sctps_badvtag; 793ff014514SRandall Stewart sb.sctps_badsid += sarry->sctps_badsid; 794ff014514SRandall Stewart sb.sctps_nomem += sarry->sctps_nomem; 795ff014514SRandall Stewart sb.sctps_fastretransinrtt += sarry->sctps_fastretransinrtt; 796ff014514SRandall Stewart sb.sctps_markedretrans += sarry->sctps_markedretrans; 797ff014514SRandall Stewart sb.sctps_naglesent += sarry->sctps_naglesent; 798ff014514SRandall Stewart sb.sctps_naglequeued += sarry->sctps_naglequeued; 799ff014514SRandall Stewart sb.sctps_maxburstqueued += sarry->sctps_maxburstqueued; 800ff014514SRandall Stewart sb.sctps_ifnomemqueued += sarry->sctps_ifnomemqueued; 801ff014514SRandall Stewart sb.sctps_windowprobed += sarry->sctps_windowprobed; 802ff014514SRandall Stewart sb.sctps_lowlevelerr += sarry->sctps_lowlevelerr; 803ff014514SRandall Stewart sb.sctps_lowlevelerrusr += sarry->sctps_lowlevelerrusr; 804ff014514SRandall Stewart sb.sctps_datadropchklmt += sarry->sctps_datadropchklmt; 805ff014514SRandall Stewart sb.sctps_datadroprwnd += sarry->sctps_datadroprwnd; 806ff014514SRandall Stewart sb.sctps_ecnereducedcwnd += sarry->sctps_ecnereducedcwnd; 807ff014514SRandall Stewart sb.sctps_vtagexpress += sarry->sctps_vtagexpress; 808ff014514SRandall Stewart sb.sctps_vtagbogus += sarry->sctps_vtagbogus; 809ff014514SRandall Stewart sb.sctps_primary_randry += sarry->sctps_primary_randry; 810ff014514SRandall Stewart sb.sctps_cmt_randry += sarry->sctps_cmt_randry; 811ff014514SRandall Stewart sb.sctps_slowpath_sack += sarry->sctps_slowpath_sack; 812ff014514SRandall Stewart sb.sctps_wu_sacks_sent += sarry->sctps_wu_sacks_sent; 813ff014514SRandall Stewart sb.sctps_sends_with_flags += sarry->sctps_sends_with_flags; 814ff014514SRandall Stewart sb.sctps_sends_with_unord += sarry->sctps_sends_with_unord; 815ff014514SRandall Stewart sb.sctps_sends_with_eof += sarry->sctps_sends_with_eof; 816ff014514SRandall Stewart sb.sctps_sends_with_abort += sarry->sctps_sends_with_abort; 817ff014514SRandall Stewart sb.sctps_protocol_drain_calls += sarry->sctps_protocol_drain_calls; 818ff014514SRandall Stewart sb.sctps_protocol_drains_done += sarry->sctps_protocol_drains_done; 819ff014514SRandall Stewart sb.sctps_read_peeks += sarry->sctps_read_peeks; 820ff014514SRandall Stewart sb.sctps_cached_chk += sarry->sctps_cached_chk; 821ff014514SRandall Stewart sb.sctps_cached_strmoq += sarry->sctps_cached_strmoq; 822ff014514SRandall Stewart sb.sctps_left_abandon += sarry->sctps_left_abandon; 823ff014514SRandall Stewart sb.sctps_send_burst_avoid += sarry->sctps_send_burst_avoid; 824ff014514SRandall Stewart sb.sctps_send_cwnd_avoid += sarry->sctps_send_cwnd_avoid; 825ff014514SRandall Stewart sb.sctps_fwdtsn_map_over += sarry->sctps_fwdtsn_map_over; 826ae26e0a4SRandall Stewart if (cpin) { 827ae26e0a4SRandall Stewart memcpy(sarry, cpin, sizeof(struct sctpstat)); 828ae26e0a4SRandall Stewart } 829ff014514SRandall Stewart } 830ff014514SRandall Stewart error = SYSCTL_OUT(req, &sb, sizeof(sb)); 831ff014514SRandall Stewart return (error); 832ff014514SRandall Stewart } 833ff014514SRandall Stewart 834ff014514SRandall Stewart #endif 835b3f1ea41SRandall Stewart 836b3f1ea41SRandall Stewart #if defined(SCTP_LOCAL_TRACE_BUF) 837b3f1ea41SRandall Stewart static int 838b3f1ea41SRandall Stewart sysctl_sctp_cleartrace(SYSCTL_HANDLER_ARGS) 839b3f1ea41SRandall Stewart { 840a99b6783SRandall Stewart int error = 0; 841a99b6783SRandall Stewart 842b3f1ea41SRandall Stewart memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); 843a99b6783SRandall Stewart return (error); 844b3f1ea41SRandall Stewart } 845b3f1ea41SRandall Stewart 846b3f1ea41SRandall Stewart #endif 847b3f1ea41SRandall Stewart 848b3f1ea41SRandall Stewart 84942551e99SRandall Stewart /* 85042551e99SRandall Stewart * sysctl definitions 85142551e99SRandall Stewart */ 85242551e99SRandall Stewart 853f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, sendspace, CTLTYPE_UINT | CTLFLAG_RW, 854b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_sendspace), 0, sysctl_sctp_check, "IU", 855851b7298SRandall Stewart SCTPCTL_MAXDGRAM_DESC); 85642551e99SRandall Stewart 857f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, recvspace, CTLTYPE_UINT | CTLFLAG_RW, 858b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_recvspace), 0, sysctl_sctp_check, "IU", 859851b7298SRandall Stewart SCTPCTL_RECVSPACE_DESC); 86042551e99SRandall Stewart 861f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, auto_asconf, CTLTYPE_UINT | CTLFLAG_RW, 862b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_auto_asconf), 0, sysctl_sctp_check, "IU", 863851b7298SRandall Stewart SCTPCTL_AUTOASCONF_DESC); 86442551e99SRandall Stewart 865f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, ecn_enable, CTLTYPE_UINT | CTLFLAG_RW, 866b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_ecn_enable), 0, sysctl_sctp_check, "IU", 867851b7298SRandall Stewart SCTPCTL_ECN_ENABLE_DESC); 86842551e99SRandall Stewart 869f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_UINT | CTLFLAG_RW, 870b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU", 871851b7298SRandall Stewart SCTPCTL_STRICT_SACKS_DESC); 87242551e99SRandall Stewart 8739c7635e1SMichael Tuexen #if !defined(SCTP_WITH_NO_CSUM) 874f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_UINT | CTLFLAG_RW, 875b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), 0, sysctl_sctp_check, "IU", 876851b7298SRandall Stewart SCTPCTL_LOOPBACK_NOCSUM_DESC); 8779c7635e1SMichael Tuexen #endif 87842551e99SRandall Stewart 879f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_UINT | CTLFLAG_RW, 880b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_strict_init), 0, sysctl_sctp_check, "IU", 881851b7298SRandall Stewart SCTPCTL_STRICT_INIT_DESC); 88242551e99SRandall Stewart 883f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_UINT | CTLFLAG_RW, 884b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), 0, sysctl_sctp_check, "IU", 885851b7298SRandall Stewart SCTPCTL_PEER_CHKOH_DESC); 88642551e99SRandall Stewart 887f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, maxburst, CTLTYPE_UINT | CTLFLAG_RW, 888b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_max_burst_default), 0, sysctl_sctp_check, "IU", 889851b7298SRandall Stewart SCTPCTL_MAXBURST_DESC); 89042551e99SRandall Stewart 891f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, fr_maxburst, CTLTYPE_UINT | CTLFLAG_RW, 892899288aeSRandall Stewart &SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), 0, sysctl_sctp_check, "IU", 893899288aeSRandall Stewart SCTPCTL_FRMAXBURST_DESC); 894899288aeSRandall Stewart 895f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, maxchunks, CTLTYPE_UINT | CTLFLAG_RW, 896b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), 0, sysctl_sctp_check, "IU", 897851b7298SRandall Stewart SCTPCTL_MAXCHUNKS_DESC); 89842551e99SRandall Stewart 899f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, tcbhashsize, CTLTYPE_UINT | CTLFLAG_RW, 900b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_hashtblsize), 0, sysctl_sctp_check, "IU", 901851b7298SRandall Stewart SCTPCTL_TCBHASHSIZE_DESC); 90242551e99SRandall Stewart 903f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, pcbhashsize, CTLTYPE_UINT | CTLFLAG_RW, 904b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_pcbtblsize), 0, sysctl_sctp_check, "IU", 905851b7298SRandall Stewart SCTPCTL_PCBHASHSIZE_DESC); 90642551e99SRandall Stewart 907f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, min_split_point, CTLTYPE_UINT | CTLFLAG_RW, 908b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_min_split_point), 0, sysctl_sctp_check, "IU", 909851b7298SRandall Stewart SCTPCTL_MIN_SPLIT_POINT_DESC); 91042551e99SRandall Stewart 911f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, chunkscale, CTLTYPE_UINT | CTLFLAG_RW, 912b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_chunkscale), 0, sysctl_sctp_check, "IU", 913851b7298SRandall Stewart SCTPCTL_CHUNKSCALE_DESC); 91442551e99SRandall Stewart 915f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, delayed_sack_time, CTLTYPE_UINT | CTLFLAG_RW, 916b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default), 0, sysctl_sctp_check, "IU", 917851b7298SRandall Stewart SCTPCTL_DELAYED_SACK_TIME_DESC); 91842551e99SRandall Stewart 919f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, sack_freq, CTLTYPE_UINT | CTLFLAG_RW, 920b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_sack_freq_default), 0, sysctl_sctp_check, "IU", 921851b7298SRandall Stewart SCTPCTL_SACK_FREQ_DESC); 92242551e99SRandall Stewart 923f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, sys_resource, CTLTYPE_UINT | CTLFLAG_RW, 924b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_system_free_resc_limit), 0, sysctl_sctp_check, "IU", 925851b7298SRandall Stewart SCTPCTL_SYS_RESOURCE_DESC); 92642551e99SRandall Stewart 927f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, asoc_resource, CTLTYPE_UINT | CTLFLAG_RW, 928b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit), 0, sysctl_sctp_check, "IU", 929851b7298SRandall Stewart SCTPCTL_ASOC_RESOURCE_DESC); 93042551e99SRandall Stewart 931f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, heartbeat_interval, CTLTYPE_UINT | CTLFLAG_RW, 932b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default), 0, sysctl_sctp_check, "IU", 933851b7298SRandall Stewart SCTPCTL_HEARTBEAT_INTERVAL_DESC); 93442551e99SRandall Stewart 935f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, pmtu_raise_time, CTLTYPE_UINT | CTLFLAG_RW, 936b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default), 0, sysctl_sctp_check, "IU", 937851b7298SRandall Stewart SCTPCTL_PMTU_RAISE_TIME_DESC); 93842551e99SRandall Stewart 939f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, shutdown_guard_time, CTLTYPE_UINT | CTLFLAG_RW, 940b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default), 0, sysctl_sctp_check, "IU", 941851b7298SRandall Stewart SCTPCTL_SHUTDOWN_GUARD_TIME_DESC); 94242551e99SRandall Stewart 943f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, secret_lifetime, CTLTYPE_UINT | CTLFLAG_RW, 944b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_secret_lifetime_default), 0, sysctl_sctp_check, "IU", 945851b7298SRandall Stewart SCTPCTL_SECRET_LIFETIME_DESC); 94642551e99SRandall Stewart 947f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rto_max, CTLTYPE_UINT | CTLFLAG_RW, 948b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_rto_max_default), 0, sysctl_sctp_check, "IU", 949851b7298SRandall Stewart SCTPCTL_RTO_MAX_DESC); 95042551e99SRandall Stewart 951f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rto_min, CTLTYPE_UINT | CTLFLAG_RW, 952b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_rto_min_default), 0, sysctl_sctp_check, "IU", 953851b7298SRandall Stewart SCTPCTL_RTO_MIN_DESC); 95442551e99SRandall Stewart 955f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rto_initial, CTLTYPE_UINT | CTLFLAG_RW, 956b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_rto_initial_default), 0, sysctl_sctp_check, "IU", 957851b7298SRandall Stewart SCTPCTL_RTO_INITIAL_DESC); 95842551e99SRandall Stewart 959f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, init_rto_max, CTLTYPE_UINT | CTLFLAG_RW, 960b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_init_rto_max_default), 0, sysctl_sctp_check, "IU", 961851b7298SRandall Stewart SCTPCTL_INIT_RTO_MAX_DESC); 96242551e99SRandall Stewart 963f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, valid_cookie_life, CTLTYPE_UINT | CTLFLAG_RW, 964b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default), 0, sysctl_sctp_check, "IU", 965851b7298SRandall Stewart SCTPCTL_VALID_COOKIE_LIFE_DESC); 96642551e99SRandall Stewart 967f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, init_rtx_max, CTLTYPE_UINT | CTLFLAG_RW, 968b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_init_rtx_max_default), 0, sysctl_sctp_check, "IU", 969851b7298SRandall Stewart SCTPCTL_INIT_RTX_MAX_DESC); 97042551e99SRandall Stewart 971f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, assoc_rtx_max, CTLTYPE_UINT | CTLFLAG_RW, 972b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default), 0, sysctl_sctp_check, "IU", 973851b7298SRandall Stewart SCTPCTL_ASSOC_RTX_MAX_DESC); 97442551e99SRandall Stewart 975f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, path_rtx_max, CTLTYPE_UINT | CTLFLAG_RW, 976b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), 0, sysctl_sctp_check, "IU", 977851b7298SRandall Stewart SCTPCTL_PATH_RTX_MAX_DESC); 97842551e99SRandall Stewart 979ca85e948SMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, path_pf_threshold, CTLTYPE_UINT | CTLFLAG_RW, 980ca85e948SMichael Tuexen &SCTP_BASE_SYSCTL(sctp_path_pf_threshold), 0, sysctl_sctp_check, "IU", 981ca85e948SMichael Tuexen SCTPCTL_PATH_PF_THRESHOLD_DESC); 982ca85e948SMichael Tuexen 983f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, add_more_on_output, CTLTYPE_UINT | CTLFLAG_RW, 984b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_add_more_threshold), 0, sysctl_sctp_check, "IU", 985851b7298SRandall Stewart SCTPCTL_ADD_MORE_ON_OUTPUT_DESC); 98642551e99SRandall Stewart 987f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLTYPE_UINT | CTLFLAG_RW, 988b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), 0, sysctl_sctp_check, "IU", 989851b7298SRandall Stewart SCTPCTL_OUTGOING_STREAMS_DESC); 99042551e99SRandall Stewart 991f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLTYPE_UINT | CTLFLAG_RW, 992b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_cmt_on_off), 0, sysctl_sctp_check, "IU", 993851b7298SRandall Stewart SCTPCTL_CMT_ON_OFF_DESC); 99442551e99SRandall Stewart 995f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, nr_sack_on_off, CTLTYPE_UINT | CTLFLAG_RW, 996830d754dSRandall Stewart &SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), 0, sysctl_sctp_check, "IU", 997830d754dSRandall Stewart SCTPCTL_NR_SACK_ON_OFF_DESC); 998830d754dSRandall Stewart 999f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLTYPE_UINT | CTLFLAG_RW, 1000b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_cmt_use_dac), 0, sysctl_sctp_check, "IU", 1001851b7298SRandall Stewart SCTPCTL_CMT_USE_DAC_DESC); 1002b54d3a6cSRandall Stewart 1003f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, cwnd_maxburst, CTLTYPE_UINT | CTLFLAG_RW, 1004b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), 0, sysctl_sctp_check, "IU", 1005851b7298SRandall Stewart SCTPCTL_CWND_MAXBURST_DESC); 1006c4739e2fSRandall Stewart 1007f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLTYPE_UINT | CTLFLAG_RW, 1008b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), 0, sysctl_sctp_check, "IU", 1009851b7298SRandall Stewart SCTPCTL_ASCONF_AUTH_NOCHK_DESC); 1010851b7298SRandall Stewart 1011f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, auth_disable, CTLTYPE_UINT | CTLFLAG_RW, 1012b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_auth_disable), 0, sysctl_sctp_check, "IU", 1013851b7298SRandall Stewart SCTPCTL_AUTH_DISABLE_DESC); 1014851b7298SRandall Stewart 1015f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, nat_friendly, CTLTYPE_UINT | CTLFLAG_RW, 1016b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_nat_friendly), 0, sysctl_sctp_check, "IU", 1017851b7298SRandall Stewart SCTPCTL_NAT_FRIENDLY_DESC); 1018851b7298SRandall Stewart 1019f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, abc_l_var, CTLTYPE_UINT | CTLFLAG_RW, 1020b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_L2_abc_variable), 0, sysctl_sctp_check, "IU", 1021851b7298SRandall Stewart SCTPCTL_ABC_L_VAR_DESC); 1022851b7298SRandall Stewart 1023f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, max_chained_mbufs, CTLTYPE_UINT | CTLFLAG_RW, 1024b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count), 0, sysctl_sctp_check, "IU", 1025851b7298SRandall Stewart SCTPCTL_MAX_CHAINED_MBUFS_DESC); 1026851b7298SRandall Stewart 1027f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, do_sctp_drain, CTLTYPE_UINT | CTLFLAG_RW, 1028b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_do_drain), 0, sysctl_sctp_check, "IU", 1029851b7298SRandall Stewart SCTPCTL_DO_SCTP_DRAIN_DESC); 1030851b7298SRandall Stewart 1031f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, hb_max_burst, CTLTYPE_UINT | CTLFLAG_RW, 1032b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_hb_maxburst), 0, sysctl_sctp_check, "IU", 1033851b7298SRandall Stewart SCTPCTL_HB_MAX_BURST_DESC); 1034851b7298SRandall Stewart 1035f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, abort_at_limit, CTLTYPE_UINT | CTLFLAG_RW, 1036b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit), 0, sysctl_sctp_check, "IU", 1037851b7298SRandall Stewart SCTPCTL_ABORT_AT_LIMIT_DESC); 1038851b7298SRandall Stewart 1039f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, strict_data_order, CTLTYPE_UINT | CTLFLAG_RW, 1040b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_strict_data_order), 0, sysctl_sctp_check, "IU", 1041851b7298SRandall Stewart SCTPCTL_STRICT_DATA_ORDER_DESC); 1042851b7298SRandall Stewart 1043f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, min_residual, CTLTYPE_UINT | CTLFLAG_RW, 1044b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_min_residual), 0, sysctl_sctp_check, "IU", 1045851b7298SRandall Stewart SCTPCTL_MIN_RESIDUAL_DESC); 1046851b7298SRandall Stewart 1047f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLTYPE_UINT | CTLFLAG_RW, 1048b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_max_retran_chunk), 0, sysctl_sctp_check, "IU", 1049851b7298SRandall Stewart SCTPCTL_MAX_RETRAN_CHUNK_DESC); 1050851b7298SRandall Stewart 1051f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, log_level, CTLTYPE_UINT | CTLFLAG_RW, 1052b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_logging_level), 0, sysctl_sctp_check, "IU", 1053851b7298SRandall Stewart SCTPCTL_LOGGING_LEVEL_DESC); 1054851b7298SRandall Stewart 1055f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, default_cc_module, CTLTYPE_UINT | CTLFLAG_RW, 1056b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_default_cc_module), 0, sysctl_sctp_check, "IU", 1057851b7298SRandall Stewart SCTPCTL_DEFAULT_CC_MODULE_DESC); 1058851b7298SRandall Stewart 1059f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, default_ss_module, CTLTYPE_UINT | CTLFLAG_RW, 1060f7a77f6fSMichael Tuexen &SCTP_BASE_SYSCTL(sctp_default_ss_module), 0, sysctl_sctp_check, "IU", 1061f7a77f6fSMichael Tuexen SCTPCTL_DEFAULT_SS_MODULE_DESC); 1062f7a77f6fSMichael Tuexen 1063f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, default_frag_interleave, CTLTYPE_UINT | CTLFLAG_RW, 1064b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_default_frag_interleave), 0, sysctl_sctp_check, "IU", 1065c4739e2fSRandall Stewart SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DESC); 1066c4739e2fSRandall Stewart 1067f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, mobility_base, CTLTYPE_UINT | CTLFLAG_RW, 1068b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_mobility_base), 0, sysctl_sctp_check, "IU", 1069851b7298SRandall Stewart SCTPCTL_MOBILITY_BASE_DESC); 107042551e99SRandall Stewart 1071f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, mobility_fasthandoff, CTLTYPE_UINT | CTLFLAG_RW, 1072b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), 0, sysctl_sctp_check, "IU", 1073851b7298SRandall Stewart SCTPCTL_MOBILITY_FASTHANDOFF_DESC); 107442551e99SRandall Stewart 1075b27a6b7dSRandall Stewart #if defined(SCTP_LOCAL_TRACE_BUF) 1076f0878bdcSMichael Tuexen SYSCTL_VNET_STRUCT(_net_inet_sctp, OID_AUTO, log, CTLFLAG_RD, 1077b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_log), sctp_log, 1078b27a6b7dSRandall Stewart "SCTP logging (struct sctp_log)"); 1079b3f1ea41SRandall Stewart 1080f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, clear_trace, CTLTYPE_UINT | CTLFLAG_RW, 1081b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_log), 0, sysctl_sctp_cleartrace, "IU", 1082b3f1ea41SRandall Stewart "Clear SCTP Logging buffer"); 1083b27a6b7dSRandall Stewart #endif 1084b27a6b7dSRandall Stewart 1085e6194c2eSMichael Tuexen /* XXX: Remove the #if after tunneling over IPv6 works also on FreeBSD. */ 1086e6194c2eSMichael Tuexen #if !defined(__FreeBSD__) || defined(INET) 1087f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_port, CTLTYPE_UINT | CTLFLAG_RW, 1088b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), 0, sysctl_sctp_udp_tunneling_check, "IU", 1089c54a18d2SRandall Stewart SCTPCTL_UDP_TUNNELING_PORT_DESC); 1090e6194c2eSMichael Tuexen #endif 1091c54a18d2SRandall Stewart 1092f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, enable_sack_immediately, CTLTYPE_UINT | CTLFLAG_RW, 1093b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), 0, sysctl_sctp_check, "IU", 1094b3f1ea41SRandall Stewart SCTPCTL_SACK_IMMEDIATELY_ENABLE_DESC); 1095b3f1ea41SRandall Stewart 1096f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, nat_friendly_init, CTLTYPE_UINT | CTLFLAG_RW, 1097830d754dSRandall Stewart &SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), 0, sysctl_sctp_check, "IU", 1098bf3d5177SMichael Tuexen SCTPCTL_NAT_FRIENDLY_INITS_DESC); 1099830d754dSRandall Stewart 1100f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, vtag_time_wait, CTLTYPE_UINT | CTLFLAG_RW, 1101a16ccdceSRandall Stewart &SCTP_BASE_SYSCTL(sctp_vtag_time_wait), 0, sysctl_sctp_check, "IU", 1102a16ccdceSRandall Stewart SCTPCTL_TIME_WAIT_DESC); 1103a16ccdceSRandall Stewart 1104f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, buffer_splitting, CTLTYPE_UINT | CTLFLAG_RW, 110525a2a187SMichael Tuexen &SCTP_BASE_SYSCTL(sctp_buffer_splitting), 0, sysctl_sctp_check, "IU", 110625a2a187SMichael Tuexen SCTPCTL_BUFFER_SPLITTING_DESC); 110725a2a187SMichael Tuexen 1108f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, initial_cwnd, CTLTYPE_UINT | CTLFLAG_RW, 1109dcfc0625SMichael Tuexen &SCTP_BASE_SYSCTL(sctp_initial_cwnd), 0, sysctl_sctp_check, "IU", 1110dcfc0625SMichael Tuexen SCTPCTL_INITIAL_CWND_DESC); 1111dcfc0625SMichael Tuexen 1112299108c5SRandall Stewart SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rttvar_bw, CTLTYPE_UINT | CTLFLAG_RW, 1113299108c5SRandall Stewart &SCTP_BASE_SYSCTL(sctp_rttvar_bw), 0, sysctl_sctp_check, "IU", 1114299108c5SRandall Stewart SCTPCTL_RTTVAR_BW_DESC); 1115299108c5SRandall Stewart 1116299108c5SRandall Stewart SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rttvar_rtt, CTLTYPE_UINT | CTLFLAG_RW, 1117299108c5SRandall Stewart &SCTP_BASE_SYSCTL(sctp_rttvar_rtt), 0, sysctl_sctp_check, "IU", 1118299108c5SRandall Stewart SCTPCTL_RTTVAR_RTT_DESC); 1119299108c5SRandall Stewart 1120299108c5SRandall Stewart SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rttvar_eqret, CTLTYPE_UINT | CTLFLAG_RW, 1121299108c5SRandall Stewart &SCTP_BASE_SYSCTL(sctp_rttvar_eqret), 0, sysctl_sctp_check, "IU", 1122299108c5SRandall Stewart SCTPCTL_RTTVAR_EQRET_DESC); 1123299108c5SRandall Stewart 1124f79aab18SRandall Stewart SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, rttvar_steady_step, CTLTYPE_UINT | CTLFLAG_RW, 1125f79aab18SRandall Stewart &SCTP_BASE_SYSCTL(sctp_steady_step), 0, sysctl_sctp_check, "IU", 1126f79aab18SRandall Stewart SCTPCTL_RTTVAR_STEADYS_DESC); 1127f79aab18SRandall Stewart 1128f79aab18SRandall Stewart SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, use_dcccecn, CTLTYPE_UINT | CTLFLAG_RW, 1129f79aab18SRandall Stewart &SCTP_BASE_SYSCTL(sctp_use_dccc_ecn), 0, sysctl_sctp_check, "IU", 1130f79aab18SRandall Stewart SCTPCTL_RTTVAR_DCCCECN_DESC); 1131f79aab18SRandall Stewart 1132851b7298SRandall Stewart #ifdef SCTP_DEBUG 1133f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_UINT | CTLFLAG_RW, 1134b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU", 1135851b7298SRandall Stewart SCTPCTL_DEBUG_DESC); 1136f0878bdcSMichael Tuexen #endif 113742551e99SRandall Stewart 113842551e99SRandall Stewart 1139b3f1ea41SRandall Stewart #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 1140f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, output_unlocked, CTLTYPE_UINT | CTLFLAG_RW, 1141b3f1ea41SRandall Stewart &SCTP_BASE_SYSCTL(sctp_output_unlocked), 0, sysctl_sctp_check, "IU", 1142b3f1ea41SRandall Stewart SCTPCTL_OUTPUT_UNLOCKED_DESC); 1143b3f1ea41SRandall Stewart #endif 1144f0878bdcSMichael Tuexen 1145ff014514SRandall Stewart #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) 1146f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, stats, 1147ae26e0a4SRandall Stewart CTLTYPE_STRUCT | CTLFLAG_RW, 1148ff014514SRandall Stewart 0, 0, sysctl_stat_get, "S,sctpstat", 1149ff014514SRandall Stewart "SCTP statistics (struct sctp_stat)"); 1150ff014514SRandall Stewart #else 1151f0878bdcSMichael Tuexen SYSCTL_VNET_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW, 11528518270eSMichael Tuexen &SCTP_BASE_STATS_SYSCTL, sctpstat, 1153b27a6b7dSRandall Stewart "SCTP statistics (struct sctp_stat)"); 1154ff014514SRandall Stewart #endif 115542551e99SRandall Stewart 1156f0878bdcSMichael Tuexen SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLTYPE_OPAQUE | CTLFLAG_RD, 115742551e99SRandall Stewart 0, 0, sctp_assoclist, 115842551e99SRandall Stewart "S,xassoc", "List of active SCTP associations"); 1159