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