xref: /freebsd/sys/netinet/sctp_sysctl.c (revision 851b7298b3f8f09d1a337bcd5bbe7222543872f5)
142551e99SRandall Stewart /*-
2b1006367SRandall Stewart  * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved.
342551e99SRandall Stewart  *
442551e99SRandall Stewart  * Redistribution and use in source and binary forms, with or without
542551e99SRandall Stewart  * modification, are permitted provided that the following conditions are met:
642551e99SRandall Stewart  *
742551e99SRandall Stewart  * a) Redistributions of source code must retain the above copyright notice,
842551e99SRandall Stewart  *   this list of conditions and the following disclaimer.
942551e99SRandall Stewart  *
1042551e99SRandall Stewart  * b) Redistributions in binary form must reproduce the above copyright
1142551e99SRandall Stewart  *    notice, this list of conditions and the following disclaimer in
1242551e99SRandall Stewart  *   the documentation and/or other materials provided with the distribution.
1342551e99SRandall Stewart  *
1442551e99SRandall Stewart  * c) Neither the name of Cisco Systems, Inc. nor the names of its
1542551e99SRandall Stewart  *    contributors may be used to endorse or promote products derived
1642551e99SRandall Stewart  *    from this software without specific prior written permission.
1742551e99SRandall Stewart  *
1842551e99SRandall Stewart  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1942551e99SRandall Stewart  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
2042551e99SRandall Stewart  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2142551e99SRandall Stewart  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2242551e99SRandall Stewart  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2342551e99SRandall Stewart  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2442551e99SRandall Stewart  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2542551e99SRandall Stewart  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2642551e99SRandall Stewart  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2742551e99SRandall Stewart  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2842551e99SRandall Stewart  * THE POSSIBILITY OF SUCH DAMAGE.
2942551e99SRandall Stewart  */
3042551e99SRandall Stewart 
3142551e99SRandall Stewart #include <sys/cdefs.h>
3242551e99SRandall Stewart __FBSDID("$FreeBSD$");
3342551e99SRandall Stewart 
3442551e99SRandall Stewart #include <netinet/sctp_os.h>
3542551e99SRandall Stewart #include <netinet/sctp_constants.h>
3642551e99SRandall Stewart #include <netinet/sctp_sysctl.h>
3742551e99SRandall Stewart #include <netinet/sctp_pcb.h>
3842551e99SRandall Stewart #include <netinet/sctputil.h>
39d61a0ae0SRandall Stewart #include <netinet/sctp_output.h>
4042551e99SRandall Stewart /*
4142551e99SRandall Stewart  * sysctl tunable variables
4242551e99SRandall Stewart  */
43851b7298SRandall Stewart uint32_t sctp_sendspace = SCTPCTL_MAXDGRAM_DEFAULT;
44851b7298SRandall Stewart uint32_t sctp_recvspace = SCTPCTL_RECVSPACE_DEFAULT;
45851b7298SRandall Stewart uint32_t sctp_auto_asconf = SCTPCTL_AUTOASCONF_DEFAULT;
46851b7298SRandall Stewart uint32_t sctp_ecn_enable = SCTPCTL_ECN_ENABLE_DEFAULT;
47851b7298SRandall Stewart uint32_t sctp_ecn_nonce = SCTPCTL_ECN_NONCE_DEFAULT;
48851b7298SRandall Stewart uint32_t sctp_strict_sacks = SCTPCTL_STRICT_SACKS_DEFAULT;
49851b7298SRandall Stewart uint32_t sctp_no_csum_on_loopback = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT;
50851b7298SRandall Stewart uint32_t sctp_strict_init = SCTPCTL_STRICT_INIT_DEFAULT;
519a972525SRandall Stewart uint32_t sctp_peer_chunk_oh = SCTPCTL_PEER_CHKOH_DEFAULT;
52851b7298SRandall Stewart uint32_t sctp_max_burst_default = SCTPCTL_MAXBURST_DEFAULT;
53851b7298SRandall Stewart uint32_t sctp_max_chunks_on_queue = SCTPCTL_MAXCHUNKS_DEFAULT;
54851b7298SRandall Stewart uint32_t sctp_hashtblsize = SCTPCTL_TCBHASHSIZE_DEFAULT;
55851b7298SRandall Stewart uint32_t sctp_pcbtblsize = SCTPCTL_PCBHASHSIZE_DEFAULT;
56851b7298SRandall Stewart uint32_t sctp_min_split_point = SCTPCTL_MIN_SPLIT_POINT_DEFAULT;
57851b7298SRandall Stewart uint32_t sctp_chunkscale = SCTPCTL_CHUNKSCALE_DEFAULT;
58851b7298SRandall Stewart uint32_t sctp_delayed_sack_time_default = SCTPCTL_DELAYED_SACK_TIME_DEFAULT;
59851b7298SRandall Stewart uint32_t sctp_sack_freq_default = SCTPCTL_SACK_FREQ_DEFAULT;
60851b7298SRandall Stewart uint32_t sctp_system_free_resc_limit = SCTPCTL_SYS_RESOURCE_DEFAULT;
61851b7298SRandall Stewart uint32_t sctp_asoc_free_resc_limit = SCTPCTL_ASOC_RESOURCE_DEFAULT;
62851b7298SRandall Stewart uint32_t sctp_heartbeat_interval_default = SCTPCTL_HEARTBEAT_INTERVAL_DEFAULT;
63851b7298SRandall Stewart uint32_t sctp_pmtu_raise_time_default = SCTPCTL_PMTU_RAISE_TIME_DEFAULT;
64851b7298SRandall Stewart uint32_t sctp_shutdown_guard_time_default = SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULT;
65851b7298SRandall Stewart uint32_t sctp_secret_lifetime_default = SCTPCTL_SECRET_LIFETIME_DEFAULT;
66851b7298SRandall Stewart uint32_t sctp_rto_max_default = SCTPCTL_RTO_MAX_DEFAULT;
67851b7298SRandall Stewart uint32_t sctp_rto_min_default = SCTPCTL_RTO_MIN_DEFAULT;
68851b7298SRandall Stewart uint32_t sctp_rto_initial_default = SCTPCTL_RTO_INITIAL_DEFAULT;
69851b7298SRandall Stewart uint32_t sctp_init_rto_max_default = SCTPCTL_INIT_RTO_MAX_DEFAULT;
70851b7298SRandall Stewart uint32_t sctp_valid_cookie_life_default = SCTPCTL_VALID_COOKIE_LIFE_DEFAULT;
71851b7298SRandall Stewart uint32_t sctp_init_rtx_max_default = SCTPCTL_INIT_RTX_MAX_DEFAULT;
72851b7298SRandall Stewart uint32_t sctp_assoc_rtx_max_default = SCTPCTL_ASSOC_RTX_MAX_DEFAULT;
73851b7298SRandall Stewart uint32_t sctp_path_rtx_max_default = SCTPCTL_PATH_RTX_MAX_DEFAULT;
74851b7298SRandall Stewart uint32_t sctp_add_more_threshold = SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT;
75851b7298SRandall Stewart uint32_t sctp_nr_outgoing_streams_default = SCTPCTL_OUTGOING_STREAMS_DEFAULT;
76851b7298SRandall Stewart uint32_t sctp_cmt_on_off = SCTPCTL_CMT_ON_OFF_DEFAULT;
77851b7298SRandall Stewart uint32_t sctp_cmt_use_dac = SCTPCTL_CMT_USE_DAC_DEFAULT;
78851b7298SRandall Stewart uint32_t sctp_cmt_pf = SCTPCTL_CMT_PF_DEFAULT;
79851b7298SRandall Stewart uint32_t sctp_use_cwnd_based_maxburst = SCTPCTL_CWND_MAXBURST_DEFAULT;
80851b7298SRandall Stewart uint32_t sctp_early_fr = SCTPCTL_EARLY_FAST_RETRAN_DEFAULT;
81851b7298SRandall Stewart uint32_t sctp_early_fr_msec = SCTPCTL_EARLY_FAST_RETRAN_MSEC_DEFAULT;
82851b7298SRandall Stewart uint32_t sctp_asconf_auth_nochk = SCTPCTL_ASCONF_AUTH_NOCHK_DEFAULT;
83851b7298SRandall Stewart uint32_t sctp_auth_disable = SCTPCTL_AUTH_DISABLE_DEFAULT;
84851b7298SRandall Stewart uint32_t sctp_nat_friendly = SCTPCTL_NAT_FRIENDLY_DEFAULT;
85851b7298SRandall Stewart uint32_t sctp_L2_abc_variable = SCTPCTL_ABC_L_VAR_DEFAULT;
86851b7298SRandall Stewart uint32_t sctp_mbuf_threshold_count = SCTPCTL_MAX_CHAINED_MBUFS_DEFAULT;
87851b7298SRandall Stewart uint32_t sctp_do_drain = SCTPCTL_DO_SCTP_DRAIN_DEFAULT;
88851b7298SRandall Stewart uint32_t sctp_hb_maxburst = SCTPCTL_HB_MAX_BURST_DEFAULT;
89851b7298SRandall Stewart uint32_t sctp_abort_if_one_2_one_hits_limit = SCTPCTL_ABORT_AT_LIMIT_DEFAULT;
90851b7298SRandall Stewart uint32_t sctp_strict_data_order = SCTPCTL_STRICT_DATA_ORDER_DEFAULT;
91851b7298SRandall Stewart uint32_t sctp_min_residual = SCTPCTL_MIN_RESIDUAL_DEFAULT;
92bff64a4dSRandall Stewart uint32_t sctp_max_retran_chunk = SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT;
93851b7298SRandall Stewart uint32_t sctp_logging_level = SCTPCTL_LOGGING_LEVEL_DEFAULT;
945e54f665SRandall Stewart 
95b54d3a6cSRandall Stewart /* JRS - Variable for default congestion control module */
96b54d3a6cSRandall Stewart uint32_t sctp_default_cc_module = SCTPCTL_DEFAULT_CC_MODULE_DEFAULT;
97c4739e2fSRandall Stewart uint32_t sctp_default_frag_interleave = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT;
98851b7298SRandall Stewart uint32_t sctp_mobility_base = SCTPCTL_MOBILITY_BASE_DEFAULT;
99851b7298SRandall Stewart uint32_t sctp_mobility_fasthandoff = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT;
10042551e99SRandall Stewart 
10142551e99SRandall Stewart #ifdef SCTP_DEBUG
102851b7298SRandall Stewart uint32_t sctp_debug_on = SCTPCTL_DEBUG_DEFAULT;
10342551e99SRandall Stewart 
10442551e99SRandall Stewart #endif
105851b7298SRandall Stewart struct sctpstat sctpstat;
10642551e99SRandall Stewart 
107d61a0ae0SRandall Stewart 
108d61a0ae0SRandall Stewart /* It returns an upper limit. No filtering is done here */
109d61a0ae0SRandall Stewart static unsigned int
110d61a0ae0SRandall Stewart number_of_addresses(struct sctp_inpcb *inp)
111d61a0ae0SRandall Stewart {
112d61a0ae0SRandall Stewart 	int cnt;
113d61a0ae0SRandall Stewart 	struct sctp_vrf *vrf;
114d61a0ae0SRandall Stewart 	struct sctp_ifn *sctp_ifn;
115d61a0ae0SRandall Stewart 	struct sctp_ifa *sctp_ifa;
116d61a0ae0SRandall Stewart 	struct sctp_laddr *laddr;
117d61a0ae0SRandall Stewart 
118d61a0ae0SRandall Stewart 	cnt = 0;
119d61a0ae0SRandall Stewart 	/* neither Mac OS X nor FreeBSD support mulitple routing functions */
120d61a0ae0SRandall Stewart 	if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) {
121d61a0ae0SRandall Stewart 		return (0);
122d61a0ae0SRandall Stewart 	}
123d61a0ae0SRandall Stewart 	if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
124d61a0ae0SRandall Stewart 		LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
125d61a0ae0SRandall Stewart 			LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
126d61a0ae0SRandall Stewart 				if ((sctp_ifa->address.sa.sa_family == AF_INET) ||
127d61a0ae0SRandall Stewart 				    (sctp_ifa->address.sa.sa_family == AF_INET6)) {
128d61a0ae0SRandall Stewart 					cnt++;
129d61a0ae0SRandall Stewart 				}
130d61a0ae0SRandall Stewart 			}
131d61a0ae0SRandall Stewart 		}
132d61a0ae0SRandall Stewart 	} else {
133d61a0ae0SRandall Stewart 		LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
134d61a0ae0SRandall Stewart 			if ((laddr->ifa->address.sa.sa_family == AF_INET) ||
135d61a0ae0SRandall Stewart 			    (laddr->ifa->address.sa.sa_family == AF_INET6)) {
136d61a0ae0SRandall Stewart 				cnt++;
137d61a0ae0SRandall Stewart 			}
138d61a0ae0SRandall Stewart 		}
139d61a0ae0SRandall Stewart 	}
140d61a0ae0SRandall Stewart 	return (cnt);
141d61a0ae0SRandall Stewart }
142d61a0ae0SRandall Stewart 
143d61a0ae0SRandall Stewart static int
144d61a0ae0SRandall Stewart copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sysctl_req *req)
145d61a0ae0SRandall Stewart {
146d61a0ae0SRandall Stewart 	struct sctp_ifn *sctp_ifn;
147d61a0ae0SRandall Stewart 	struct sctp_ifa *sctp_ifa;
148d61a0ae0SRandall Stewart 	int loopback_scope, ipv4_local_scope, local_scope, site_scope;
149d61a0ae0SRandall Stewart 	int ipv4_addr_legal, ipv6_addr_legal;
150d61a0ae0SRandall Stewart 	struct sctp_vrf *vrf;
151d61a0ae0SRandall Stewart 	struct xsctp_laddr xladdr;
152d61a0ae0SRandall Stewart 	struct sctp_laddr *laddr;
153d61a0ae0SRandall Stewart 	int error;
154d61a0ae0SRandall Stewart 
155d61a0ae0SRandall Stewart 	/* Turn on all the appropriate scope */
156d61a0ae0SRandall Stewart 	if (stcb) {
157d61a0ae0SRandall Stewart 		/* use association specific values */
158d61a0ae0SRandall Stewart 		loopback_scope = stcb->asoc.loopback_scope;
159d61a0ae0SRandall Stewart 		ipv4_local_scope = stcb->asoc.ipv4_local_scope;
160d61a0ae0SRandall Stewart 		local_scope = stcb->asoc.local_scope;
161d61a0ae0SRandall Stewart 		site_scope = stcb->asoc.site_scope;
162d61a0ae0SRandall Stewart 	} else {
163d61a0ae0SRandall Stewart 		/* use generic values for endpoints */
164d61a0ae0SRandall Stewart 		loopback_scope = 1;
165d61a0ae0SRandall Stewart 		ipv4_local_scope = 1;
166d61a0ae0SRandall Stewart 		local_scope = 1;
167d61a0ae0SRandall Stewart 		site_scope = 1;
168d61a0ae0SRandall Stewart 	}
169d61a0ae0SRandall Stewart 
170d61a0ae0SRandall Stewart 	/* use only address families of interest */
171d61a0ae0SRandall Stewart 	if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
172d61a0ae0SRandall Stewart 		ipv6_addr_legal = 1;
173d61a0ae0SRandall Stewart 		if (SCTP_IPV6_V6ONLY(inp)) {
174d61a0ae0SRandall Stewart 			ipv4_addr_legal = 0;
175d61a0ae0SRandall Stewart 		} else {
176d61a0ae0SRandall Stewart 			ipv4_addr_legal = 1;
177d61a0ae0SRandall Stewart 		}
178d61a0ae0SRandall Stewart 	} else {
179d61a0ae0SRandall Stewart 		ipv4_addr_legal = 1;
180d61a0ae0SRandall Stewart 		ipv6_addr_legal = 0;
181d61a0ae0SRandall Stewart 	}
182d61a0ae0SRandall Stewart 
183d61a0ae0SRandall Stewart 	error = 0;
184d61a0ae0SRandall Stewart 
185d61a0ae0SRandall Stewart 	/* neither Mac OS X nor FreeBSD support mulitple routing functions */
186d61a0ae0SRandall Stewart 	if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) {
1875f26a41dSRandall Stewart 		SCTP_INP_RUNLOCK(inp);
1885f26a41dSRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
189d61a0ae0SRandall Stewart 		return (-1);
190d61a0ae0SRandall Stewart 	}
191d61a0ae0SRandall Stewart 	if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
192d61a0ae0SRandall Stewart 		LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
193d61a0ae0SRandall Stewart 			if ((loopback_scope == 0) && SCTP_IFN_IS_IFT_LOOP(sctp_ifn))
194d61a0ae0SRandall Stewart 				/* Skip loopback if loopback_scope not set */
195d61a0ae0SRandall Stewart 				continue;
196d61a0ae0SRandall Stewart 			LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
197d61a0ae0SRandall Stewart 				if (stcb) {
198d61a0ae0SRandall Stewart 					/*
199d61a0ae0SRandall Stewart 					 * ignore if blacklisted at
200d61a0ae0SRandall Stewart 					 * association level
201d61a0ae0SRandall Stewart 					 */
202d61a0ae0SRandall Stewart 					if (sctp_is_addr_restricted(stcb, sctp_ifa))
203d61a0ae0SRandall Stewart 						continue;
204d61a0ae0SRandall Stewart 				}
205d61a0ae0SRandall Stewart 				if ((sctp_ifa->address.sa.sa_family == AF_INET) && (ipv4_addr_legal)) {
206d61a0ae0SRandall Stewart 					struct sockaddr_in *sin;
207d61a0ae0SRandall Stewart 
208d61a0ae0SRandall Stewart 					sin = (struct sockaddr_in *)&sctp_ifa->address.sa;
209d61a0ae0SRandall Stewart 					if (sin->sin_addr.s_addr == 0)
210d61a0ae0SRandall Stewart 						continue;
211d61a0ae0SRandall Stewart 					if ((ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)))
212d61a0ae0SRandall Stewart 						continue;
213d61a0ae0SRandall Stewart 				} else if ((sctp_ifa->address.sa.sa_family == AF_INET6) && (ipv6_addr_legal)) {
214d61a0ae0SRandall Stewart 					struct sockaddr_in6 *sin6;
215d61a0ae0SRandall Stewart 
216d61a0ae0SRandall Stewart 					sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sa;
217d61a0ae0SRandall Stewart 					if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
218d61a0ae0SRandall Stewart 						continue;
219d61a0ae0SRandall Stewart 					if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
220d61a0ae0SRandall Stewart 						if (local_scope == 0)
221d61a0ae0SRandall Stewart 							continue;
222d61a0ae0SRandall Stewart 						if (sin6->sin6_scope_id == 0) {
223d61a0ae0SRandall Stewart 							/*
224d61a0ae0SRandall Stewart 							 * bad link local
225d61a0ae0SRandall Stewart 							 * address
226d61a0ae0SRandall Stewart 							 */
227d61a0ae0SRandall Stewart 							if (sa6_recoverscope(sin6) != 0)
228d61a0ae0SRandall Stewart 								continue;
229d61a0ae0SRandall Stewart 						}
230d61a0ae0SRandall Stewart 					}
231d61a0ae0SRandall Stewart 					if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)))
232d61a0ae0SRandall Stewart 						continue;
233d61a0ae0SRandall Stewart 				} else
234d61a0ae0SRandall Stewart 					continue;
235851b7298SRandall Stewart 				memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
236d61a0ae0SRandall Stewart 				memcpy((void *)&xladdr.address, (const void *)&sctp_ifa->address, sizeof(union sctp_sockstore));
237d61a0ae0SRandall Stewart 				SCTP_INP_RUNLOCK(inp);
238d61a0ae0SRandall Stewart 				SCTP_INP_INFO_RUNLOCK();
239d61a0ae0SRandall Stewart 				error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
240851b7298SRandall Stewart 				if (error) {
241d61a0ae0SRandall Stewart 					return (error);
242851b7298SRandall Stewart 				} else {
243d61a0ae0SRandall Stewart 					SCTP_INP_INFO_RLOCK();
244d61a0ae0SRandall Stewart 					SCTP_INP_RLOCK(inp);
245d61a0ae0SRandall Stewart 				}
246d61a0ae0SRandall Stewart 			}
247d61a0ae0SRandall Stewart 		}
248d61a0ae0SRandall Stewart 	} else {
249d61a0ae0SRandall Stewart 		LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
250d61a0ae0SRandall Stewart 			/* ignore if blacklisted at association level */
251d61a0ae0SRandall Stewart 			if (stcb && sctp_is_addr_restricted(stcb, laddr->ifa))
252d61a0ae0SRandall Stewart 				continue;
253851b7298SRandall Stewart 			memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
254d61a0ae0SRandall Stewart 			memcpy((void *)&xladdr.address, (const void *)&laddr->ifa->address, sizeof(union sctp_sockstore));
255851b7298SRandall Stewart 			xladdr.start_time.tv_sec = (uint32_t) laddr->start_time.tv_sec;
256851b7298SRandall Stewart 			xladdr.start_time.tv_usec = (uint32_t) laddr->start_time.tv_usec;
257d61a0ae0SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
258d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RUNLOCK();
259d61a0ae0SRandall Stewart 			error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
260851b7298SRandall Stewart 			if (error) {
261d61a0ae0SRandall Stewart 				return (error);
262851b7298SRandall Stewart 			} else {
263d61a0ae0SRandall Stewart 				SCTP_INP_INFO_RLOCK();
264d61a0ae0SRandall Stewart 				SCTP_INP_RLOCK(inp);
265d61a0ae0SRandall Stewart 			}
266d61a0ae0SRandall Stewart 		}
267d61a0ae0SRandall Stewart 	}
268851b7298SRandall Stewart 	memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
269d61a0ae0SRandall Stewart 	xladdr.last = 1;
2705f26a41dSRandall Stewart 	SCTP_INP_RUNLOCK(inp);
2715f26a41dSRandall Stewart 	SCTP_INP_INFO_RUNLOCK();
272d61a0ae0SRandall Stewart 	error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
2735f26a41dSRandall Stewart 
274851b7298SRandall Stewart 	if (error) {
275d61a0ae0SRandall Stewart 		return (error);
276851b7298SRandall Stewart 	} else {
2775f26a41dSRandall Stewart 		SCTP_INP_INFO_RLOCK();
2785f26a41dSRandall Stewart 		SCTP_INP_RLOCK(inp);
279d61a0ae0SRandall Stewart 		return (0);
280d61a0ae0SRandall Stewart 	}
2815f26a41dSRandall Stewart }
282d61a0ae0SRandall Stewart 
28342551e99SRandall Stewart /*
28442551e99SRandall Stewart  * sysctl functions
28542551e99SRandall Stewart  */
28642551e99SRandall Stewart static int
28742551e99SRandall Stewart sctp_assoclist(SYSCTL_HANDLER_ARGS)
28842551e99SRandall Stewart {
28942551e99SRandall Stewart 	unsigned int number_of_endpoints;
29042551e99SRandall Stewart 	unsigned int number_of_local_addresses;
29142551e99SRandall Stewart 	unsigned int number_of_associations;
29242551e99SRandall Stewart 	unsigned int number_of_remote_addresses;
29342551e99SRandall Stewart 	unsigned int n;
29442551e99SRandall Stewart 	int error;
29542551e99SRandall Stewart 	struct sctp_inpcb *inp;
29642551e99SRandall Stewart 	struct sctp_tcb *stcb;
29742551e99SRandall Stewart 	struct sctp_nets *net;
29842551e99SRandall Stewart 	struct xsctp_inpcb xinpcb;
29942551e99SRandall Stewart 	struct xsctp_tcb xstcb;
30042551e99SRandall Stewart 	struct xsctp_raddr xraddr;
30142551e99SRandall Stewart 
30242551e99SRandall Stewart 	number_of_endpoints = 0;
30342551e99SRandall Stewart 	number_of_local_addresses = 0;
30442551e99SRandall Stewart 	number_of_associations = 0;
30542551e99SRandall Stewart 	number_of_remote_addresses = 0;
30642551e99SRandall Stewart 
30742551e99SRandall Stewart 	SCTP_INP_INFO_RLOCK();
30842551e99SRandall Stewart 	if (req->oldptr == USER_ADDR_NULL) {
30942551e99SRandall Stewart 		LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
31042551e99SRandall Stewart 			SCTP_INP_RLOCK(inp);
31142551e99SRandall Stewart 			number_of_endpoints++;
312d61a0ae0SRandall Stewart 			number_of_local_addresses += number_of_addresses(inp);
31342551e99SRandall Stewart 			LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
31442551e99SRandall Stewart 				number_of_associations++;
315d61a0ae0SRandall Stewart 				number_of_local_addresses += number_of_addresses(inp);
31642551e99SRandall Stewart 				TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
31742551e99SRandall Stewart 					number_of_remote_addresses++;
31842551e99SRandall Stewart 				}
31942551e99SRandall Stewart 			}
32042551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
32142551e99SRandall Stewart 		}
32242551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
32342551e99SRandall Stewart 		n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) +
324d61a0ae0SRandall Stewart 		    (number_of_local_addresses + number_of_endpoints + number_of_associations) * sizeof(struct xsctp_laddr) +
325d61a0ae0SRandall Stewart 		    (number_of_associations + number_of_endpoints) * sizeof(struct xsctp_tcb) +
326d61a0ae0SRandall Stewart 		    (number_of_remote_addresses + number_of_associations) * sizeof(struct xsctp_raddr);
327d61a0ae0SRandall Stewart 
32842551e99SRandall Stewart 		/* request some more memory than needed */
32942551e99SRandall Stewart 		req->oldidx = (n + n / 8);
33042551e99SRandall Stewart 		return 0;
33142551e99SRandall Stewart 	}
33242551e99SRandall Stewart 	if (req->newptr != USER_ADDR_NULL) {
33342551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
334c4739e2fSRandall Stewart 		SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_SYSCTL, EPERM);
33542551e99SRandall Stewart 		return EPERM;
33642551e99SRandall Stewart 	}
33742551e99SRandall Stewart 	LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
33842551e99SRandall Stewart 		SCTP_INP_RLOCK(inp);
33942551e99SRandall Stewart 		xinpcb.last = 0;
34042551e99SRandall Stewart 		xinpcb.local_port = ntohs(inp->sctp_lport);
34142551e99SRandall Stewart 		xinpcb.flags = inp->sctp_flags;
34242551e99SRandall Stewart 		xinpcb.features = inp->sctp_features;
34342551e99SRandall Stewart 		xinpcb.total_sends = inp->total_sends;
34442551e99SRandall Stewart 		xinpcb.total_recvs = inp->total_recvs;
34542551e99SRandall Stewart 		xinpcb.total_nospaces = inp->total_nospaces;
34617205eccSRandall Stewart 		xinpcb.fragmentation_point = inp->sctp_frag_point;
347851b7298SRandall Stewart 		if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
348851b7298SRandall Stewart 		    (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
349851b7298SRandall Stewart 			xinpcb.qlen = 0;
350851b7298SRandall Stewart 			xinpcb.maxqlen = 0;
351851b7298SRandall Stewart 		} else {
352d61a0ae0SRandall Stewart 			xinpcb.qlen = inp->sctp_socket->so_qlen;
353d61a0ae0SRandall Stewart 			xinpcb.maxqlen = inp->sctp_socket->so_qlimit;
354851b7298SRandall Stewart 		}
35542551e99SRandall Stewart 		SCTP_INP_INCR_REF(inp);
35642551e99SRandall Stewart 		SCTP_INP_RUNLOCK(inp);
35742551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
35842551e99SRandall Stewart 		error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
35942551e99SRandall Stewart 		if (error) {
360d61a0ae0SRandall Stewart 			SCTP_INP_DECR_REF(inp);
36142551e99SRandall Stewart 			return error;
36242551e99SRandall Stewart 		}
36342551e99SRandall Stewart 		SCTP_INP_INFO_RLOCK();
36442551e99SRandall Stewart 		SCTP_INP_RLOCK(inp);
365d61a0ae0SRandall Stewart 		error = copy_out_local_addresses(inp, NULL, req);
366d61a0ae0SRandall Stewart 		if (error) {
367d61a0ae0SRandall Stewart 			SCTP_INP_DECR_REF(inp);
368d61a0ae0SRandall Stewart 			return error;
369d61a0ae0SRandall Stewart 		}
37042551e99SRandall Stewart 		LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
37142551e99SRandall Stewart 			SCTP_TCB_LOCK(stcb);
37242551e99SRandall Stewart 			atomic_add_int(&stcb->asoc.refcnt, 1);
37342551e99SRandall Stewart 			SCTP_TCB_UNLOCK(stcb);
374d61a0ae0SRandall Stewart 			xstcb.last = 0;
375d61a0ae0SRandall Stewart 			xstcb.local_port = ntohs(inp->sctp_lport);
376d61a0ae0SRandall Stewart 			xstcb.remote_port = ntohs(stcb->rport);
37742551e99SRandall Stewart 			if (stcb->asoc.primary_destination != NULL)
378d61a0ae0SRandall Stewart 				xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr;
379d61a0ae0SRandall Stewart 			xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay;
380d61a0ae0SRandall Stewart 			xstcb.state = SCTP_GET_STATE(&stcb->asoc);	/* FIXME */
381d61a0ae0SRandall Stewart 			xstcb.in_streams = stcb->asoc.streamincnt;
382d61a0ae0SRandall Stewart 			xstcb.out_streams = stcb->asoc.streamoutcnt;
383d61a0ae0SRandall Stewart 			xstcb.max_nr_retrans = stcb->asoc.overall_error_count;
384d61a0ae0SRandall Stewart 			xstcb.primary_process = 0;	/* not really supported
385d61a0ae0SRandall Stewart 							 * yet */
386d61a0ae0SRandall Stewart 			xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie;
387d61a0ae0SRandall Stewart 			xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack;
388d61a0ae0SRandall Stewart 			xstcb.retransmitted_tsns = stcb->asoc.marked_retrans;
389851b7298SRandall Stewart 			xstcb.start_time.tv_sec = (uint32_t) stcb->asoc.start_time.tv_sec;
390851b7298SRandall Stewart 			xstcb.start_time.tv_usec = (uint32_t) stcb->asoc.start_time.tv_usec;
391851b7298SRandall Stewart 			xstcb.discontinuity_time.tv_sec = (uint32_t) stcb->asoc.discontinuity_time.tv_sec;
392851b7298SRandall Stewart 			xstcb.discontinuity_time.tv_usec = (uint32_t) stcb->asoc.discontinuity_time.tv_usec;
39342551e99SRandall Stewart 			xstcb.total_sends = stcb->total_sends;
39442551e99SRandall Stewart 			xstcb.total_recvs = stcb->total_recvs;
39542551e99SRandall Stewart 			xstcb.local_tag = stcb->asoc.my_vtag;
39642551e99SRandall Stewart 			xstcb.remote_tag = stcb->asoc.peer_vtag;
39742551e99SRandall Stewart 			xstcb.initial_tsn = stcb->asoc.init_seq_number;
39842551e99SRandall Stewart 			xstcb.highest_tsn = stcb->asoc.sending_seq - 1;
39942551e99SRandall Stewart 			xstcb.cumulative_tsn = stcb->asoc.last_acked_seq;
40042551e99SRandall Stewart 			xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn;
40117205eccSRandall Stewart 			xstcb.mtu = stcb->asoc.smallest_mtu;
402207304d4SRandall Stewart 			xstcb.refcnt = stcb->asoc.refcnt;
40342551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
40442551e99SRandall Stewart 			SCTP_INP_INFO_RUNLOCK();
40542551e99SRandall Stewart 			error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
40642551e99SRandall Stewart 			if (error) {
407d61a0ae0SRandall Stewart 				SCTP_INP_DECR_REF(inp);
408851b7298SRandall Stewart 				atomic_subtract_int(&stcb->asoc.refcnt, 1);
409d61a0ae0SRandall Stewart 				return error;
410d61a0ae0SRandall Stewart 			}
411d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RLOCK();
412d61a0ae0SRandall Stewart 			SCTP_INP_RLOCK(inp);
413d61a0ae0SRandall Stewart 			error = copy_out_local_addresses(inp, stcb, req);
414d61a0ae0SRandall Stewart 			if (error) {
415d61a0ae0SRandall Stewart 				SCTP_INP_DECR_REF(inp);
416851b7298SRandall Stewart 				atomic_subtract_int(&stcb->asoc.refcnt, 1);
41742551e99SRandall Stewart 				return error;
41842551e99SRandall Stewart 			}
41942551e99SRandall Stewart 			TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
420d61a0ae0SRandall Stewart 				xraddr.last = 0;
421d61a0ae0SRandall Stewart 				xraddr.address = net->ro._l_addr;
422d61a0ae0SRandall Stewart 				xraddr.active = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE);
423d61a0ae0SRandall Stewart 				xraddr.confirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0);
424d61a0ae0SRandall Stewart 				xraddr.heartbeat_enabled = ((net->dest_state & SCTP_ADDR_NOHB) == 0);
425d61a0ae0SRandall Stewart 				xraddr.rto = net->RTO;
426d61a0ae0SRandall Stewart 				xraddr.max_path_rtx = net->failure_threshold;
427d61a0ae0SRandall Stewart 				xraddr.rtx = net->marked_retrans;
428d61a0ae0SRandall Stewart 				xraddr.error_counter = net->error_count;
429d61a0ae0SRandall Stewart 				xraddr.cwnd = net->cwnd;
430d61a0ae0SRandall Stewart 				xraddr.flight_size = net->flight_size;
431d61a0ae0SRandall Stewart 				xraddr.mtu = net->mtu;
432851b7298SRandall Stewart 				xraddr.start_time.tv_sec = (uint32_t) net->start_time.tv_sec;
433851b7298SRandall Stewart 				xraddr.start_time.tv_usec = (uint32_t) net->start_time.tv_usec;
434d61a0ae0SRandall Stewart 				SCTP_INP_RUNLOCK(inp);
435d61a0ae0SRandall Stewart 				SCTP_INP_INFO_RUNLOCK();
43642551e99SRandall Stewart 				error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
43742551e99SRandall Stewart 				if (error) {
438d61a0ae0SRandall Stewart 					SCTP_INP_DECR_REF(inp);
439851b7298SRandall Stewart 					atomic_subtract_int(&stcb->asoc.refcnt, 1);
44042551e99SRandall Stewart 					return error;
44142551e99SRandall Stewart 				}
44242551e99SRandall Stewart 				SCTP_INP_INFO_RLOCK();
44342551e99SRandall Stewart 				SCTP_INP_RLOCK(inp);
44442551e99SRandall Stewart 			}
445851b7298SRandall Stewart 			atomic_subtract_int(&stcb->asoc.refcnt, 1);
446d61a0ae0SRandall Stewart 			memset((void *)&xraddr, 0, sizeof(struct xsctp_raddr));
447d61a0ae0SRandall Stewart 			xraddr.last = 1;
44842551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
449d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RUNLOCK();
450d61a0ae0SRandall Stewart 			error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
451d61a0ae0SRandall Stewart 			if (error) {
452d61a0ae0SRandall Stewart 				SCTP_INP_DECR_REF(inp);
453d61a0ae0SRandall Stewart 				return error;
454d61a0ae0SRandall Stewart 			}
455d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RLOCK();
456d61a0ae0SRandall Stewart 			SCTP_INP_RLOCK(inp);
457d61a0ae0SRandall Stewart 		}
458851b7298SRandall Stewart 		SCTP_INP_DECR_REF(inp);
459d61a0ae0SRandall Stewart 		SCTP_INP_RUNLOCK(inp);
460d61a0ae0SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
461d61a0ae0SRandall Stewart 		memset((void *)&xstcb, 0, sizeof(struct xsctp_tcb));
462d61a0ae0SRandall Stewart 		xstcb.last = 1;
463d61a0ae0SRandall Stewart 		error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
464d61a0ae0SRandall Stewart 		if (error) {
465d61a0ae0SRandall Stewart 			return error;
466d61a0ae0SRandall Stewart 		}
467d61a0ae0SRandall Stewart 		SCTP_INP_INFO_RLOCK();
46842551e99SRandall Stewart 	}
46942551e99SRandall Stewart 	SCTP_INP_INFO_RUNLOCK();
47042551e99SRandall Stewart 
471d61a0ae0SRandall Stewart 	memset((void *)&xinpcb, 0, sizeof(struct xsctp_inpcb));
47242551e99SRandall Stewart 	xinpcb.last = 1;
47342551e99SRandall Stewart 	error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
47442551e99SRandall Stewart 	return error;
47542551e99SRandall Stewart }
47642551e99SRandall Stewart 
477851b7298SRandall Stewart #define RANGECHK(var, min, max) \
478851b7298SRandall Stewart 	if ((var) < (min)) { (var) = (min); } \
479851b7298SRandall Stewart 	else if ((var) > (max)) { (var) = (max); }
480851b7298SRandall Stewart 
481851b7298SRandall Stewart static int
482851b7298SRandall Stewart sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
483851b7298SRandall Stewart {
484851b7298SRandall Stewart 	int error;
485851b7298SRandall Stewart 
486851b7298SRandall Stewart 	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
487851b7298SRandall Stewart 	if (error == 0) {
488851b7298SRandall Stewart 		RANGECHK(sctp_sendspace, SCTPCTL_MAXDGRAM_MIN, SCTPCTL_MAXDGRAM_MAX);
489851b7298SRandall Stewart 		RANGECHK(sctp_recvspace, SCTPCTL_RECVSPACE_MIN, SCTPCTL_RECVSPACE_MAX);
490851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
491851b7298SRandall Stewart 		RANGECHK(sctp_auto_asconf, SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX);
492851b7298SRandall Stewart #endif
493851b7298SRandall Stewart 		RANGECHK(sctp_ecn_enable, SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX);
494851b7298SRandall Stewart 		RANGECHK(sctp_ecn_nonce, SCTPCTL_ECN_NONCE_MIN, SCTPCTL_ECN_NONCE_MAX);
495851b7298SRandall Stewart 		RANGECHK(sctp_strict_sacks, SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX);
496851b7298SRandall Stewart 		RANGECHK(sctp_no_csum_on_loopback, SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX);
497851b7298SRandall Stewart 		RANGECHK(sctp_strict_init, SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX);
498851b7298SRandall Stewart 		RANGECHK(sctp_peer_chunk_oh, SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX);
499851b7298SRandall Stewart 		RANGECHK(sctp_max_burst_default, SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX);
500851b7298SRandall Stewart 		RANGECHK(sctp_max_chunks_on_queue, SCTPCTL_MAXCHUNKS_MIN, SCTPCTL_MAXCHUNKS_MAX);
501851b7298SRandall Stewart 		RANGECHK(sctp_hashtblsize, SCTPCTL_TCBHASHSIZE_MIN, SCTPCTL_TCBHASHSIZE_MAX);
502851b7298SRandall Stewart 		RANGECHK(sctp_pcbtblsize, SCTPCTL_PCBHASHSIZE_MIN, SCTPCTL_PCBHASHSIZE_MAX);
503851b7298SRandall Stewart 		RANGECHK(sctp_min_split_point, SCTPCTL_MIN_SPLIT_POINT_MIN, SCTPCTL_MIN_SPLIT_POINT_MAX);
504851b7298SRandall Stewart 		RANGECHK(sctp_chunkscale, SCTPCTL_CHUNKSCALE_MIN, SCTPCTL_CHUNKSCALE_MAX);
505851b7298SRandall Stewart 		RANGECHK(sctp_delayed_sack_time_default, SCTPCTL_DELAYED_SACK_TIME_MIN, SCTPCTL_DELAYED_SACK_TIME_MAX);
506851b7298SRandall Stewart 		RANGECHK(sctp_sack_freq_default, SCTPCTL_SACK_FREQ_MIN, SCTPCTL_SACK_FREQ_MAX);
507851b7298SRandall Stewart 		RANGECHK(sctp_system_free_resc_limit, SCTPCTL_SYS_RESOURCE_MIN, SCTPCTL_SYS_RESOURCE_MAX);
508851b7298SRandall Stewart 		RANGECHK(sctp_asoc_free_resc_limit, SCTPCTL_ASOC_RESOURCE_MIN, SCTPCTL_ASOC_RESOURCE_MAX);
509851b7298SRandall Stewart 		RANGECHK(sctp_heartbeat_interval_default, SCTPCTL_HEARTBEAT_INTERVAL_MIN, SCTPCTL_HEARTBEAT_INTERVAL_MAX);
510851b7298SRandall Stewart 		RANGECHK(sctp_pmtu_raise_time_default, SCTPCTL_PMTU_RAISE_TIME_MIN, SCTPCTL_PMTU_RAISE_TIME_MAX);
511851b7298SRandall Stewart 		RANGECHK(sctp_shutdown_guard_time_default, SCTPCTL_SHUTDOWN_GUARD_TIME_MIN, SCTPCTL_SHUTDOWN_GUARD_TIME_MAX);
512851b7298SRandall Stewart 		RANGECHK(sctp_secret_lifetime_default, SCTPCTL_SECRET_LIFETIME_MIN, SCTPCTL_SECRET_LIFETIME_MAX);
513851b7298SRandall Stewart 		RANGECHK(sctp_rto_max_default, SCTPCTL_RTO_MAX_MIN, SCTPCTL_RTO_MAX_MAX);
514851b7298SRandall Stewart 		RANGECHK(sctp_rto_min_default, SCTPCTL_RTO_MIN_MIN, SCTPCTL_RTO_MIN_MAX);
515851b7298SRandall Stewart 		RANGECHK(sctp_rto_initial_default, SCTPCTL_RTO_INITIAL_MIN, SCTPCTL_RTO_INITIAL_MAX);
516851b7298SRandall Stewart 		RANGECHK(sctp_init_rto_max_default, SCTPCTL_INIT_RTO_MAX_MIN, SCTPCTL_INIT_RTO_MAX_MAX);
517851b7298SRandall Stewart 		RANGECHK(sctp_valid_cookie_life_default, SCTPCTL_VALID_COOKIE_LIFE_MIN, SCTPCTL_VALID_COOKIE_LIFE_MAX);
518851b7298SRandall Stewart 		RANGECHK(sctp_init_rtx_max_default, SCTPCTL_INIT_RTX_MAX_MIN, SCTPCTL_INIT_RTX_MAX_MAX);
519851b7298SRandall Stewart 		RANGECHK(sctp_assoc_rtx_max_default, SCTPCTL_ASSOC_RTX_MAX_MIN, SCTPCTL_ASSOC_RTX_MAX_MAX);
520851b7298SRandall Stewart 		RANGECHK(sctp_path_rtx_max_default, SCTPCTL_PATH_RTX_MAX_MIN, SCTPCTL_PATH_RTX_MAX_MAX);
521851b7298SRandall Stewart 		RANGECHK(sctp_add_more_threshold, SCTPCTL_ADD_MORE_ON_OUTPUT_MIN, SCTPCTL_ADD_MORE_ON_OUTPUT_MAX);
522851b7298SRandall Stewart 		RANGECHK(sctp_nr_outgoing_streams_default, SCTPCTL_OUTGOING_STREAMS_MIN, SCTPCTL_OUTGOING_STREAMS_MAX);
523851b7298SRandall Stewart 		RANGECHK(sctp_cmt_on_off, SCTPCTL_CMT_ON_OFF_MIN, SCTPCTL_CMT_ON_OFF_MAX);
524851b7298SRandall Stewart 		RANGECHK(sctp_cmt_use_dac, SCTPCTL_CMT_USE_DAC_MIN, SCTPCTL_CMT_USE_DAC_MAX);
525851b7298SRandall Stewart 		RANGECHK(sctp_cmt_pf, SCTPCTL_CMT_PF_MIN, SCTPCTL_CMT_PF_MAX);
526851b7298SRandall Stewart 		RANGECHK(sctp_use_cwnd_based_maxburst, SCTPCTL_CWND_MAXBURST_MIN, SCTPCTL_CWND_MAXBURST_MAX);
527851b7298SRandall Stewart 		RANGECHK(sctp_early_fr, SCTPCTL_EARLY_FAST_RETRAN_MIN, SCTPCTL_EARLY_FAST_RETRAN_MAX);
528851b7298SRandall Stewart 		RANGECHK(sctp_early_fr_msec, SCTPCTL_EARLY_FAST_RETRAN_MSEC_MIN, SCTPCTL_EARLY_FAST_RETRAN_MSEC_MAX);
529851b7298SRandall Stewart 		RANGECHK(sctp_asconf_auth_nochk, SCTPCTL_ASCONF_AUTH_NOCHK_MIN, SCTPCTL_ASCONF_AUTH_NOCHK_MAX);
530851b7298SRandall Stewart 		RANGECHK(sctp_auth_disable, SCTPCTL_AUTH_DISABLE_MIN, SCTPCTL_AUTH_DISABLE_MAX);
531851b7298SRandall Stewart 		RANGECHK(sctp_nat_friendly, SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX);
532851b7298SRandall Stewart 		RANGECHK(sctp_L2_abc_variable, SCTPCTL_ABC_L_VAR_MIN, SCTPCTL_ABC_L_VAR_MAX);
533851b7298SRandall Stewart 		RANGECHK(sctp_mbuf_threshold_count, SCTPCTL_MAX_CHAINED_MBUFS_MIN, SCTPCTL_MAX_CHAINED_MBUFS_MAX);
534851b7298SRandall Stewart 		RANGECHK(sctp_do_drain, SCTPCTL_DO_SCTP_DRAIN_MIN, SCTPCTL_DO_SCTP_DRAIN_MAX);
535851b7298SRandall Stewart 		RANGECHK(sctp_hb_maxburst, SCTPCTL_HB_MAX_BURST_MIN, SCTPCTL_HB_MAX_BURST_MAX);
536851b7298SRandall Stewart 		RANGECHK(sctp_abort_if_one_2_one_hits_limit, SCTPCTL_ABORT_AT_LIMIT_MIN, SCTPCTL_ABORT_AT_LIMIT_MAX);
537851b7298SRandall Stewart 		RANGECHK(sctp_strict_data_order, SCTPCTL_STRICT_DATA_ORDER_MIN, SCTPCTL_STRICT_DATA_ORDER_MAX);
538851b7298SRandall Stewart 		RANGECHK(sctp_min_residual, SCTPCTL_MIN_RESIDUAL_MIN, SCTPCTL_MIN_RESIDUAL_MAX);
539851b7298SRandall Stewart 		RANGECHK(sctp_max_retran_chunk, SCTPCTL_MAX_RETRAN_CHUNK_MIN, SCTPCTL_MAX_RETRAN_CHUNK_MAX);
540851b7298SRandall Stewart 		RANGECHK(sctp_logging_level, SCTPCTL_LOGGING_LEVEL_MIN, SCTPCTL_LOGGING_LEVEL_MAX);
541851b7298SRandall Stewart 		RANGECHK(sctp_default_cc_module, SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX);
542851b7298SRandall Stewart 		RANGECHK(sctp_default_frag_interleave, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX);
543851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
544851b7298SRandall Stewart 		RANGECHK(sctp_mobility_base, SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX);
545851b7298SRandall Stewart #endif
546851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF)
547851b7298SRandall Stewart 		RANGECHK(sctp_mobility_fasthandoff, SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX);
548851b7298SRandall Stewart #endif
549851b7298SRandall Stewart #ifdef SCTP_DEBUG
550851b7298SRandall Stewart 		RANGECHK(sctp_debug_on, SCTPCTL_DEBUG_MIN, SCTPCTL_DEBUG_MAX);
551851b7298SRandall Stewart #endif
552851b7298SRandall Stewart 	}
553851b7298SRandall Stewart 	return (error);
554851b7298SRandall Stewart }
55542551e99SRandall Stewart 
55642551e99SRandall Stewart /*
55742551e99SRandall Stewart  * sysctl definitions
55842551e99SRandall Stewart  */
55942551e99SRandall Stewart 
560851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sendspace, CTLTYPE_INT | CTLFLAG_RW,
561851b7298SRandall Stewart     &sctp_sendspace, 0, sysctl_sctp_check, "IU",
562851b7298SRandall Stewart     SCTPCTL_MAXDGRAM_DESC);
56342551e99SRandall Stewart 
564851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, recvspace, CTLTYPE_INT | CTLFLAG_RW,
565851b7298SRandall Stewart     &sctp_recvspace, 0, sysctl_sctp_check, "IU",
566851b7298SRandall Stewart     SCTPCTL_RECVSPACE_DESC);
56742551e99SRandall Stewart 
56842551e99SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
569851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auto_asconf, CTLTYPE_INT | CTLFLAG_RW,
570851b7298SRandall Stewart     &sctp_auto_asconf, 0, sysctl_sctp_check, "IU",
571851b7298SRandall Stewart     SCTPCTL_AUTOASCONF_DESC);
57242551e99SRandall Stewart #endif
57342551e99SRandall Stewart 
574851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_enable, CTLTYPE_INT | CTLFLAG_RW,
575851b7298SRandall Stewart     &sctp_ecn_enable, 0, sysctl_sctp_check, "IU",
576851b7298SRandall Stewart     SCTPCTL_ECN_ENABLE_DESC);
57742551e99SRandall Stewart 
578851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_nonce, CTLTYPE_INT | CTLFLAG_RW,
579851b7298SRandall Stewart     &sctp_ecn_nonce, 0, sysctl_sctp_check, "IU",
580851b7298SRandall Stewart     SCTPCTL_ECN_NONCE_DESC);
58142551e99SRandall Stewart 
582851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_INT | CTLFLAG_RW,
583851b7298SRandall Stewart     &sctp_strict_sacks, 0, sysctl_sctp_check, "IU",
584851b7298SRandall Stewart     SCTPCTL_STRICT_SACKS_DESC);
58542551e99SRandall Stewart 
586851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_INT | CTLFLAG_RW,
587851b7298SRandall Stewart     &sctp_no_csum_on_loopback, 0, sysctl_sctp_check, "IU",
588851b7298SRandall Stewart     SCTPCTL_LOOPBACK_NOCSUM_DESC);
58942551e99SRandall Stewart 
590851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_INT | CTLFLAG_RW,
591851b7298SRandall Stewart     &sctp_strict_init, 0, sysctl_sctp_check, "IU",
592851b7298SRandall Stewart     SCTPCTL_STRICT_INIT_DESC);
59342551e99SRandall Stewart 
594851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_INT | CTLFLAG_RW,
595851b7298SRandall Stewart     &sctp_peer_chunk_oh, 0, sysctl_sctp_check, "IU",
596851b7298SRandall Stewart     SCTPCTL_PEER_CHKOH_DESC);
59742551e99SRandall Stewart 
598851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxburst, CTLTYPE_INT | CTLFLAG_RW,
599851b7298SRandall Stewart     &sctp_max_burst_default, 0, sysctl_sctp_check, "IU",
600851b7298SRandall Stewart     SCTPCTL_MAXBURST_DESC);
60142551e99SRandall Stewart 
602851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxchunks, CTLTYPE_INT | CTLFLAG_RW,
603851b7298SRandall Stewart     &sctp_max_chunks_on_queue, 0, sysctl_sctp_check, "IU",
604851b7298SRandall Stewart     SCTPCTL_MAXCHUNKS_DESC);
60542551e99SRandall Stewart 
606851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, tcbhashsize, CTLTYPE_INT | CTLFLAG_RW,
607851b7298SRandall Stewart     &sctp_hashtblsize, 0, sysctl_sctp_check, "IU",
608851b7298SRandall Stewart     SCTPCTL_TCBHASHSIZE_DESC);
60942551e99SRandall Stewart 
610851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pcbhashsize, CTLTYPE_INT | CTLFLAG_RW,
611851b7298SRandall Stewart     &sctp_pcbtblsize, 0, sysctl_sctp_check, "IU",
612851b7298SRandall Stewart     SCTPCTL_PCBHASHSIZE_DESC);
61342551e99SRandall Stewart 
614851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_split_point, CTLTYPE_INT | CTLFLAG_RW,
615851b7298SRandall Stewart     &sctp_min_split_point, 0, sysctl_sctp_check, "IU",
616851b7298SRandall Stewart     SCTPCTL_MIN_SPLIT_POINT_DESC);
61742551e99SRandall Stewart 
618851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, chunkscale, CTLTYPE_INT | CTLFLAG_RW,
619851b7298SRandall Stewart     &sctp_chunkscale, 0, sysctl_sctp_check, "IU",
620851b7298SRandall Stewart     SCTPCTL_CHUNKSCALE_DESC);
62142551e99SRandall Stewart 
622851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, delayed_sack_time, CTLTYPE_INT | CTLFLAG_RW,
623851b7298SRandall Stewart     &sctp_delayed_sack_time_default, 0, sysctl_sctp_check, "IU",
624851b7298SRandall Stewart     SCTPCTL_DELAYED_SACK_TIME_DESC);
62542551e99SRandall Stewart 
626851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sack_freq, CTLTYPE_INT | CTLFLAG_RW,
627851b7298SRandall Stewart     &sctp_sack_freq_default, 0, sysctl_sctp_check, "IU",
628851b7298SRandall Stewart     SCTPCTL_SACK_FREQ_DESC);
62942551e99SRandall Stewart 
630851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sys_resource, CTLTYPE_INT | CTLFLAG_RW,
631851b7298SRandall Stewart     &sctp_system_free_resc_limit, 0, sysctl_sctp_check, "IU",
632851b7298SRandall Stewart     SCTPCTL_SYS_RESOURCE_DESC);
63342551e99SRandall Stewart 
634851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asoc_resource, CTLTYPE_INT | CTLFLAG_RW,
635851b7298SRandall Stewart     &sctp_asoc_free_resc_limit, 0, sysctl_sctp_check, "IU",
636851b7298SRandall Stewart     SCTPCTL_ASOC_RESOURCE_DESC);
63742551e99SRandall Stewart 
638851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, heartbeat_interval, CTLTYPE_INT | CTLFLAG_RW,
639851b7298SRandall Stewart     &sctp_heartbeat_interval_default, 0, sysctl_sctp_check, "IU",
640851b7298SRandall Stewart     SCTPCTL_HEARTBEAT_INTERVAL_DESC);
64142551e99SRandall Stewart 
642851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pmtu_raise_time, CTLTYPE_INT | CTLFLAG_RW,
643851b7298SRandall Stewart     &sctp_pmtu_raise_time_default, 0, sysctl_sctp_check, "IU",
644851b7298SRandall Stewart     SCTPCTL_PMTU_RAISE_TIME_DESC);
64542551e99SRandall Stewart 
646851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, shutdown_guard_time, CTLTYPE_INT | CTLFLAG_RW,
647851b7298SRandall Stewart     &sctp_shutdown_guard_time_default, 0, sysctl_sctp_check, "IU",
648851b7298SRandall Stewart     SCTPCTL_SHUTDOWN_GUARD_TIME_DESC);
64942551e99SRandall Stewart 
650851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, secret_lifetime, CTLTYPE_INT | CTLFLAG_RW,
651851b7298SRandall Stewart     &sctp_secret_lifetime_default, 0, sysctl_sctp_check, "IU",
652851b7298SRandall Stewart     SCTPCTL_SECRET_LIFETIME_DESC);
65342551e99SRandall Stewart 
654851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_max, CTLTYPE_INT | CTLFLAG_RW,
655851b7298SRandall Stewart     &sctp_rto_max_default, 0, sysctl_sctp_check, "IU",
656851b7298SRandall Stewart     SCTPCTL_RTO_MAX_DESC);
65742551e99SRandall Stewart 
658851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_min, CTLTYPE_INT | CTLFLAG_RW,
659851b7298SRandall Stewart     &sctp_rto_min_default, 0, sysctl_sctp_check, "IU",
660851b7298SRandall Stewart     SCTPCTL_RTO_MIN_DESC);
66142551e99SRandall Stewart 
662851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_initial, CTLTYPE_INT | CTLFLAG_RW,
663851b7298SRandall Stewart     &sctp_rto_initial_default, 0, sysctl_sctp_check, "IU",
664851b7298SRandall Stewart     SCTPCTL_RTO_INITIAL_DESC);
66542551e99SRandall Stewart 
666851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rto_max, CTLTYPE_INT | CTLFLAG_RW,
667851b7298SRandall Stewart     &sctp_init_rto_max_default, 0, sysctl_sctp_check, "IU",
668851b7298SRandall Stewart     SCTPCTL_INIT_RTO_MAX_DESC);
66942551e99SRandall Stewart 
670851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, valid_cookie_life, CTLTYPE_INT | CTLFLAG_RW,
671851b7298SRandall Stewart     &sctp_valid_cookie_life_default, 0, sysctl_sctp_check, "IU",
672851b7298SRandall Stewart     SCTPCTL_VALID_COOKIE_LIFE_DESC);
67342551e99SRandall Stewart 
674851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
675851b7298SRandall Stewart     &sctp_init_rtx_max_default, 0, sysctl_sctp_check, "IU",
676851b7298SRandall Stewart     SCTPCTL_INIT_RTX_MAX_DESC);
67742551e99SRandall Stewart 
678851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoc_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
679851b7298SRandall Stewart     &sctp_assoc_rtx_max_default, 0, sysctl_sctp_check, "IU",
680851b7298SRandall Stewart     SCTPCTL_ASSOC_RTX_MAX_DESC);
68142551e99SRandall Stewart 
682851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, path_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
683851b7298SRandall Stewart     &sctp_path_rtx_max_default, 0, sysctl_sctp_check, "IU",
684851b7298SRandall Stewart     SCTPCTL_PATH_RTX_MAX_DESC);
68542551e99SRandall Stewart 
686851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, add_more_on_output, CTLTYPE_INT | CTLFLAG_RW,
687851b7298SRandall Stewart     &sctp_add_more_threshold, 0, sysctl_sctp_check, "IU",
688851b7298SRandall Stewart     SCTPCTL_ADD_MORE_ON_OUTPUT_DESC);
68942551e99SRandall Stewart 
690851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLTYPE_INT | CTLFLAG_RW,
691851b7298SRandall Stewart     &sctp_nr_outgoing_streams_default, 0, sysctl_sctp_check, "IU",
692851b7298SRandall Stewart     SCTPCTL_OUTGOING_STREAMS_DESC);
69342551e99SRandall Stewart 
694851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLTYPE_INT | CTLFLAG_RW,
695851b7298SRandall Stewart     &sctp_cmt_on_off, 0, sysctl_sctp_check, "IU",
696851b7298SRandall Stewart     SCTPCTL_CMT_ON_OFF_DESC);
69742551e99SRandall Stewart 
698851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLTYPE_INT | CTLFLAG_RW,
699851b7298SRandall Stewart     &sctp_cmt_use_dac, 0, sysctl_sctp_check, "IU",
700851b7298SRandall Stewart     SCTPCTL_CMT_USE_DAC_DESC);
701b54d3a6cSRandall Stewart 
702851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_pf, CTLTYPE_INT | CTLFLAG_RW,
703851b7298SRandall Stewart     &sctp_cmt_pf, 0, sysctl_sctp_check, "IU",
704851b7298SRandall Stewart     SCTPCTL_CMT_PF_DESC);
705b54d3a6cSRandall Stewart 
706851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cwnd_maxburst, CTLTYPE_INT | CTLFLAG_RW,
707851b7298SRandall Stewart     &sctp_use_cwnd_based_maxburst, 0, sysctl_sctp_check, "IU",
708851b7298SRandall Stewart     SCTPCTL_CWND_MAXBURST_DESC);
709c4739e2fSRandall Stewart 
710851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran, CTLTYPE_INT | CTLFLAG_RW,
711851b7298SRandall Stewart     &sctp_early_fr, 0, sysctl_sctp_check, "IU",
712851b7298SRandall Stewart     SCTPCTL_EARLY_FAST_RETRAN_DESC);
713851b7298SRandall Stewart 
714851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran_msec, CTLTYPE_INT | CTLFLAG_RW,
715851b7298SRandall Stewart     &sctp_early_fr_msec, 0, sysctl_sctp_check, "IU",
716851b7298SRandall Stewart     SCTPCTL_EARLY_FAST_RETRAN_MSEC_DESC);
717851b7298SRandall Stewart 
718851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLTYPE_INT | CTLFLAG_RW,
719851b7298SRandall Stewart     &sctp_asconf_auth_nochk, 0, sysctl_sctp_check, "IU",
720851b7298SRandall Stewart     SCTPCTL_ASCONF_AUTH_NOCHK_DESC);
721851b7298SRandall Stewart 
722851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auth_disable, CTLTYPE_INT | CTLFLAG_RW,
723851b7298SRandall Stewart     &sctp_auth_disable, 0, sysctl_sctp_check, "IU",
724851b7298SRandall Stewart     SCTPCTL_AUTH_DISABLE_DESC);
725851b7298SRandall Stewart 
726851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nat_friendly, CTLTYPE_INT | CTLFLAG_RW,
727851b7298SRandall Stewart     &sctp_nat_friendly, 0, sysctl_sctp_check, "IU",
728851b7298SRandall Stewart     SCTPCTL_NAT_FRIENDLY_DESC);
729851b7298SRandall Stewart 
730851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abc_l_var, CTLTYPE_INT | CTLFLAG_RW,
731851b7298SRandall Stewart     &sctp_L2_abc_variable, 0, sysctl_sctp_check, "IU",
732851b7298SRandall Stewart     SCTPCTL_ABC_L_VAR_DESC);
733851b7298SRandall Stewart 
734851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_chained_mbufs, CTLTYPE_INT | CTLFLAG_RW,
735851b7298SRandall Stewart     &sctp_mbuf_threshold_count, 0, sysctl_sctp_check, "IU",
736851b7298SRandall Stewart     SCTPCTL_MAX_CHAINED_MBUFS_DESC);
737851b7298SRandall Stewart 
738851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, do_sctp_drain, CTLTYPE_INT | CTLFLAG_RW,
739851b7298SRandall Stewart     &sctp_do_drain, 0, sysctl_sctp_check, "IU",
740851b7298SRandall Stewart     SCTPCTL_DO_SCTP_DRAIN_DESC);
741851b7298SRandall Stewart 
742851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, hb_max_burst, CTLTYPE_INT | CTLFLAG_RW,
743851b7298SRandall Stewart     &sctp_hb_maxburst, 0, sysctl_sctp_check, "IU",
744851b7298SRandall Stewart     SCTPCTL_HB_MAX_BURST_DESC);
745851b7298SRandall Stewart 
746851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abort_at_limit, CTLTYPE_INT | CTLFLAG_RW,
747851b7298SRandall Stewart     &sctp_abort_if_one_2_one_hits_limit, 0, sysctl_sctp_check, "IU",
748851b7298SRandall Stewart     SCTPCTL_ABORT_AT_LIMIT_DESC);
749851b7298SRandall Stewart 
750851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_data_order, CTLTYPE_INT | CTLFLAG_RW,
751851b7298SRandall Stewart     &sctp_strict_data_order, 0, sysctl_sctp_check, "IU",
752851b7298SRandall Stewart     SCTPCTL_STRICT_DATA_ORDER_DESC);
753851b7298SRandall Stewart 
754851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_residual, CTLTYPE_INT | CTLFLAG_RW,
755851b7298SRandall Stewart     &sctp_min_residual, 0, sysctl_sctp_check, "IU",
756851b7298SRandall Stewart     SCTPCTL_MIN_RESIDUAL_DESC);
757851b7298SRandall Stewart 
758851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLTYPE_INT | CTLFLAG_RW,
759851b7298SRandall Stewart     &sctp_max_retran_chunk, 0, sysctl_sctp_check, "IU",
760851b7298SRandall Stewart     SCTPCTL_MAX_RETRAN_CHUNK_DESC);
761851b7298SRandall Stewart 
762851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, logging, CTLTYPE_INT | CTLFLAG_RW,
763851b7298SRandall Stewart     &sctp_logging_level, 0, sysctl_sctp_check, "IU",
764851b7298SRandall Stewart     SCTPCTL_LOGGING_LEVEL_DESC);
765851b7298SRandall Stewart 
766851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_cc_module, CTLTYPE_INT | CTLFLAG_RW,
767851b7298SRandall Stewart     &sctp_default_cc_module, 0, sysctl_sctp_check, "IU",
768851b7298SRandall Stewart     SCTPCTL_DEFAULT_CC_MODULE_DESC);
769851b7298SRandall Stewart 
770851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_frag_interleave, CTLTYPE_INT | CTLFLAG_RW,
771851b7298SRandall Stewart     &sctp_default_frag_interleave, 0, sysctl_sctp_check, "IU",
772c4739e2fSRandall Stewart     SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DESC);
773c4739e2fSRandall Stewart 
774851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
775851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_base, CTLTYPE_INT | CTLFLAG_RW,
776851b7298SRandall Stewart     &sctp_mobility_base, 0, sysctl_sctp_check, "IU",
777851b7298SRandall Stewart     SCTPCTL_MOBILITY_BASE_DESC);
778851b7298SRandall Stewart #endif
77942551e99SRandall Stewart 
780851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF)
781851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_fasthandoff, CTLTYPE_INT | CTLFLAG_RW,
782851b7298SRandall Stewart     &sctp_mobility_fasthandoff, 0, sysctl_sctp_check, "IU",
783851b7298SRandall Stewart     SCTPCTL_MOBILITY_FASTHANDOFF_DESC);
784851b7298SRandall Stewart #endif
78542551e99SRandall Stewart 
786851b7298SRandall Stewart #ifdef SCTP_DEBUG
787851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW,
788851b7298SRandall Stewart     &sctp_debug_on, 0, sysctl_sctp_check, "IU",
789851b7298SRandall Stewart     SCTPCTL_DEBUG_DESC);
790851b7298SRandall Stewart #endif				/* SCTP_DEBUG */
79142551e99SRandall Stewart 
79242551e99SRandall Stewart 
79342551e99SRandall Stewart SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW,
79442551e99SRandall Stewart     &sctpstat, sctpstat,
79542551e99SRandall Stewart     "SCTP statistics (struct sctps_stat, netinet/sctp.h");
79642551e99SRandall Stewart 
79742551e99SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD,
79842551e99SRandall Stewart     0, 0, sctp_assoclist,
79942551e99SRandall Stewart     "S,xassoc", "List of active SCTP associations");
800