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