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