1 /*- 2 * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. 9 * 10 * b) Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in 12 * the documentation and/or other materials provided with the distribution. 13 * 14 * c) Neither the name of Cisco Systems, Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #include <sys/cdefs.h> 32 __FBSDID("$FreeBSD$"); 33 34 #include <netinet/sctp_os.h> 35 #include <netinet/sctp_constants.h> 36 #include <netinet/sctp_sysctl.h> 37 #include <netinet/sctp_pcb.h> 38 #include <netinet/sctputil.h> 39 #include <netinet/sctp_output.h> 40 /* 41 * sysctl tunable variables 42 */ 43 uint32_t sctp_sendspace = SCTPCTL_MAXDGRAM_DEFAULT; 44 uint32_t sctp_recvspace = SCTPCTL_RECVSPACE_DEFAULT; 45 uint32_t sctp_auto_asconf = SCTPCTL_AUTOASCONF_DEFAULT; 46 uint32_t sctp_ecn_enable = SCTPCTL_ECN_ENABLE_DEFAULT; 47 uint32_t sctp_ecn_nonce = SCTPCTL_ECN_NONCE_DEFAULT; 48 uint32_t sctp_strict_sacks = SCTPCTL_STRICT_SACKS_DEFAULT; 49 uint32_t sctp_no_csum_on_loopback = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT; 50 uint32_t sctp_strict_init = SCTPCTL_STRICT_INIT_DEFAULT; 51 uint32_t sctp_peer_chunk_oh = SCTPCTL_PEER_CHKOH_DEFAULT; 52 uint32_t sctp_max_burst_default = SCTPCTL_MAXBURST_DEFAULT; 53 uint32_t sctp_max_chunks_on_queue = SCTPCTL_MAXCHUNKS_DEFAULT; 54 uint32_t sctp_hashtblsize = SCTPCTL_TCBHASHSIZE_DEFAULT; 55 uint32_t sctp_pcbtblsize = SCTPCTL_PCBHASHSIZE_DEFAULT; 56 uint32_t sctp_min_split_point = SCTPCTL_MIN_SPLIT_POINT_DEFAULT; 57 uint32_t sctp_chunkscale = SCTPCTL_CHUNKSCALE_DEFAULT; 58 uint32_t sctp_delayed_sack_time_default = SCTPCTL_DELAYED_SACK_TIME_DEFAULT; 59 uint32_t sctp_sack_freq_default = SCTPCTL_SACK_FREQ_DEFAULT; 60 uint32_t sctp_system_free_resc_limit = SCTPCTL_SYS_RESOURCE_DEFAULT; 61 uint32_t sctp_asoc_free_resc_limit = SCTPCTL_ASOC_RESOURCE_DEFAULT; 62 uint32_t sctp_heartbeat_interval_default = SCTPCTL_HEARTBEAT_INTERVAL_DEFAULT; 63 uint32_t sctp_pmtu_raise_time_default = SCTPCTL_PMTU_RAISE_TIME_DEFAULT; 64 uint32_t sctp_shutdown_guard_time_default = SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULT; 65 uint32_t sctp_secret_lifetime_default = SCTPCTL_SECRET_LIFETIME_DEFAULT; 66 uint32_t sctp_rto_max_default = SCTPCTL_RTO_MAX_DEFAULT; 67 uint32_t sctp_rto_min_default = SCTPCTL_RTO_MIN_DEFAULT; 68 uint32_t sctp_rto_initial_default = SCTPCTL_RTO_INITIAL_DEFAULT; 69 uint32_t sctp_init_rto_max_default = SCTPCTL_INIT_RTO_MAX_DEFAULT; 70 uint32_t sctp_valid_cookie_life_default = SCTPCTL_VALID_COOKIE_LIFE_DEFAULT; 71 uint32_t sctp_init_rtx_max_default = SCTPCTL_INIT_RTX_MAX_DEFAULT; 72 uint32_t sctp_assoc_rtx_max_default = SCTPCTL_ASSOC_RTX_MAX_DEFAULT; 73 uint32_t sctp_path_rtx_max_default = SCTPCTL_PATH_RTX_MAX_DEFAULT; 74 uint32_t sctp_add_more_threshold = SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT; 75 uint32_t sctp_nr_outgoing_streams_default = SCTPCTL_OUTGOING_STREAMS_DEFAULT; 76 uint32_t sctp_cmt_on_off = SCTPCTL_CMT_ON_OFF_DEFAULT; 77 uint32_t sctp_cmt_use_dac = SCTPCTL_CMT_USE_DAC_DEFAULT; 78 uint32_t sctp_cmt_pf = SCTPCTL_CMT_PF_DEFAULT; 79 uint32_t sctp_use_cwnd_based_maxburst = SCTPCTL_CWND_MAXBURST_DEFAULT; 80 uint32_t sctp_early_fr = SCTPCTL_EARLY_FAST_RETRAN_DEFAULT; 81 uint32_t sctp_early_fr_msec = SCTPCTL_EARLY_FAST_RETRAN_MSEC_DEFAULT; 82 uint32_t sctp_asconf_auth_nochk = SCTPCTL_ASCONF_AUTH_NOCHK_DEFAULT; 83 uint32_t sctp_auth_disable = SCTPCTL_AUTH_DISABLE_DEFAULT; 84 uint32_t sctp_nat_friendly = SCTPCTL_NAT_FRIENDLY_DEFAULT; 85 uint32_t sctp_L2_abc_variable = SCTPCTL_ABC_L_VAR_DEFAULT; 86 uint32_t sctp_mbuf_threshold_count = SCTPCTL_MAX_CHAINED_MBUFS_DEFAULT; 87 uint32_t sctp_do_drain = SCTPCTL_DO_SCTP_DRAIN_DEFAULT; 88 uint32_t sctp_hb_maxburst = SCTPCTL_HB_MAX_BURST_DEFAULT; 89 uint32_t sctp_abort_if_one_2_one_hits_limit = SCTPCTL_ABORT_AT_LIMIT_DEFAULT; 90 uint32_t sctp_strict_data_order = SCTPCTL_STRICT_DATA_ORDER_DEFAULT; 91 uint32_t sctp_min_residual = SCTPCTL_MIN_RESIDUAL_DEFAULT; 92 uint32_t sctp_max_retran_chunk = SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT; 93 uint32_t sctp_logging_level = SCTPCTL_LOGGING_LEVEL_DEFAULT; 94 95 /* JRS - Variable for default congestion control module */ 96 uint32_t sctp_default_cc_module = SCTPCTL_DEFAULT_CC_MODULE_DEFAULT; 97 uint32_t sctp_default_frag_interleave = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT; 98 uint32_t sctp_mobility_base = SCTPCTL_MOBILITY_BASE_DEFAULT; 99 uint32_t sctp_mobility_fasthandoff = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT; 100 101 #ifdef SCTP_DEBUG 102 uint32_t sctp_debug_on = SCTPCTL_DEBUG_DEFAULT; 103 104 #endif 105 struct sctpstat sctpstat; 106 107 108 /* It returns an upper limit. No filtering is done here */ 109 static unsigned int 110 number_of_addresses(struct sctp_inpcb *inp) 111 { 112 int cnt; 113 struct sctp_vrf *vrf; 114 struct sctp_ifn *sctp_ifn; 115 struct sctp_ifa *sctp_ifa; 116 struct sctp_laddr *laddr; 117 118 cnt = 0; 119 /* neither Mac OS X nor FreeBSD support mulitple routing functions */ 120 if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) { 121 return (0); 122 } 123 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { 124 LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { 125 LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) { 126 if ((sctp_ifa->address.sa.sa_family == AF_INET) || 127 (sctp_ifa->address.sa.sa_family == AF_INET6)) { 128 cnt++; 129 } 130 } 131 } 132 } else { 133 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { 134 if ((laddr->ifa->address.sa.sa_family == AF_INET) || 135 (laddr->ifa->address.sa.sa_family == AF_INET6)) { 136 cnt++; 137 } 138 } 139 } 140 return (cnt); 141 } 142 143 static int 144 copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sysctl_req *req) 145 { 146 struct sctp_ifn *sctp_ifn; 147 struct sctp_ifa *sctp_ifa; 148 int loopback_scope, ipv4_local_scope, local_scope, site_scope; 149 int ipv4_addr_legal, ipv6_addr_legal; 150 struct sctp_vrf *vrf; 151 struct xsctp_laddr xladdr; 152 struct sctp_laddr *laddr; 153 int error; 154 155 /* Turn on all the appropriate scope */ 156 if (stcb) { 157 /* use association specific values */ 158 loopback_scope = stcb->asoc.loopback_scope; 159 ipv4_local_scope = stcb->asoc.ipv4_local_scope; 160 local_scope = stcb->asoc.local_scope; 161 site_scope = stcb->asoc.site_scope; 162 } else { 163 /* use generic values for endpoints */ 164 loopback_scope = 1; 165 ipv4_local_scope = 1; 166 local_scope = 1; 167 site_scope = 1; 168 } 169 170 /* use only address families of interest */ 171 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { 172 ipv6_addr_legal = 1; 173 if (SCTP_IPV6_V6ONLY(inp)) { 174 ipv4_addr_legal = 0; 175 } else { 176 ipv4_addr_legal = 1; 177 } 178 } else { 179 ipv4_addr_legal = 1; 180 ipv6_addr_legal = 0; 181 } 182 183 error = 0; 184 185 /* neither Mac OS X nor FreeBSD support mulitple routing functions */ 186 if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) { 187 SCTP_INP_RUNLOCK(inp); 188 SCTP_INP_INFO_RUNLOCK(); 189 return (-1); 190 } 191 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { 192 LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { 193 if ((loopback_scope == 0) && SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) 194 /* Skip loopback if loopback_scope not set */ 195 continue; 196 LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) { 197 if (stcb) { 198 /* 199 * ignore if blacklisted at 200 * association level 201 */ 202 if (sctp_is_addr_restricted(stcb, sctp_ifa)) 203 continue; 204 } 205 if ((sctp_ifa->address.sa.sa_family == AF_INET) && (ipv4_addr_legal)) { 206 struct sockaddr_in *sin; 207 208 sin = (struct sockaddr_in *)&sctp_ifa->address.sa; 209 if (sin->sin_addr.s_addr == 0) 210 continue; 211 if ((ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr))) 212 continue; 213 } else if ((sctp_ifa->address.sa.sa_family == AF_INET6) && (ipv6_addr_legal)) { 214 struct sockaddr_in6 *sin6; 215 216 sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sa; 217 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) 218 continue; 219 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { 220 if (local_scope == 0) 221 continue; 222 if (sin6->sin6_scope_id == 0) { 223 /* 224 * bad link local 225 * address 226 */ 227 if (sa6_recoverscope(sin6) != 0) 228 continue; 229 } 230 } 231 if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) 232 continue; 233 } else 234 continue; 235 memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr)); 236 memcpy((void *)&xladdr.address, (const void *)&sctp_ifa->address, sizeof(union sctp_sockstore)); 237 SCTP_INP_RUNLOCK(inp); 238 SCTP_INP_INFO_RUNLOCK(); 239 error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr)); 240 if (error) { 241 return (error); 242 } else { 243 SCTP_INP_INFO_RLOCK(); 244 SCTP_INP_RLOCK(inp); 245 } 246 } 247 } 248 } else { 249 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { 250 /* ignore if blacklisted at association level */ 251 if (stcb && sctp_is_addr_restricted(stcb, laddr->ifa)) 252 continue; 253 memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr)); 254 memcpy((void *)&xladdr.address, (const void *)&laddr->ifa->address, sizeof(union sctp_sockstore)); 255 xladdr.start_time.tv_sec = (uint32_t) laddr->start_time.tv_sec; 256 xladdr.start_time.tv_usec = (uint32_t) laddr->start_time.tv_usec; 257 SCTP_INP_RUNLOCK(inp); 258 SCTP_INP_INFO_RUNLOCK(); 259 error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr)); 260 if (error) { 261 return (error); 262 } else { 263 SCTP_INP_INFO_RLOCK(); 264 SCTP_INP_RLOCK(inp); 265 } 266 } 267 } 268 memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr)); 269 xladdr.last = 1; 270 SCTP_INP_RUNLOCK(inp); 271 SCTP_INP_INFO_RUNLOCK(); 272 error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr)); 273 274 if (error) { 275 return (error); 276 } else { 277 SCTP_INP_INFO_RLOCK(); 278 SCTP_INP_RLOCK(inp); 279 return (0); 280 } 281 } 282 283 /* 284 * sysctl functions 285 */ 286 static int 287 sctp_assoclist(SYSCTL_HANDLER_ARGS) 288 { 289 unsigned int number_of_endpoints; 290 unsigned int number_of_local_addresses; 291 unsigned int number_of_associations; 292 unsigned int number_of_remote_addresses; 293 unsigned int n; 294 int error; 295 struct sctp_inpcb *inp; 296 struct sctp_tcb *stcb; 297 struct sctp_nets *net; 298 struct xsctp_inpcb xinpcb; 299 struct xsctp_tcb xstcb; 300 struct xsctp_raddr xraddr; 301 302 number_of_endpoints = 0; 303 number_of_local_addresses = 0; 304 number_of_associations = 0; 305 number_of_remote_addresses = 0; 306 307 SCTP_INP_INFO_RLOCK(); 308 if (req->oldptr == USER_ADDR_NULL) { 309 LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) { 310 SCTP_INP_RLOCK(inp); 311 number_of_endpoints++; 312 number_of_local_addresses += number_of_addresses(inp); 313 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { 314 number_of_associations++; 315 number_of_local_addresses += number_of_addresses(inp); 316 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { 317 number_of_remote_addresses++; 318 } 319 } 320 SCTP_INP_RUNLOCK(inp); 321 } 322 SCTP_INP_INFO_RUNLOCK(); 323 n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) + 324 (number_of_local_addresses + number_of_endpoints + number_of_associations) * sizeof(struct xsctp_laddr) + 325 (number_of_associations + number_of_endpoints) * sizeof(struct xsctp_tcb) + 326 (number_of_remote_addresses + number_of_associations) * sizeof(struct xsctp_raddr); 327 328 /* request some more memory than needed */ 329 req->oldidx = (n + n / 8); 330 return 0; 331 } 332 if (req->newptr != USER_ADDR_NULL) { 333 SCTP_INP_INFO_RUNLOCK(); 334 SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_SYSCTL, EPERM); 335 return EPERM; 336 } 337 LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) { 338 SCTP_INP_RLOCK(inp); 339 xinpcb.last = 0; 340 xinpcb.local_port = ntohs(inp->sctp_lport); 341 xinpcb.flags = inp->sctp_flags; 342 xinpcb.features = inp->sctp_features; 343 xinpcb.total_sends = inp->total_sends; 344 xinpcb.total_recvs = inp->total_recvs; 345 xinpcb.total_nospaces = inp->total_nospaces; 346 xinpcb.fragmentation_point = inp->sctp_frag_point; 347 if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || 348 (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) { 349 xinpcb.qlen = 0; 350 xinpcb.maxqlen = 0; 351 } else { 352 xinpcb.qlen = inp->sctp_socket->so_qlen; 353 xinpcb.maxqlen = inp->sctp_socket->so_qlimit; 354 } 355 SCTP_INP_INCR_REF(inp); 356 SCTP_INP_RUNLOCK(inp); 357 SCTP_INP_INFO_RUNLOCK(); 358 error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb)); 359 if (error) { 360 SCTP_INP_DECR_REF(inp); 361 return error; 362 } 363 SCTP_INP_INFO_RLOCK(); 364 SCTP_INP_RLOCK(inp); 365 error = copy_out_local_addresses(inp, NULL, req); 366 if (error) { 367 SCTP_INP_DECR_REF(inp); 368 return error; 369 } 370 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { 371 SCTP_TCB_LOCK(stcb); 372 atomic_add_int(&stcb->asoc.refcnt, 1); 373 SCTP_TCB_UNLOCK(stcb); 374 xstcb.last = 0; 375 xstcb.local_port = ntohs(inp->sctp_lport); 376 xstcb.remote_port = ntohs(stcb->rport); 377 if (stcb->asoc.primary_destination != NULL) 378 xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr; 379 xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay; 380 xstcb.state = SCTP_GET_STATE(&stcb->asoc); /* FIXME */ 381 xstcb.in_streams = stcb->asoc.streamincnt; 382 xstcb.out_streams = stcb->asoc.streamoutcnt; 383 xstcb.max_nr_retrans = stcb->asoc.overall_error_count; 384 xstcb.primary_process = 0; /* not really supported 385 * yet */ 386 xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie; 387 xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack; 388 xstcb.retransmitted_tsns = stcb->asoc.marked_retrans; 389 xstcb.start_time.tv_sec = (uint32_t) stcb->asoc.start_time.tv_sec; 390 xstcb.start_time.tv_usec = (uint32_t) stcb->asoc.start_time.tv_usec; 391 xstcb.discontinuity_time.tv_sec = (uint32_t) stcb->asoc.discontinuity_time.tv_sec; 392 xstcb.discontinuity_time.tv_usec = (uint32_t) stcb->asoc.discontinuity_time.tv_usec; 393 xstcb.total_sends = stcb->total_sends; 394 xstcb.total_recvs = stcb->total_recvs; 395 xstcb.local_tag = stcb->asoc.my_vtag; 396 xstcb.remote_tag = stcb->asoc.peer_vtag; 397 xstcb.initial_tsn = stcb->asoc.init_seq_number; 398 xstcb.highest_tsn = stcb->asoc.sending_seq - 1; 399 xstcb.cumulative_tsn = stcb->asoc.last_acked_seq; 400 xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn; 401 xstcb.mtu = stcb->asoc.smallest_mtu; 402 xstcb.refcnt = stcb->asoc.refcnt; 403 SCTP_INP_RUNLOCK(inp); 404 SCTP_INP_INFO_RUNLOCK(); 405 error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb)); 406 if (error) { 407 SCTP_INP_DECR_REF(inp); 408 atomic_subtract_int(&stcb->asoc.refcnt, 1); 409 return error; 410 } 411 SCTP_INP_INFO_RLOCK(); 412 SCTP_INP_RLOCK(inp); 413 error = copy_out_local_addresses(inp, stcb, req); 414 if (error) { 415 SCTP_INP_DECR_REF(inp); 416 atomic_subtract_int(&stcb->asoc.refcnt, 1); 417 return error; 418 } 419 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { 420 xraddr.last = 0; 421 xraddr.address = net->ro._l_addr; 422 xraddr.active = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE); 423 xraddr.confirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0); 424 xraddr.heartbeat_enabled = ((net->dest_state & SCTP_ADDR_NOHB) == 0); 425 xraddr.rto = net->RTO; 426 xraddr.max_path_rtx = net->failure_threshold; 427 xraddr.rtx = net->marked_retrans; 428 xraddr.error_counter = net->error_count; 429 xraddr.cwnd = net->cwnd; 430 xraddr.flight_size = net->flight_size; 431 xraddr.mtu = net->mtu; 432 xraddr.start_time.tv_sec = (uint32_t) net->start_time.tv_sec; 433 xraddr.start_time.tv_usec = (uint32_t) net->start_time.tv_usec; 434 SCTP_INP_RUNLOCK(inp); 435 SCTP_INP_INFO_RUNLOCK(); 436 error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr)); 437 if (error) { 438 SCTP_INP_DECR_REF(inp); 439 atomic_subtract_int(&stcb->asoc.refcnt, 1); 440 return error; 441 } 442 SCTP_INP_INFO_RLOCK(); 443 SCTP_INP_RLOCK(inp); 444 } 445 atomic_subtract_int(&stcb->asoc.refcnt, 1); 446 memset((void *)&xraddr, 0, sizeof(struct xsctp_raddr)); 447 xraddr.last = 1; 448 SCTP_INP_RUNLOCK(inp); 449 SCTP_INP_INFO_RUNLOCK(); 450 error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr)); 451 if (error) { 452 SCTP_INP_DECR_REF(inp); 453 return error; 454 } 455 SCTP_INP_INFO_RLOCK(); 456 SCTP_INP_RLOCK(inp); 457 } 458 SCTP_INP_DECR_REF(inp); 459 SCTP_INP_RUNLOCK(inp); 460 SCTP_INP_INFO_RUNLOCK(); 461 memset((void *)&xstcb, 0, sizeof(struct xsctp_tcb)); 462 xstcb.last = 1; 463 error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb)); 464 if (error) { 465 return error; 466 } 467 SCTP_INP_INFO_RLOCK(); 468 } 469 SCTP_INP_INFO_RUNLOCK(); 470 471 memset((void *)&xinpcb, 0, sizeof(struct xsctp_inpcb)); 472 xinpcb.last = 1; 473 error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb)); 474 return error; 475 } 476 477 #define RANGECHK(var, min, max) \ 478 if ((var) < (min)) { (var) = (min); } \ 479 else if ((var) > (max)) { (var) = (max); } 480 481 static int 482 sysctl_sctp_check(SYSCTL_HANDLER_ARGS) 483 { 484 int error; 485 486 error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); 487 if (error == 0) { 488 RANGECHK(sctp_sendspace, SCTPCTL_MAXDGRAM_MIN, SCTPCTL_MAXDGRAM_MAX); 489 RANGECHK(sctp_recvspace, SCTPCTL_RECVSPACE_MIN, SCTPCTL_RECVSPACE_MAX); 490 #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF) 491 RANGECHK(sctp_auto_asconf, SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX); 492 #endif 493 RANGECHK(sctp_ecn_enable, SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX); 494 RANGECHK(sctp_ecn_nonce, SCTPCTL_ECN_NONCE_MIN, SCTPCTL_ECN_NONCE_MAX); 495 RANGECHK(sctp_strict_sacks, SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX); 496 RANGECHK(sctp_no_csum_on_loopback, SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX); 497 RANGECHK(sctp_strict_init, SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX); 498 RANGECHK(sctp_peer_chunk_oh, SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX); 499 RANGECHK(sctp_max_burst_default, SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX); 500 RANGECHK(sctp_max_chunks_on_queue, SCTPCTL_MAXCHUNKS_MIN, SCTPCTL_MAXCHUNKS_MAX); 501 RANGECHK(sctp_hashtblsize, SCTPCTL_TCBHASHSIZE_MIN, SCTPCTL_TCBHASHSIZE_MAX); 502 RANGECHK(sctp_pcbtblsize, SCTPCTL_PCBHASHSIZE_MIN, SCTPCTL_PCBHASHSIZE_MAX); 503 RANGECHK(sctp_min_split_point, SCTPCTL_MIN_SPLIT_POINT_MIN, SCTPCTL_MIN_SPLIT_POINT_MAX); 504 RANGECHK(sctp_chunkscale, SCTPCTL_CHUNKSCALE_MIN, SCTPCTL_CHUNKSCALE_MAX); 505 RANGECHK(sctp_delayed_sack_time_default, SCTPCTL_DELAYED_SACK_TIME_MIN, SCTPCTL_DELAYED_SACK_TIME_MAX); 506 RANGECHK(sctp_sack_freq_default, SCTPCTL_SACK_FREQ_MIN, SCTPCTL_SACK_FREQ_MAX); 507 RANGECHK(sctp_system_free_resc_limit, SCTPCTL_SYS_RESOURCE_MIN, SCTPCTL_SYS_RESOURCE_MAX); 508 RANGECHK(sctp_asoc_free_resc_limit, SCTPCTL_ASOC_RESOURCE_MIN, SCTPCTL_ASOC_RESOURCE_MAX); 509 RANGECHK(sctp_heartbeat_interval_default, SCTPCTL_HEARTBEAT_INTERVAL_MIN, SCTPCTL_HEARTBEAT_INTERVAL_MAX); 510 RANGECHK(sctp_pmtu_raise_time_default, SCTPCTL_PMTU_RAISE_TIME_MIN, SCTPCTL_PMTU_RAISE_TIME_MAX); 511 RANGECHK(sctp_shutdown_guard_time_default, SCTPCTL_SHUTDOWN_GUARD_TIME_MIN, SCTPCTL_SHUTDOWN_GUARD_TIME_MAX); 512 RANGECHK(sctp_secret_lifetime_default, SCTPCTL_SECRET_LIFETIME_MIN, SCTPCTL_SECRET_LIFETIME_MAX); 513 RANGECHK(sctp_rto_max_default, SCTPCTL_RTO_MAX_MIN, SCTPCTL_RTO_MAX_MAX); 514 RANGECHK(sctp_rto_min_default, SCTPCTL_RTO_MIN_MIN, SCTPCTL_RTO_MIN_MAX); 515 RANGECHK(sctp_rto_initial_default, SCTPCTL_RTO_INITIAL_MIN, SCTPCTL_RTO_INITIAL_MAX); 516 RANGECHK(sctp_init_rto_max_default, SCTPCTL_INIT_RTO_MAX_MIN, SCTPCTL_INIT_RTO_MAX_MAX); 517 RANGECHK(sctp_valid_cookie_life_default, SCTPCTL_VALID_COOKIE_LIFE_MIN, SCTPCTL_VALID_COOKIE_LIFE_MAX); 518 RANGECHK(sctp_init_rtx_max_default, SCTPCTL_INIT_RTX_MAX_MIN, SCTPCTL_INIT_RTX_MAX_MAX); 519 RANGECHK(sctp_assoc_rtx_max_default, SCTPCTL_ASSOC_RTX_MAX_MIN, SCTPCTL_ASSOC_RTX_MAX_MAX); 520 RANGECHK(sctp_path_rtx_max_default, SCTPCTL_PATH_RTX_MAX_MIN, SCTPCTL_PATH_RTX_MAX_MAX); 521 RANGECHK(sctp_add_more_threshold, SCTPCTL_ADD_MORE_ON_OUTPUT_MIN, SCTPCTL_ADD_MORE_ON_OUTPUT_MAX); 522 RANGECHK(sctp_nr_outgoing_streams_default, SCTPCTL_OUTGOING_STREAMS_MIN, SCTPCTL_OUTGOING_STREAMS_MAX); 523 RANGECHK(sctp_cmt_on_off, SCTPCTL_CMT_ON_OFF_MIN, SCTPCTL_CMT_ON_OFF_MAX); 524 RANGECHK(sctp_cmt_use_dac, SCTPCTL_CMT_USE_DAC_MIN, SCTPCTL_CMT_USE_DAC_MAX); 525 RANGECHK(sctp_cmt_pf, SCTPCTL_CMT_PF_MIN, SCTPCTL_CMT_PF_MAX); 526 RANGECHK(sctp_use_cwnd_based_maxburst, SCTPCTL_CWND_MAXBURST_MIN, SCTPCTL_CWND_MAXBURST_MAX); 527 RANGECHK(sctp_early_fr, SCTPCTL_EARLY_FAST_RETRAN_MIN, SCTPCTL_EARLY_FAST_RETRAN_MAX); 528 RANGECHK(sctp_early_fr_msec, SCTPCTL_EARLY_FAST_RETRAN_MSEC_MIN, SCTPCTL_EARLY_FAST_RETRAN_MSEC_MAX); 529 RANGECHK(sctp_asconf_auth_nochk, SCTPCTL_ASCONF_AUTH_NOCHK_MIN, SCTPCTL_ASCONF_AUTH_NOCHK_MAX); 530 RANGECHK(sctp_auth_disable, SCTPCTL_AUTH_DISABLE_MIN, SCTPCTL_AUTH_DISABLE_MAX); 531 RANGECHK(sctp_nat_friendly, SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX); 532 RANGECHK(sctp_L2_abc_variable, SCTPCTL_ABC_L_VAR_MIN, SCTPCTL_ABC_L_VAR_MAX); 533 RANGECHK(sctp_mbuf_threshold_count, SCTPCTL_MAX_CHAINED_MBUFS_MIN, SCTPCTL_MAX_CHAINED_MBUFS_MAX); 534 RANGECHK(sctp_do_drain, SCTPCTL_DO_SCTP_DRAIN_MIN, SCTPCTL_DO_SCTP_DRAIN_MAX); 535 RANGECHK(sctp_hb_maxburst, SCTPCTL_HB_MAX_BURST_MIN, SCTPCTL_HB_MAX_BURST_MAX); 536 RANGECHK(sctp_abort_if_one_2_one_hits_limit, SCTPCTL_ABORT_AT_LIMIT_MIN, SCTPCTL_ABORT_AT_LIMIT_MAX); 537 RANGECHK(sctp_strict_data_order, SCTPCTL_STRICT_DATA_ORDER_MIN, SCTPCTL_STRICT_DATA_ORDER_MAX); 538 RANGECHK(sctp_min_residual, SCTPCTL_MIN_RESIDUAL_MIN, SCTPCTL_MIN_RESIDUAL_MAX); 539 RANGECHK(sctp_max_retran_chunk, SCTPCTL_MAX_RETRAN_CHUNK_MIN, SCTPCTL_MAX_RETRAN_CHUNK_MAX); 540 RANGECHK(sctp_logging_level, SCTPCTL_LOGGING_LEVEL_MIN, SCTPCTL_LOGGING_LEVEL_MAX); 541 RANGECHK(sctp_default_cc_module, SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX); 542 RANGECHK(sctp_default_frag_interleave, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX); 543 #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE) 544 RANGECHK(sctp_mobility_base, SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX); 545 #endif 546 #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF) 547 RANGECHK(sctp_mobility_fasthandoff, SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX); 548 #endif 549 #ifdef SCTP_DEBUG 550 RANGECHK(sctp_debug_on, SCTPCTL_DEBUG_MIN, SCTPCTL_DEBUG_MAX); 551 #endif 552 } 553 return (error); 554 } 555 556 /* 557 * sysctl definitions 558 */ 559 560 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sendspace, CTLTYPE_INT | CTLFLAG_RW, 561 &sctp_sendspace, 0, sysctl_sctp_check, "IU", 562 SCTPCTL_MAXDGRAM_DESC); 563 564 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, recvspace, CTLTYPE_INT | CTLFLAG_RW, 565 &sctp_recvspace, 0, sysctl_sctp_check, "IU", 566 SCTPCTL_RECVSPACE_DESC); 567 568 #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF) 569 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auto_asconf, CTLTYPE_INT | CTLFLAG_RW, 570 &sctp_auto_asconf, 0, sysctl_sctp_check, "IU", 571 SCTPCTL_AUTOASCONF_DESC); 572 #endif 573 574 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_enable, CTLTYPE_INT | CTLFLAG_RW, 575 &sctp_ecn_enable, 0, sysctl_sctp_check, "IU", 576 SCTPCTL_ECN_ENABLE_DESC); 577 578 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_nonce, CTLTYPE_INT | CTLFLAG_RW, 579 &sctp_ecn_nonce, 0, sysctl_sctp_check, "IU", 580 SCTPCTL_ECN_NONCE_DESC); 581 582 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_INT | CTLFLAG_RW, 583 &sctp_strict_sacks, 0, sysctl_sctp_check, "IU", 584 SCTPCTL_STRICT_SACKS_DESC); 585 586 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_INT | CTLFLAG_RW, 587 &sctp_no_csum_on_loopback, 0, sysctl_sctp_check, "IU", 588 SCTPCTL_LOOPBACK_NOCSUM_DESC); 589 590 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_INT | CTLFLAG_RW, 591 &sctp_strict_init, 0, sysctl_sctp_check, "IU", 592 SCTPCTL_STRICT_INIT_DESC); 593 594 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_INT | CTLFLAG_RW, 595 &sctp_peer_chunk_oh, 0, sysctl_sctp_check, "IU", 596 SCTPCTL_PEER_CHKOH_DESC); 597 598 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxburst, CTLTYPE_INT | CTLFLAG_RW, 599 &sctp_max_burst_default, 0, sysctl_sctp_check, "IU", 600 SCTPCTL_MAXBURST_DESC); 601 602 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxchunks, CTLTYPE_INT | CTLFLAG_RW, 603 &sctp_max_chunks_on_queue, 0, sysctl_sctp_check, "IU", 604 SCTPCTL_MAXCHUNKS_DESC); 605 606 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, tcbhashsize, CTLTYPE_INT | CTLFLAG_RW, 607 &sctp_hashtblsize, 0, sysctl_sctp_check, "IU", 608 SCTPCTL_TCBHASHSIZE_DESC); 609 610 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pcbhashsize, CTLTYPE_INT | CTLFLAG_RW, 611 &sctp_pcbtblsize, 0, sysctl_sctp_check, "IU", 612 SCTPCTL_PCBHASHSIZE_DESC); 613 614 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_split_point, CTLTYPE_INT | CTLFLAG_RW, 615 &sctp_min_split_point, 0, sysctl_sctp_check, "IU", 616 SCTPCTL_MIN_SPLIT_POINT_DESC); 617 618 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, chunkscale, CTLTYPE_INT | CTLFLAG_RW, 619 &sctp_chunkscale, 0, sysctl_sctp_check, "IU", 620 SCTPCTL_CHUNKSCALE_DESC); 621 622 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, delayed_sack_time, CTLTYPE_INT | CTLFLAG_RW, 623 &sctp_delayed_sack_time_default, 0, sysctl_sctp_check, "IU", 624 SCTPCTL_DELAYED_SACK_TIME_DESC); 625 626 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sack_freq, CTLTYPE_INT | CTLFLAG_RW, 627 &sctp_sack_freq_default, 0, sysctl_sctp_check, "IU", 628 SCTPCTL_SACK_FREQ_DESC); 629 630 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sys_resource, CTLTYPE_INT | CTLFLAG_RW, 631 &sctp_system_free_resc_limit, 0, sysctl_sctp_check, "IU", 632 SCTPCTL_SYS_RESOURCE_DESC); 633 634 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asoc_resource, CTLTYPE_INT | CTLFLAG_RW, 635 &sctp_asoc_free_resc_limit, 0, sysctl_sctp_check, "IU", 636 SCTPCTL_ASOC_RESOURCE_DESC); 637 638 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, heartbeat_interval, CTLTYPE_INT | CTLFLAG_RW, 639 &sctp_heartbeat_interval_default, 0, sysctl_sctp_check, "IU", 640 SCTPCTL_HEARTBEAT_INTERVAL_DESC); 641 642 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pmtu_raise_time, CTLTYPE_INT | CTLFLAG_RW, 643 &sctp_pmtu_raise_time_default, 0, sysctl_sctp_check, "IU", 644 SCTPCTL_PMTU_RAISE_TIME_DESC); 645 646 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, shutdown_guard_time, CTLTYPE_INT | CTLFLAG_RW, 647 &sctp_shutdown_guard_time_default, 0, sysctl_sctp_check, "IU", 648 SCTPCTL_SHUTDOWN_GUARD_TIME_DESC); 649 650 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, secret_lifetime, CTLTYPE_INT | CTLFLAG_RW, 651 &sctp_secret_lifetime_default, 0, sysctl_sctp_check, "IU", 652 SCTPCTL_SECRET_LIFETIME_DESC); 653 654 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_max, CTLTYPE_INT | CTLFLAG_RW, 655 &sctp_rto_max_default, 0, sysctl_sctp_check, "IU", 656 SCTPCTL_RTO_MAX_DESC); 657 658 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_min, CTLTYPE_INT | CTLFLAG_RW, 659 &sctp_rto_min_default, 0, sysctl_sctp_check, "IU", 660 SCTPCTL_RTO_MIN_DESC); 661 662 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_initial, CTLTYPE_INT | CTLFLAG_RW, 663 &sctp_rto_initial_default, 0, sysctl_sctp_check, "IU", 664 SCTPCTL_RTO_INITIAL_DESC); 665 666 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rto_max, CTLTYPE_INT | CTLFLAG_RW, 667 &sctp_init_rto_max_default, 0, sysctl_sctp_check, "IU", 668 SCTPCTL_INIT_RTO_MAX_DESC); 669 670 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, valid_cookie_life, CTLTYPE_INT | CTLFLAG_RW, 671 &sctp_valid_cookie_life_default, 0, sysctl_sctp_check, "IU", 672 SCTPCTL_VALID_COOKIE_LIFE_DESC); 673 674 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rtx_max, CTLTYPE_INT | CTLFLAG_RW, 675 &sctp_init_rtx_max_default, 0, sysctl_sctp_check, "IU", 676 SCTPCTL_INIT_RTX_MAX_DESC); 677 678 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoc_rtx_max, CTLTYPE_INT | CTLFLAG_RW, 679 &sctp_assoc_rtx_max_default, 0, sysctl_sctp_check, "IU", 680 SCTPCTL_ASSOC_RTX_MAX_DESC); 681 682 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, path_rtx_max, CTLTYPE_INT | CTLFLAG_RW, 683 &sctp_path_rtx_max_default, 0, sysctl_sctp_check, "IU", 684 SCTPCTL_PATH_RTX_MAX_DESC); 685 686 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, add_more_on_output, CTLTYPE_INT | CTLFLAG_RW, 687 &sctp_add_more_threshold, 0, sysctl_sctp_check, "IU", 688 SCTPCTL_ADD_MORE_ON_OUTPUT_DESC); 689 690 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLTYPE_INT | CTLFLAG_RW, 691 &sctp_nr_outgoing_streams_default, 0, sysctl_sctp_check, "IU", 692 SCTPCTL_OUTGOING_STREAMS_DESC); 693 694 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLTYPE_INT | CTLFLAG_RW, 695 &sctp_cmt_on_off, 0, sysctl_sctp_check, "IU", 696 SCTPCTL_CMT_ON_OFF_DESC); 697 698 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLTYPE_INT | CTLFLAG_RW, 699 &sctp_cmt_use_dac, 0, sysctl_sctp_check, "IU", 700 SCTPCTL_CMT_USE_DAC_DESC); 701 702 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_pf, CTLTYPE_INT | CTLFLAG_RW, 703 &sctp_cmt_pf, 0, sysctl_sctp_check, "IU", 704 SCTPCTL_CMT_PF_DESC); 705 706 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cwnd_maxburst, CTLTYPE_INT | CTLFLAG_RW, 707 &sctp_use_cwnd_based_maxburst, 0, sysctl_sctp_check, "IU", 708 SCTPCTL_CWND_MAXBURST_DESC); 709 710 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran, CTLTYPE_INT | CTLFLAG_RW, 711 &sctp_early_fr, 0, sysctl_sctp_check, "IU", 712 SCTPCTL_EARLY_FAST_RETRAN_DESC); 713 714 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran_msec, CTLTYPE_INT | CTLFLAG_RW, 715 &sctp_early_fr_msec, 0, sysctl_sctp_check, "IU", 716 SCTPCTL_EARLY_FAST_RETRAN_MSEC_DESC); 717 718 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLTYPE_INT | CTLFLAG_RW, 719 &sctp_asconf_auth_nochk, 0, sysctl_sctp_check, "IU", 720 SCTPCTL_ASCONF_AUTH_NOCHK_DESC); 721 722 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auth_disable, CTLTYPE_INT | CTLFLAG_RW, 723 &sctp_auth_disable, 0, sysctl_sctp_check, "IU", 724 SCTPCTL_AUTH_DISABLE_DESC); 725 726 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nat_friendly, CTLTYPE_INT | CTLFLAG_RW, 727 &sctp_nat_friendly, 0, sysctl_sctp_check, "IU", 728 SCTPCTL_NAT_FRIENDLY_DESC); 729 730 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abc_l_var, CTLTYPE_INT | CTLFLAG_RW, 731 &sctp_L2_abc_variable, 0, sysctl_sctp_check, "IU", 732 SCTPCTL_ABC_L_VAR_DESC); 733 734 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_chained_mbufs, CTLTYPE_INT | CTLFLAG_RW, 735 &sctp_mbuf_threshold_count, 0, sysctl_sctp_check, "IU", 736 SCTPCTL_MAX_CHAINED_MBUFS_DESC); 737 738 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, do_sctp_drain, CTLTYPE_INT | CTLFLAG_RW, 739 &sctp_do_drain, 0, sysctl_sctp_check, "IU", 740 SCTPCTL_DO_SCTP_DRAIN_DESC); 741 742 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, hb_max_burst, CTLTYPE_INT | CTLFLAG_RW, 743 &sctp_hb_maxburst, 0, sysctl_sctp_check, "IU", 744 SCTPCTL_HB_MAX_BURST_DESC); 745 746 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abort_at_limit, CTLTYPE_INT | CTLFLAG_RW, 747 &sctp_abort_if_one_2_one_hits_limit, 0, sysctl_sctp_check, "IU", 748 SCTPCTL_ABORT_AT_LIMIT_DESC); 749 750 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_data_order, CTLTYPE_INT | CTLFLAG_RW, 751 &sctp_strict_data_order, 0, sysctl_sctp_check, "IU", 752 SCTPCTL_STRICT_DATA_ORDER_DESC); 753 754 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_residual, CTLTYPE_INT | CTLFLAG_RW, 755 &sctp_min_residual, 0, sysctl_sctp_check, "IU", 756 SCTPCTL_MIN_RESIDUAL_DESC); 757 758 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLTYPE_INT | CTLFLAG_RW, 759 &sctp_max_retran_chunk, 0, sysctl_sctp_check, "IU", 760 SCTPCTL_MAX_RETRAN_CHUNK_DESC); 761 762 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, logging, CTLTYPE_INT | CTLFLAG_RW, 763 &sctp_logging_level, 0, sysctl_sctp_check, "IU", 764 SCTPCTL_LOGGING_LEVEL_DESC); 765 766 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_cc_module, CTLTYPE_INT | CTLFLAG_RW, 767 &sctp_default_cc_module, 0, sysctl_sctp_check, "IU", 768 SCTPCTL_DEFAULT_CC_MODULE_DESC); 769 770 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_frag_interleave, CTLTYPE_INT | CTLFLAG_RW, 771 &sctp_default_frag_interleave, 0, sysctl_sctp_check, "IU", 772 SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DESC); 773 774 #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE) 775 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_base, CTLTYPE_INT | CTLFLAG_RW, 776 &sctp_mobility_base, 0, sysctl_sctp_check, "IU", 777 SCTPCTL_MOBILITY_BASE_DESC); 778 #endif 779 780 #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF) 781 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_fasthandoff, CTLTYPE_INT | CTLFLAG_RW, 782 &sctp_mobility_fasthandoff, 0, sysctl_sctp_check, "IU", 783 SCTPCTL_MOBILITY_FASTHANDOFF_DESC); 784 #endif 785 786 #ifdef SCTP_DEBUG 787 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW, 788 &sctp_debug_on, 0, sysctl_sctp_check, "IU", 789 SCTPCTL_DEBUG_DESC); 790 #endif /* SCTP_DEBUG */ 791 792 793 SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW, 794 &sctpstat, sctpstat, 795 "SCTP statistics (struct sctps_stat, netinet/sctp.h"); 796 797 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD, 798 0, 0, sctp_assoclist, 799 "S,xassoc", "List of active SCTP associations"); 800