xref: /freebsd/sys/netinet/sctp_sysctl.c (revision a99b67833a59fc0fa47cb4f0d73b1a0a14b26112)
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>
35b3f1ea41SRandall Stewart #include <netinet/sctp.h>
3642551e99SRandall Stewart #include <netinet/sctp_constants.h>
3742551e99SRandall Stewart #include <netinet/sctp_sysctl.h>
3842551e99SRandall Stewart #include <netinet/sctp_pcb.h>
3942551e99SRandall Stewart #include <netinet/sctputil.h>
40d61a0ae0SRandall Stewart #include <netinet/sctp_output.h>
41b3f1ea41SRandall Stewart 
4242551e99SRandall Stewart /*
4342551e99SRandall Stewart  * sysctl tunable variables
4442551e99SRandall Stewart  */
455e54f665SRandall Stewart 
46b3f1ea41SRandall Stewart void
47b3f1ea41SRandall Stewart sctp_init_sysctls()
48b3f1ea41SRandall Stewart {
49b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_sendspace) = SCTPCTL_MAXDGRAM_DEFAULT;
50b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_recvspace) = SCTPCTL_RECVSPACE_DEFAULT;
51b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_auto_asconf) = SCTPCTL_AUTOASCONF_DEFAULT;
52b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_multiple_asconfs) = SCTPCTL_MULTIPLEASCONFS_DEFAULT;
53b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT;
54b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_ecn_nonce) = SCTPCTL_ECN_NONCE_DEFAULT;
55b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT;
56b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT;
57b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_strict_init) = SCTPCTL_STRICT_INIT_DEFAULT;
58b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT;
59b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT;
60b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue) = SCTPCTL_MAXCHUNKS_DEFAULT;
61b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_hashtblsize) = SCTPCTL_TCBHASHSIZE_DEFAULT;
62b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_pcbtblsize) = SCTPCTL_PCBHASHSIZE_DEFAULT;
63b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_min_split_point) = SCTPCTL_MIN_SPLIT_POINT_DEFAULT;
64b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_chunkscale) = SCTPCTL_CHUNKSCALE_DEFAULT;
65b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default) = SCTPCTL_DELAYED_SACK_TIME_DEFAULT;
66b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_sack_freq_default) = SCTPCTL_SACK_FREQ_DEFAULT;
67b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_system_free_resc_limit) = SCTPCTL_SYS_RESOURCE_DEFAULT;
68b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit) = SCTPCTL_ASOC_RESOURCE_DEFAULT;
69b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default) = SCTPCTL_HEARTBEAT_INTERVAL_DEFAULT;
70b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default) = SCTPCTL_PMTU_RAISE_TIME_DEFAULT;
71b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default) = SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULT;
72b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_secret_lifetime_default) = SCTPCTL_SECRET_LIFETIME_DEFAULT;
73b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_rto_max_default) = SCTPCTL_RTO_MAX_DEFAULT;
74b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_rto_min_default) = SCTPCTL_RTO_MIN_DEFAULT;
75b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_rto_initial_default) = SCTPCTL_RTO_INITIAL_DEFAULT;
76b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_init_rto_max_default) = SCTPCTL_INIT_RTO_MAX_DEFAULT;
77b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default) = SCTPCTL_VALID_COOKIE_LIFE_DEFAULT;
78b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_init_rtx_max_default) = SCTPCTL_INIT_RTX_MAX_DEFAULT;
79b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default) = SCTPCTL_ASSOC_RTX_MAX_DEFAULT;
80b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_path_rtx_max_default) = SCTPCTL_PATH_RTX_MAX_DEFAULT;
81b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_add_more_threshold) = SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT;
82b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default) = SCTPCTL_OUTGOING_STREAMS_DEFAULT;
83b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_cmt_on_off) = SCTPCTL_CMT_ON_OFF_DEFAULT;
84830d754dSRandall Stewart 	/* EY */
85830d754dSRandall Stewart 	SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) = SCTPCTL_NR_SACK_ON_OFF_DEFAULT;
86b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_cmt_use_dac) = SCTPCTL_CMT_USE_DAC_DEFAULT;
87b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_cmt_pf) = SCTPCTL_CMT_PF_DEFAULT;
88b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst) = SCTPCTL_CWND_MAXBURST_DEFAULT;
89b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_early_fr) = SCTPCTL_EARLY_FAST_RETRAN_DEFAULT;
90b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_early_fr_msec) = SCTPCTL_EARLY_FAST_RETRAN_MSEC_DEFAULT;
91b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk) = SCTPCTL_ASCONF_AUTH_NOCHK_DEFAULT;
92b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_auth_disable) = SCTPCTL_AUTH_DISABLE_DEFAULT;
93b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_nat_friendly) = SCTPCTL_NAT_FRIENDLY_DEFAULT;
94b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_L2_abc_variable) = SCTPCTL_ABC_L_VAR_DEFAULT;
95b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count) = SCTPCTL_MAX_CHAINED_MBUFS_DEFAULT;
96b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_do_drain) = SCTPCTL_DO_SCTP_DRAIN_DEFAULT;
97b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_hb_maxburst) = SCTPCTL_HB_MAX_BURST_DEFAULT;
98b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit) = SCTPCTL_ABORT_AT_LIMIT_DEFAULT;
99b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_strict_data_order) = SCTPCTL_STRICT_DATA_ORDER_DEFAULT;
100b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_min_residual) = SCTPCTL_MIN_RESIDUAL_DEFAULT;
101b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_max_retran_chunk) = SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT;
102b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_logging_level) = SCTPCTL_LOGGING_LEVEL_DEFAULT;
103b54d3a6cSRandall Stewart 	/* JRS - Variable for default congestion control module */
104b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_default_cc_module) = SCTPCTL_DEFAULT_CC_MODULE_DEFAULT;
105b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_default_frag_interleave) = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT;
106b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_mobility_base) = SCTPCTL_MOBILITY_BASE_DEFAULT;
107b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT;
108b27a6b7dSRandall Stewart #if defined(SCTP_LOCAL_TRACE_BUF)
109b3f1ea41SRandall Stewart 	memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
110b27a6b7dSRandall Stewart #endif
111b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable) = SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_DEFAULT;
112b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = SCTPCTL_UDP_TUNNELING_PORT_DEFAULT;
113b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_enable_sack_immediately) = SCTPCTL_SACK_IMMEDIATELY_ENABLE_DEFAULT;
114830d754dSRandall Stewart 	SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly) = SCTPCTL_NAT_FRIENDLY_DEFAULT;
115b3f1ea41SRandall Stewart #if defined(SCTP_DEBUG)
116b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_debug_on) = SCTPCTL_DEBUG_DEFAULT;
11742551e99SRandall Stewart #endif
118b3f1ea41SRandall Stewart #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
119b3f1ea41SRandall Stewart 	SCTP_BASE_SYSCTL(sctp_output_unlocked) = SCTPCTL_OUTPUT_UNLOCKED_DEFAULT;
120b3f1ea41SRandall Stewart #endif
121b3f1ea41SRandall Stewart }
122d61a0ae0SRandall Stewart 
123a99b6783SRandall Stewart 
124d61a0ae0SRandall Stewart /* It returns an upper limit. No filtering is done here */
125d61a0ae0SRandall Stewart static unsigned int
126d61a0ae0SRandall Stewart number_of_addresses(struct sctp_inpcb *inp)
127d61a0ae0SRandall Stewart {
128d61a0ae0SRandall Stewart 	int cnt;
129d61a0ae0SRandall Stewart 	struct sctp_vrf *vrf;
130d61a0ae0SRandall Stewart 	struct sctp_ifn *sctp_ifn;
131d61a0ae0SRandall Stewart 	struct sctp_ifa *sctp_ifa;
132d61a0ae0SRandall Stewart 	struct sctp_laddr *laddr;
133d61a0ae0SRandall Stewart 
134d61a0ae0SRandall Stewart 	cnt = 0;
135d61a0ae0SRandall Stewart 	/* neither Mac OS X nor FreeBSD support mulitple routing functions */
136d61a0ae0SRandall Stewart 	if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) {
137d61a0ae0SRandall Stewart 		return (0);
138d61a0ae0SRandall Stewart 	}
139d61a0ae0SRandall Stewart 	if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
140d61a0ae0SRandall Stewart 		LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
141d61a0ae0SRandall Stewart 			LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
142d61a0ae0SRandall Stewart 				if ((sctp_ifa->address.sa.sa_family == AF_INET) ||
143d61a0ae0SRandall Stewart 				    (sctp_ifa->address.sa.sa_family == AF_INET6)) {
144d61a0ae0SRandall Stewart 					cnt++;
145d61a0ae0SRandall Stewart 				}
146d61a0ae0SRandall Stewart 			}
147d61a0ae0SRandall Stewart 		}
148d61a0ae0SRandall Stewart 	} else {
149d61a0ae0SRandall Stewart 		LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
150d61a0ae0SRandall Stewart 			if ((laddr->ifa->address.sa.sa_family == AF_INET) ||
151d61a0ae0SRandall Stewart 			    (laddr->ifa->address.sa.sa_family == AF_INET6)) {
152d61a0ae0SRandall Stewart 				cnt++;
153d61a0ae0SRandall Stewart 			}
154d61a0ae0SRandall Stewart 		}
155d61a0ae0SRandall Stewart 	}
156d61a0ae0SRandall Stewart 	return (cnt);
157d61a0ae0SRandall Stewart }
158d61a0ae0SRandall Stewart 
159d61a0ae0SRandall Stewart static int
160d61a0ae0SRandall Stewart copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sysctl_req *req)
161d61a0ae0SRandall Stewart {
162d61a0ae0SRandall Stewart 	struct sctp_ifn *sctp_ifn;
163d61a0ae0SRandall Stewart 	struct sctp_ifa *sctp_ifa;
164d61a0ae0SRandall Stewart 	int loopback_scope, ipv4_local_scope, local_scope, site_scope;
165d61a0ae0SRandall Stewart 	int ipv4_addr_legal, ipv6_addr_legal;
166d61a0ae0SRandall Stewart 	struct sctp_vrf *vrf;
167d61a0ae0SRandall Stewart 	struct xsctp_laddr xladdr;
168d61a0ae0SRandall Stewart 	struct sctp_laddr *laddr;
169d61a0ae0SRandall Stewart 	int error;
170d61a0ae0SRandall Stewart 
171d61a0ae0SRandall Stewart 	/* Turn on all the appropriate scope */
172d61a0ae0SRandall Stewart 	if (stcb) {
173d61a0ae0SRandall Stewart 		/* use association specific values */
174d61a0ae0SRandall Stewart 		loopback_scope = stcb->asoc.loopback_scope;
175d61a0ae0SRandall Stewart 		ipv4_local_scope = stcb->asoc.ipv4_local_scope;
176d61a0ae0SRandall Stewart 		local_scope = stcb->asoc.local_scope;
177d61a0ae0SRandall Stewart 		site_scope = stcb->asoc.site_scope;
178d61a0ae0SRandall Stewart 	} else {
179d61a0ae0SRandall Stewart 		/* use generic values for endpoints */
180d61a0ae0SRandall Stewart 		loopback_scope = 1;
181d61a0ae0SRandall Stewart 		ipv4_local_scope = 1;
182d61a0ae0SRandall Stewart 		local_scope = 1;
183d61a0ae0SRandall Stewart 		site_scope = 1;
184d61a0ae0SRandall Stewart 	}
185d61a0ae0SRandall Stewart 
186d61a0ae0SRandall Stewart 	/* use only address families of interest */
187d61a0ae0SRandall Stewart 	if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
188d61a0ae0SRandall Stewart 		ipv6_addr_legal = 1;
189d61a0ae0SRandall Stewart 		if (SCTP_IPV6_V6ONLY(inp)) {
190d61a0ae0SRandall Stewart 			ipv4_addr_legal = 0;
191d61a0ae0SRandall Stewart 		} else {
192d61a0ae0SRandall Stewart 			ipv4_addr_legal = 1;
193d61a0ae0SRandall Stewart 		}
194d61a0ae0SRandall Stewart 	} else {
195d61a0ae0SRandall Stewart 		ipv4_addr_legal = 1;
196d61a0ae0SRandall Stewart 		ipv6_addr_legal = 0;
197d61a0ae0SRandall Stewart 	}
198d61a0ae0SRandall Stewart 
199d61a0ae0SRandall Stewart 	error = 0;
200d61a0ae0SRandall Stewart 
201d61a0ae0SRandall Stewart 	/* neither Mac OS X nor FreeBSD support mulitple routing functions */
202d61a0ae0SRandall Stewart 	if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) {
2035f26a41dSRandall Stewart 		SCTP_INP_RUNLOCK(inp);
2045f26a41dSRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
205d61a0ae0SRandall Stewart 		return (-1);
206d61a0ae0SRandall Stewart 	}
207d61a0ae0SRandall Stewart 	if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
208d61a0ae0SRandall Stewart 		LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
209d61a0ae0SRandall Stewart 			if ((loopback_scope == 0) && SCTP_IFN_IS_IFT_LOOP(sctp_ifn))
210d61a0ae0SRandall Stewart 				/* Skip loopback if loopback_scope not set */
211d61a0ae0SRandall Stewart 				continue;
212d61a0ae0SRandall Stewart 			LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
213d61a0ae0SRandall Stewart 				if (stcb) {
214d61a0ae0SRandall Stewart 					/*
215d61a0ae0SRandall Stewart 					 * ignore if blacklisted at
216d61a0ae0SRandall Stewart 					 * association level
217d61a0ae0SRandall Stewart 					 */
218d61a0ae0SRandall Stewart 					if (sctp_is_addr_restricted(stcb, sctp_ifa))
219d61a0ae0SRandall Stewart 						continue;
220d61a0ae0SRandall Stewart 				}
2215e2c2d87SRandall Stewart 				switch (sctp_ifa->address.sa.sa_family) {
2225e2c2d87SRandall Stewart 				case AF_INET:
2235e2c2d87SRandall Stewart 					if (ipv4_addr_legal) {
224d61a0ae0SRandall Stewart 						struct sockaddr_in *sin;
225d61a0ae0SRandall Stewart 
226d61a0ae0SRandall Stewart 						sin = (struct sockaddr_in *)&sctp_ifa->address.sa;
227d61a0ae0SRandall Stewart 						if (sin->sin_addr.s_addr == 0)
228d61a0ae0SRandall Stewart 							continue;
229d61a0ae0SRandall Stewart 						if ((ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)))
230d61a0ae0SRandall Stewart 							continue;
2315e2c2d87SRandall Stewart 					} else {
2325e2c2d87SRandall Stewart 						continue;
2335e2c2d87SRandall Stewart 					}
2345e2c2d87SRandall Stewart 					break;
2355e2c2d87SRandall Stewart #ifdef INET6
2365e2c2d87SRandall Stewart 				case AF_INET6:
2375e2c2d87SRandall Stewart 					if (ipv6_addr_legal) {
238d61a0ae0SRandall Stewart 						struct sockaddr_in6 *sin6;
239d61a0ae0SRandall Stewart 
240d61a0ae0SRandall Stewart 						sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sa;
241d61a0ae0SRandall Stewart 						if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
242d61a0ae0SRandall Stewart 							continue;
243d61a0ae0SRandall Stewart 						if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
244d61a0ae0SRandall Stewart 							if (local_scope == 0)
245d61a0ae0SRandall Stewart 								continue;
246d61a0ae0SRandall Stewart 							if (sin6->sin6_scope_id == 0) {
247d61a0ae0SRandall Stewart 								/*
2485e2c2d87SRandall Stewart 								 * bad link
2495e2c2d87SRandall Stewart 								 * local
250d61a0ae0SRandall Stewart 								 * address
251d61a0ae0SRandall Stewart 								 */
252d61a0ae0SRandall Stewart 								if (sa6_recoverscope(sin6) != 0)
253d61a0ae0SRandall Stewart 									continue;
254d61a0ae0SRandall Stewart 							}
255d61a0ae0SRandall Stewart 						}
256d61a0ae0SRandall Stewart 						if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)))
257d61a0ae0SRandall Stewart 							continue;
2585e2c2d87SRandall Stewart 					} else {
259d61a0ae0SRandall Stewart 						continue;
2605e2c2d87SRandall Stewart 					}
2615e2c2d87SRandall Stewart 					break;
2625e2c2d87SRandall Stewart #endif
2635e2c2d87SRandall Stewart 				default:
2645e2c2d87SRandall Stewart 					continue;
2655e2c2d87SRandall Stewart 				}
266851b7298SRandall Stewart 				memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
267d61a0ae0SRandall Stewart 				memcpy((void *)&xladdr.address, (const void *)&sctp_ifa->address, sizeof(union sctp_sockstore));
268d61a0ae0SRandall Stewart 				SCTP_INP_RUNLOCK(inp);
269d61a0ae0SRandall Stewart 				SCTP_INP_INFO_RUNLOCK();
270d61a0ae0SRandall Stewart 				error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
271851b7298SRandall Stewart 				if (error) {
272d61a0ae0SRandall Stewart 					return (error);
273851b7298SRandall Stewart 				} else {
274d61a0ae0SRandall Stewart 					SCTP_INP_INFO_RLOCK();
275d61a0ae0SRandall Stewart 					SCTP_INP_RLOCK(inp);
276d61a0ae0SRandall Stewart 				}
277d61a0ae0SRandall Stewart 			}
278d61a0ae0SRandall Stewart 		}
279d61a0ae0SRandall Stewart 	} else {
280d61a0ae0SRandall Stewart 		LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
281d61a0ae0SRandall Stewart 			/* ignore if blacklisted at association level */
282d61a0ae0SRandall Stewart 			if (stcb && sctp_is_addr_restricted(stcb, laddr->ifa))
283d61a0ae0SRandall Stewart 				continue;
284851b7298SRandall Stewart 			memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
285d61a0ae0SRandall Stewart 			memcpy((void *)&xladdr.address, (const void *)&laddr->ifa->address, sizeof(union sctp_sockstore));
286851b7298SRandall Stewart 			xladdr.start_time.tv_sec = (uint32_t) laddr->start_time.tv_sec;
287851b7298SRandall Stewart 			xladdr.start_time.tv_usec = (uint32_t) laddr->start_time.tv_usec;
288d61a0ae0SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
289d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RUNLOCK();
290d61a0ae0SRandall Stewart 			error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
291851b7298SRandall Stewart 			if (error) {
292d61a0ae0SRandall Stewart 				return (error);
293851b7298SRandall Stewart 			} else {
294d61a0ae0SRandall Stewart 				SCTP_INP_INFO_RLOCK();
295d61a0ae0SRandall Stewart 				SCTP_INP_RLOCK(inp);
296d61a0ae0SRandall Stewart 			}
297d61a0ae0SRandall Stewart 		}
298d61a0ae0SRandall Stewart 	}
299851b7298SRandall Stewart 	memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
300d61a0ae0SRandall Stewart 	xladdr.last = 1;
3015f26a41dSRandall Stewart 	SCTP_INP_RUNLOCK(inp);
3025f26a41dSRandall Stewart 	SCTP_INP_INFO_RUNLOCK();
303d61a0ae0SRandall Stewart 	error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
3045f26a41dSRandall Stewart 
305851b7298SRandall Stewart 	if (error) {
306d61a0ae0SRandall Stewart 		return (error);
307851b7298SRandall Stewart 	} else {
3085f26a41dSRandall Stewart 		SCTP_INP_INFO_RLOCK();
3095f26a41dSRandall Stewart 		SCTP_INP_RLOCK(inp);
310d61a0ae0SRandall Stewart 		return (0);
311d61a0ae0SRandall Stewart 	}
3125f26a41dSRandall Stewart }
313d61a0ae0SRandall Stewart 
31442551e99SRandall Stewart /*
31542551e99SRandall Stewart  * sysctl functions
31642551e99SRandall Stewart  */
31742551e99SRandall Stewart static int
31842551e99SRandall Stewart sctp_assoclist(SYSCTL_HANDLER_ARGS)
31942551e99SRandall Stewart {
32042551e99SRandall Stewart 	unsigned int number_of_endpoints;
32142551e99SRandall Stewart 	unsigned int number_of_local_addresses;
32242551e99SRandall Stewart 	unsigned int number_of_associations;
32342551e99SRandall Stewart 	unsigned int number_of_remote_addresses;
32442551e99SRandall Stewart 	unsigned int n;
32542551e99SRandall Stewart 	int error;
32642551e99SRandall Stewart 	struct sctp_inpcb *inp;
32742551e99SRandall Stewart 	struct sctp_tcb *stcb;
32842551e99SRandall Stewart 	struct sctp_nets *net;
32942551e99SRandall Stewart 	struct xsctp_inpcb xinpcb;
33042551e99SRandall Stewart 	struct xsctp_tcb xstcb;
33142551e99SRandall Stewart 	struct xsctp_raddr xraddr;
33242551e99SRandall Stewart 
33342551e99SRandall Stewart 	number_of_endpoints = 0;
33442551e99SRandall Stewart 	number_of_local_addresses = 0;
33542551e99SRandall Stewart 	number_of_associations = 0;
33642551e99SRandall Stewart 	number_of_remote_addresses = 0;
33742551e99SRandall Stewart 
33842551e99SRandall Stewart 	SCTP_INP_INFO_RLOCK();
33942551e99SRandall Stewart 	if (req->oldptr == USER_ADDR_NULL) {
340b3f1ea41SRandall Stewart 		LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) {
34142551e99SRandall Stewart 			SCTP_INP_RLOCK(inp);
34242551e99SRandall Stewart 			number_of_endpoints++;
343d61a0ae0SRandall Stewart 			number_of_local_addresses += number_of_addresses(inp);
34442551e99SRandall Stewart 			LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
34542551e99SRandall Stewart 				number_of_associations++;
346d61a0ae0SRandall Stewart 				number_of_local_addresses += number_of_addresses(inp);
34742551e99SRandall Stewart 				TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
34842551e99SRandall Stewart 					number_of_remote_addresses++;
34942551e99SRandall Stewart 				}
35042551e99SRandall Stewart 			}
35142551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
35242551e99SRandall Stewart 		}
35342551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
35442551e99SRandall Stewart 		n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) +
355d61a0ae0SRandall Stewart 		    (number_of_local_addresses + number_of_endpoints + number_of_associations) * sizeof(struct xsctp_laddr) +
356d61a0ae0SRandall Stewart 		    (number_of_associations + number_of_endpoints) * sizeof(struct xsctp_tcb) +
357d61a0ae0SRandall Stewart 		    (number_of_remote_addresses + number_of_associations) * sizeof(struct xsctp_raddr);
358d61a0ae0SRandall Stewart 
35942551e99SRandall Stewart 		/* request some more memory than needed */
36042551e99SRandall Stewart 		req->oldidx = (n + n / 8);
36142551e99SRandall Stewart 		return 0;
36242551e99SRandall Stewart 	}
36342551e99SRandall Stewart 	if (req->newptr != USER_ADDR_NULL) {
36442551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
365c4739e2fSRandall Stewart 		SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_SYSCTL, EPERM);
36642551e99SRandall Stewart 		return EPERM;
36742551e99SRandall Stewart 	}
368b3f1ea41SRandall Stewart 	LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) {
36942551e99SRandall Stewart 		SCTP_INP_RLOCK(inp);
37042551e99SRandall Stewart 		xinpcb.last = 0;
37142551e99SRandall Stewart 		xinpcb.local_port = ntohs(inp->sctp_lport);
37242551e99SRandall Stewart 		xinpcb.flags = inp->sctp_flags;
37342551e99SRandall Stewart 		xinpcb.features = inp->sctp_features;
37442551e99SRandall Stewart 		xinpcb.total_sends = inp->total_sends;
37542551e99SRandall Stewart 		xinpcb.total_recvs = inp->total_recvs;
37642551e99SRandall Stewart 		xinpcb.total_nospaces = inp->total_nospaces;
37717205eccSRandall Stewart 		xinpcb.fragmentation_point = inp->sctp_frag_point;
378851b7298SRandall Stewart 		if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
379851b7298SRandall Stewart 		    (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
380851b7298SRandall Stewart 			xinpcb.qlen = 0;
381851b7298SRandall Stewart 			xinpcb.maxqlen = 0;
382851b7298SRandall Stewart 		} else {
383d61a0ae0SRandall Stewart 			xinpcb.qlen = inp->sctp_socket->so_qlen;
384d61a0ae0SRandall Stewart 			xinpcb.maxqlen = inp->sctp_socket->so_qlimit;
385851b7298SRandall Stewart 		}
38642551e99SRandall Stewart 		SCTP_INP_INCR_REF(inp);
38742551e99SRandall Stewart 		SCTP_INP_RUNLOCK(inp);
38842551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
38942551e99SRandall Stewart 		error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
39042551e99SRandall Stewart 		if (error) {
391d61a0ae0SRandall Stewart 			SCTP_INP_DECR_REF(inp);
39242551e99SRandall Stewart 			return error;
39342551e99SRandall Stewart 		}
39442551e99SRandall Stewart 		SCTP_INP_INFO_RLOCK();
39542551e99SRandall Stewart 		SCTP_INP_RLOCK(inp);
396d61a0ae0SRandall Stewart 		error = copy_out_local_addresses(inp, NULL, req);
397d61a0ae0SRandall Stewart 		if (error) {
398d61a0ae0SRandall Stewart 			SCTP_INP_DECR_REF(inp);
399d61a0ae0SRandall Stewart 			return error;
400d61a0ae0SRandall Stewart 		}
40142551e99SRandall Stewart 		LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
40242551e99SRandall Stewart 			SCTP_TCB_LOCK(stcb);
40342551e99SRandall Stewart 			atomic_add_int(&stcb->asoc.refcnt, 1);
40442551e99SRandall Stewart 			SCTP_TCB_UNLOCK(stcb);
405d61a0ae0SRandall Stewart 			xstcb.last = 0;
406d61a0ae0SRandall Stewart 			xstcb.local_port = ntohs(inp->sctp_lport);
407d61a0ae0SRandall Stewart 			xstcb.remote_port = ntohs(stcb->rport);
40842551e99SRandall Stewart 			if (stcb->asoc.primary_destination != NULL)
409d61a0ae0SRandall Stewart 				xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr;
410d61a0ae0SRandall Stewart 			xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay;
411d61a0ae0SRandall Stewart 			xstcb.state = SCTP_GET_STATE(&stcb->asoc);	/* FIXME */
412a99b6783SRandall Stewart 			/* 7.0 does not support this */
413a99b6783SRandall Stewart 			xstcb.assoc_id = sctp_get_associd(stcb);
414d61a0ae0SRandall Stewart 			xstcb.in_streams = stcb->asoc.streamincnt;
415d61a0ae0SRandall Stewart 			xstcb.out_streams = stcb->asoc.streamoutcnt;
416d61a0ae0SRandall Stewart 			xstcb.max_nr_retrans = stcb->asoc.overall_error_count;
417d61a0ae0SRandall Stewart 			xstcb.primary_process = 0;	/* not really supported
418d61a0ae0SRandall Stewart 							 * yet */
419d61a0ae0SRandall Stewart 			xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie;
420d61a0ae0SRandall Stewart 			xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack;
421d61a0ae0SRandall Stewart 			xstcb.retransmitted_tsns = stcb->asoc.marked_retrans;
422851b7298SRandall Stewart 			xstcb.start_time.tv_sec = (uint32_t) stcb->asoc.start_time.tv_sec;
423851b7298SRandall Stewart 			xstcb.start_time.tv_usec = (uint32_t) stcb->asoc.start_time.tv_usec;
424851b7298SRandall Stewart 			xstcb.discontinuity_time.tv_sec = (uint32_t) stcb->asoc.discontinuity_time.tv_sec;
425851b7298SRandall Stewart 			xstcb.discontinuity_time.tv_usec = (uint32_t) stcb->asoc.discontinuity_time.tv_usec;
42642551e99SRandall Stewart 			xstcb.total_sends = stcb->total_sends;
42742551e99SRandall Stewart 			xstcb.total_recvs = stcb->total_recvs;
42842551e99SRandall Stewart 			xstcb.local_tag = stcb->asoc.my_vtag;
42942551e99SRandall Stewart 			xstcb.remote_tag = stcb->asoc.peer_vtag;
43042551e99SRandall Stewart 			xstcb.initial_tsn = stcb->asoc.init_seq_number;
43142551e99SRandall Stewart 			xstcb.highest_tsn = stcb->asoc.sending_seq - 1;
43242551e99SRandall Stewart 			xstcb.cumulative_tsn = stcb->asoc.last_acked_seq;
43342551e99SRandall Stewart 			xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn;
43417205eccSRandall Stewart 			xstcb.mtu = stcb->asoc.smallest_mtu;
4351862b245SRandall Stewart 			xstcb.peers_rwnd = stcb->asoc.peers_rwnd;
436207304d4SRandall Stewart 			xstcb.refcnt = stcb->asoc.refcnt;
43742551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
43842551e99SRandall Stewart 			SCTP_INP_INFO_RUNLOCK();
43942551e99SRandall Stewart 			error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
44042551e99SRandall Stewart 			if (error) {
441d61a0ae0SRandall Stewart 				SCTP_INP_DECR_REF(inp);
442851b7298SRandall Stewart 				atomic_subtract_int(&stcb->asoc.refcnt, 1);
443d61a0ae0SRandall Stewart 				return error;
444d61a0ae0SRandall Stewart 			}
445d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RLOCK();
446d61a0ae0SRandall Stewart 			SCTP_INP_RLOCK(inp);
447d61a0ae0SRandall Stewart 			error = copy_out_local_addresses(inp, stcb, req);
448d61a0ae0SRandall Stewart 			if (error) {
449d61a0ae0SRandall Stewart 				SCTP_INP_DECR_REF(inp);
450851b7298SRandall Stewart 				atomic_subtract_int(&stcb->asoc.refcnt, 1);
45142551e99SRandall Stewart 				return error;
45242551e99SRandall Stewart 			}
45342551e99SRandall Stewart 			TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
454d61a0ae0SRandall Stewart 				xraddr.last = 0;
455d61a0ae0SRandall Stewart 				xraddr.address = net->ro._l_addr;
456d61a0ae0SRandall Stewart 				xraddr.active = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE);
457d61a0ae0SRandall Stewart 				xraddr.confirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0);
458d61a0ae0SRandall Stewart 				xraddr.heartbeat_enabled = ((net->dest_state & SCTP_ADDR_NOHB) == 0);
459d61a0ae0SRandall Stewart 				xraddr.rto = net->RTO;
460d61a0ae0SRandall Stewart 				xraddr.max_path_rtx = net->failure_threshold;
461d61a0ae0SRandall Stewart 				xraddr.rtx = net->marked_retrans;
462d61a0ae0SRandall Stewart 				xraddr.error_counter = net->error_count;
463d61a0ae0SRandall Stewart 				xraddr.cwnd = net->cwnd;
464d61a0ae0SRandall Stewart 				xraddr.flight_size = net->flight_size;
465d61a0ae0SRandall Stewart 				xraddr.mtu = net->mtu;
466851b7298SRandall Stewart 				xraddr.start_time.tv_sec = (uint32_t) net->start_time.tv_sec;
467851b7298SRandall Stewart 				xraddr.start_time.tv_usec = (uint32_t) net->start_time.tv_usec;
468d61a0ae0SRandall Stewart 				SCTP_INP_RUNLOCK(inp);
469d61a0ae0SRandall Stewart 				SCTP_INP_INFO_RUNLOCK();
47042551e99SRandall Stewart 				error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
47142551e99SRandall Stewart 				if (error) {
472d61a0ae0SRandall Stewart 					SCTP_INP_DECR_REF(inp);
473851b7298SRandall Stewart 					atomic_subtract_int(&stcb->asoc.refcnt, 1);
47442551e99SRandall Stewart 					return error;
47542551e99SRandall Stewart 				}
47642551e99SRandall Stewart 				SCTP_INP_INFO_RLOCK();
47742551e99SRandall Stewart 				SCTP_INP_RLOCK(inp);
47842551e99SRandall Stewart 			}
479851b7298SRandall Stewart 			atomic_subtract_int(&stcb->asoc.refcnt, 1);
480d61a0ae0SRandall Stewart 			memset((void *)&xraddr, 0, sizeof(struct xsctp_raddr));
481d61a0ae0SRandall Stewart 			xraddr.last = 1;
48242551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
483d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RUNLOCK();
484d61a0ae0SRandall Stewart 			error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
485d61a0ae0SRandall Stewart 			if (error) {
486d61a0ae0SRandall Stewart 				SCTP_INP_DECR_REF(inp);
487d61a0ae0SRandall Stewart 				return error;
488d61a0ae0SRandall Stewart 			}
489d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RLOCK();
490d61a0ae0SRandall Stewart 			SCTP_INP_RLOCK(inp);
491d61a0ae0SRandall Stewart 		}
492851b7298SRandall Stewart 		SCTP_INP_DECR_REF(inp);
493d61a0ae0SRandall Stewart 		SCTP_INP_RUNLOCK(inp);
494d61a0ae0SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
495d61a0ae0SRandall Stewart 		memset((void *)&xstcb, 0, sizeof(struct xsctp_tcb));
496d61a0ae0SRandall Stewart 		xstcb.last = 1;
497d61a0ae0SRandall Stewart 		error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
498d61a0ae0SRandall Stewart 		if (error) {
499d61a0ae0SRandall Stewart 			return error;
500d61a0ae0SRandall Stewart 		}
501d61a0ae0SRandall Stewart 		SCTP_INP_INFO_RLOCK();
50242551e99SRandall Stewart 	}
50342551e99SRandall Stewart 	SCTP_INP_INFO_RUNLOCK();
50442551e99SRandall Stewart 
505d61a0ae0SRandall Stewart 	memset((void *)&xinpcb, 0, sizeof(struct xsctp_inpcb));
50642551e99SRandall Stewart 	xinpcb.last = 1;
50742551e99SRandall Stewart 	error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
50842551e99SRandall Stewart 	return error;
50942551e99SRandall Stewart }
51042551e99SRandall Stewart 
511c54a18d2SRandall Stewart 
512851b7298SRandall Stewart #define RANGECHK(var, min, max) \
513851b7298SRandall Stewart 	if ((var) < (min)) { (var) = (min); } \
514851b7298SRandall Stewart 	else if ((var) > (max)) { (var) = (max); }
515851b7298SRandall Stewart 
516851b7298SRandall Stewart static int
517c54a18d2SRandall Stewart sysctl_sctp_udp_tunneling_check(SYSCTL_HANDLER_ARGS)
518c54a18d2SRandall Stewart {
519c54a18d2SRandall Stewart 	int error;
520c54a18d2SRandall Stewart 	uint32_t old_sctp_udp_tunneling_port;
521c54a18d2SRandall Stewart 
522a99b6783SRandall Stewart 	SCTP_INP_INFO_WLOCK();
523b3f1ea41SRandall Stewart 	old_sctp_udp_tunneling_port = SCTP_BASE_SYSCTL(sctp_udp_tunneling_port);
524c54a18d2SRandall Stewart 	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
525c54a18d2SRandall Stewart 	if (error == 0) {
526b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), SCTPCTL_UDP_TUNNELING_PORT_MIN, SCTPCTL_UDP_TUNNELING_PORT_MAX);
527a99b6783SRandall Stewart 		if (old_sctp_udp_tunneling_port == SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) {
528a99b6783SRandall Stewart 			error = 0;
529a99b6783SRandall Stewart 			goto out;
530a99b6783SRandall Stewart 		}
531c54a18d2SRandall Stewart 		if (old_sctp_udp_tunneling_port) {
532c54a18d2SRandall Stewart 			sctp_over_udp_stop();
533c54a18d2SRandall Stewart 		}
534b3f1ea41SRandall Stewart 		if (SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) {
535c54a18d2SRandall Stewart 			if (sctp_over_udp_start()) {
536b3f1ea41SRandall Stewart 				SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = 0;
537c54a18d2SRandall Stewart 			}
538c54a18d2SRandall Stewart 		}
539c54a18d2SRandall Stewart 	}
540a99b6783SRandall Stewart out:
541a99b6783SRandall Stewart 	SCTP_INP_INFO_WUNLOCK();
542c54a18d2SRandall Stewart 	return (error);
543c54a18d2SRandall Stewart }
544c54a18d2SRandall Stewart 
545b3f1ea41SRandall Stewart 
546c54a18d2SRandall Stewart static int
547851b7298SRandall Stewart sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
548851b7298SRandall Stewart {
549851b7298SRandall Stewart 	int error;
550851b7298SRandall Stewart 
551851b7298SRandall Stewart 	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
552851b7298SRandall Stewart 	if (error == 0) {
553b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_sendspace), SCTPCTL_MAXDGRAM_MIN, SCTPCTL_MAXDGRAM_MAX);
554b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_recvspace), SCTPCTL_RECVSPACE_MIN, SCTPCTL_RECVSPACE_MAX);
555851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
556b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_auto_asconf), SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX);
557851b7298SRandall Stewart #endif
558b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX);
559b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_nonce), SCTPCTL_ECN_NONCE_MIN, SCTPCTL_ECN_NONCE_MAX);
560b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX);
561b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX);
562b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_init), SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX);
563b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX);
564b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX);
565b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), SCTPCTL_MAXCHUNKS_MIN, SCTPCTL_MAXCHUNKS_MAX);
566b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_hashtblsize), SCTPCTL_TCBHASHSIZE_MIN, SCTPCTL_TCBHASHSIZE_MAX);
567b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_pcbtblsize), SCTPCTL_PCBHASHSIZE_MIN, SCTPCTL_PCBHASHSIZE_MAX);
568b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_min_split_point), SCTPCTL_MIN_SPLIT_POINT_MIN, SCTPCTL_MIN_SPLIT_POINT_MAX);
569b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_chunkscale), SCTPCTL_CHUNKSCALE_MIN, SCTPCTL_CHUNKSCALE_MAX);
570b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default), SCTPCTL_DELAYED_SACK_TIME_MIN, SCTPCTL_DELAYED_SACK_TIME_MAX);
571b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_sack_freq_default), SCTPCTL_SACK_FREQ_MIN, SCTPCTL_SACK_FREQ_MAX);
572b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_system_free_resc_limit), SCTPCTL_SYS_RESOURCE_MIN, SCTPCTL_SYS_RESOURCE_MAX);
573b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit), SCTPCTL_ASOC_RESOURCE_MIN, SCTPCTL_ASOC_RESOURCE_MAX);
574b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default), SCTPCTL_HEARTBEAT_INTERVAL_MIN, SCTPCTL_HEARTBEAT_INTERVAL_MAX);
575b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default), SCTPCTL_PMTU_RAISE_TIME_MIN, SCTPCTL_PMTU_RAISE_TIME_MAX);
576b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default), SCTPCTL_SHUTDOWN_GUARD_TIME_MIN, SCTPCTL_SHUTDOWN_GUARD_TIME_MAX);
577b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_secret_lifetime_default), SCTPCTL_SECRET_LIFETIME_MIN, SCTPCTL_SECRET_LIFETIME_MAX);
578b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_max_default), SCTPCTL_RTO_MAX_MIN, SCTPCTL_RTO_MAX_MAX);
579b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_min_default), SCTPCTL_RTO_MIN_MIN, SCTPCTL_RTO_MIN_MAX);
580b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_initial_default), SCTPCTL_RTO_INITIAL_MIN, SCTPCTL_RTO_INITIAL_MAX);
581b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_init_rto_max_default), SCTPCTL_INIT_RTO_MAX_MIN, SCTPCTL_INIT_RTO_MAX_MAX);
582b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default), SCTPCTL_VALID_COOKIE_LIFE_MIN, SCTPCTL_VALID_COOKIE_LIFE_MAX);
583b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_init_rtx_max_default), SCTPCTL_INIT_RTX_MAX_MIN, SCTPCTL_INIT_RTX_MAX_MAX);
584b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default), SCTPCTL_ASSOC_RTX_MAX_MIN, SCTPCTL_ASSOC_RTX_MAX_MAX);
585b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), SCTPCTL_PATH_RTX_MAX_MIN, SCTPCTL_PATH_RTX_MAX_MAX);
586b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_add_more_threshold), SCTPCTL_ADD_MORE_ON_OUTPUT_MIN, SCTPCTL_ADD_MORE_ON_OUTPUT_MAX);
587b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), SCTPCTL_OUTGOING_STREAMS_MIN, SCTPCTL_OUTGOING_STREAMS_MAX);
588b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_on_off), SCTPCTL_CMT_ON_OFF_MIN, SCTPCTL_CMT_ON_OFF_MAX);
589830d754dSRandall Stewart 		/* EY */
590830d754dSRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), SCTPCTL_NR_SACK_ON_OFF_MIN, SCTPCTL_NR_SACK_ON_OFF_MAX);
591b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_use_dac), SCTPCTL_CMT_USE_DAC_MIN, SCTPCTL_CMT_USE_DAC_MAX);
592b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_pf), SCTPCTL_CMT_PF_MIN, SCTPCTL_CMT_PF_MAX);
593b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), SCTPCTL_CWND_MAXBURST_MIN, SCTPCTL_CWND_MAXBURST_MAX);
594b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_early_fr), SCTPCTL_EARLY_FAST_RETRAN_MIN, SCTPCTL_EARLY_FAST_RETRAN_MAX);
595b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_early_fr_msec), SCTPCTL_EARLY_FAST_RETRAN_MSEC_MIN, SCTPCTL_EARLY_FAST_RETRAN_MSEC_MAX);
596b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), SCTPCTL_ASCONF_AUTH_NOCHK_MIN, SCTPCTL_ASCONF_AUTH_NOCHK_MAX);
597b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_auth_disable), SCTPCTL_AUTH_DISABLE_MIN, SCTPCTL_AUTH_DISABLE_MAX);
598b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_nat_friendly), SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX);
599b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_L2_abc_variable), SCTPCTL_ABC_L_VAR_MIN, SCTPCTL_ABC_L_VAR_MAX);
600b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count), SCTPCTL_MAX_CHAINED_MBUFS_MIN, SCTPCTL_MAX_CHAINED_MBUFS_MAX);
601b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_do_drain), SCTPCTL_DO_SCTP_DRAIN_MIN, SCTPCTL_DO_SCTP_DRAIN_MAX);
602b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_hb_maxburst), SCTPCTL_HB_MAX_BURST_MIN, SCTPCTL_HB_MAX_BURST_MAX);
603b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit), SCTPCTL_ABORT_AT_LIMIT_MIN, SCTPCTL_ABORT_AT_LIMIT_MAX);
604b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_data_order), SCTPCTL_STRICT_DATA_ORDER_MIN, SCTPCTL_STRICT_DATA_ORDER_MAX);
605b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_min_residual), SCTPCTL_MIN_RESIDUAL_MIN, SCTPCTL_MIN_RESIDUAL_MAX);
606b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_max_retran_chunk), SCTPCTL_MAX_RETRAN_CHUNK_MIN, SCTPCTL_MAX_RETRAN_CHUNK_MAX);
607b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_logging_level), SCTPCTL_LOGGING_LEVEL_MIN, SCTPCTL_LOGGING_LEVEL_MAX);
608b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_default_cc_module), SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX);
609b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX);
610851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
611b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX);
612851b7298SRandall Stewart #endif
613851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF)
614b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX);
615851b7298SRandall Stewart #endif
616b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable), SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MIN, SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MAX);
617b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), SCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN, SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX);
618830d754dSRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX);
619830d754dSRandall Stewart 
620851b7298SRandall Stewart #ifdef SCTP_DEBUG
621b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_debug_on), SCTPCTL_DEBUG_MIN, SCTPCTL_DEBUG_MAX);
622b3f1ea41SRandall Stewart #endif
623b3f1ea41SRandall Stewart #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
624b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_output_unlocked), SCTPCTL_OUTPUT_UNLOCKED_MIN, SCTPCTL_OUTPUT_UNLOCKED_MAX);
625851b7298SRandall Stewart #endif
626851b7298SRandall Stewart 	}
627851b7298SRandall Stewart 	return (error);
628851b7298SRandall Stewart }
62942551e99SRandall Stewart 
630b3f1ea41SRandall Stewart 
631b3f1ea41SRandall Stewart 
632b3f1ea41SRandall Stewart #if defined(SCTP_LOCAL_TRACE_BUF)
633b3f1ea41SRandall Stewart static int
634b3f1ea41SRandall Stewart sysctl_sctp_cleartrace(SYSCTL_HANDLER_ARGS)
635b3f1ea41SRandall Stewart {
636a99b6783SRandall Stewart 	int error = 0;
637a99b6783SRandall Stewart 
638b3f1ea41SRandall Stewart 	memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
639a99b6783SRandall Stewart 	return (error);
640b3f1ea41SRandall Stewart }
641b3f1ea41SRandall Stewart 
642b3f1ea41SRandall Stewart #endif
643b3f1ea41SRandall Stewart 
644b3f1ea41SRandall Stewart 
64542551e99SRandall Stewart /*
64642551e99SRandall Stewart  * sysctl definitions
64742551e99SRandall Stewart  */
64842551e99SRandall Stewart 
649851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sendspace, CTLTYPE_INT | CTLFLAG_RW,
650b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_sendspace), 0, sysctl_sctp_check, "IU",
651851b7298SRandall Stewart     SCTPCTL_MAXDGRAM_DESC);
65242551e99SRandall Stewart 
653851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, recvspace, CTLTYPE_INT | CTLFLAG_RW,
654b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_recvspace), 0, sysctl_sctp_check, "IU",
655851b7298SRandall Stewart     SCTPCTL_RECVSPACE_DESC);
65642551e99SRandall Stewart 
65742551e99SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
658851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auto_asconf, CTLTYPE_INT | CTLFLAG_RW,
659b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_auto_asconf), 0, sysctl_sctp_check, "IU",
660851b7298SRandall Stewart     SCTPCTL_AUTOASCONF_DESC);
66142551e99SRandall Stewart #endif
66242551e99SRandall Stewart 
663851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_enable, CTLTYPE_INT | CTLFLAG_RW,
664b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_ecn_enable), 0, sysctl_sctp_check, "IU",
665851b7298SRandall Stewart     SCTPCTL_ECN_ENABLE_DESC);
66642551e99SRandall Stewart 
667851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_nonce, CTLTYPE_INT | CTLFLAG_RW,
668b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_ecn_nonce), 0, sysctl_sctp_check, "IU",
669851b7298SRandall Stewart     SCTPCTL_ECN_NONCE_DESC);
67042551e99SRandall Stewart 
671851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_INT | CTLFLAG_RW,
672b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU",
673851b7298SRandall Stewart     SCTPCTL_STRICT_SACKS_DESC);
67442551e99SRandall Stewart 
675851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_INT | CTLFLAG_RW,
676b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), 0, sysctl_sctp_check, "IU",
677851b7298SRandall Stewart     SCTPCTL_LOOPBACK_NOCSUM_DESC);
67842551e99SRandall Stewart 
679851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_INT | CTLFLAG_RW,
680b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_strict_init), 0, sysctl_sctp_check, "IU",
681851b7298SRandall Stewart     SCTPCTL_STRICT_INIT_DESC);
68242551e99SRandall Stewart 
683851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_INT | CTLFLAG_RW,
684b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), 0, sysctl_sctp_check, "IU",
685851b7298SRandall Stewart     SCTPCTL_PEER_CHKOH_DESC);
68642551e99SRandall Stewart 
687851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxburst, CTLTYPE_INT | CTLFLAG_RW,
688b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_max_burst_default), 0, sysctl_sctp_check, "IU",
689851b7298SRandall Stewart     SCTPCTL_MAXBURST_DESC);
69042551e99SRandall Stewart 
691851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxchunks, CTLTYPE_INT | CTLFLAG_RW,
692b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), 0, sysctl_sctp_check, "IU",
693851b7298SRandall Stewart     SCTPCTL_MAXCHUNKS_DESC);
69442551e99SRandall Stewart 
695851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, tcbhashsize, CTLTYPE_INT | CTLFLAG_RW,
696b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_hashtblsize), 0, sysctl_sctp_check, "IU",
697851b7298SRandall Stewart     SCTPCTL_TCBHASHSIZE_DESC);
69842551e99SRandall Stewart 
699851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pcbhashsize, CTLTYPE_INT | CTLFLAG_RW,
700b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_pcbtblsize), 0, sysctl_sctp_check, "IU",
701851b7298SRandall Stewart     SCTPCTL_PCBHASHSIZE_DESC);
70242551e99SRandall Stewart 
703851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_split_point, CTLTYPE_INT | CTLFLAG_RW,
704b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_min_split_point), 0, sysctl_sctp_check, "IU",
705851b7298SRandall Stewart     SCTPCTL_MIN_SPLIT_POINT_DESC);
70642551e99SRandall Stewart 
707851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, chunkscale, CTLTYPE_INT | CTLFLAG_RW,
708b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_chunkscale), 0, sysctl_sctp_check, "IU",
709851b7298SRandall Stewart     SCTPCTL_CHUNKSCALE_DESC);
71042551e99SRandall Stewart 
711851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, delayed_sack_time, CTLTYPE_INT | CTLFLAG_RW,
712b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default), 0, sysctl_sctp_check, "IU",
713851b7298SRandall Stewart     SCTPCTL_DELAYED_SACK_TIME_DESC);
71442551e99SRandall Stewart 
715851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sack_freq, CTLTYPE_INT | CTLFLAG_RW,
716b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_sack_freq_default), 0, sysctl_sctp_check, "IU",
717851b7298SRandall Stewart     SCTPCTL_SACK_FREQ_DESC);
71842551e99SRandall Stewart 
719851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sys_resource, CTLTYPE_INT | CTLFLAG_RW,
720b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_system_free_resc_limit), 0, sysctl_sctp_check, "IU",
721851b7298SRandall Stewart     SCTPCTL_SYS_RESOURCE_DESC);
72242551e99SRandall Stewart 
723851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asoc_resource, CTLTYPE_INT | CTLFLAG_RW,
724b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit), 0, sysctl_sctp_check, "IU",
725851b7298SRandall Stewart     SCTPCTL_ASOC_RESOURCE_DESC);
72642551e99SRandall Stewart 
727851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, heartbeat_interval, CTLTYPE_INT | CTLFLAG_RW,
728b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default), 0, sysctl_sctp_check, "IU",
729851b7298SRandall Stewart     SCTPCTL_HEARTBEAT_INTERVAL_DESC);
73042551e99SRandall Stewart 
731851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pmtu_raise_time, CTLTYPE_INT | CTLFLAG_RW,
732b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default), 0, sysctl_sctp_check, "IU",
733851b7298SRandall Stewart     SCTPCTL_PMTU_RAISE_TIME_DESC);
73442551e99SRandall Stewart 
735851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, shutdown_guard_time, CTLTYPE_INT | CTLFLAG_RW,
736b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default), 0, sysctl_sctp_check, "IU",
737851b7298SRandall Stewart     SCTPCTL_SHUTDOWN_GUARD_TIME_DESC);
73842551e99SRandall Stewart 
739851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, secret_lifetime, CTLTYPE_INT | CTLFLAG_RW,
740b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_secret_lifetime_default), 0, sysctl_sctp_check, "IU",
741851b7298SRandall Stewart     SCTPCTL_SECRET_LIFETIME_DESC);
74242551e99SRandall Stewart 
743851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_max, CTLTYPE_INT | CTLFLAG_RW,
744b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_rto_max_default), 0, sysctl_sctp_check, "IU",
745851b7298SRandall Stewart     SCTPCTL_RTO_MAX_DESC);
74642551e99SRandall Stewart 
747851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_min, CTLTYPE_INT | CTLFLAG_RW,
748b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_rto_min_default), 0, sysctl_sctp_check, "IU",
749851b7298SRandall Stewart     SCTPCTL_RTO_MIN_DESC);
75042551e99SRandall Stewart 
751851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_initial, CTLTYPE_INT | CTLFLAG_RW,
752b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_rto_initial_default), 0, sysctl_sctp_check, "IU",
753851b7298SRandall Stewart     SCTPCTL_RTO_INITIAL_DESC);
75442551e99SRandall Stewart 
755851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rto_max, CTLTYPE_INT | CTLFLAG_RW,
756b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_init_rto_max_default), 0, sysctl_sctp_check, "IU",
757851b7298SRandall Stewart     SCTPCTL_INIT_RTO_MAX_DESC);
75842551e99SRandall Stewart 
759851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, valid_cookie_life, CTLTYPE_INT | CTLFLAG_RW,
760b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default), 0, sysctl_sctp_check, "IU",
761851b7298SRandall Stewart     SCTPCTL_VALID_COOKIE_LIFE_DESC);
76242551e99SRandall Stewart 
763851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
764b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_init_rtx_max_default), 0, sysctl_sctp_check, "IU",
765851b7298SRandall Stewart     SCTPCTL_INIT_RTX_MAX_DESC);
76642551e99SRandall Stewart 
767851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoc_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
768b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default), 0, sysctl_sctp_check, "IU",
769851b7298SRandall Stewart     SCTPCTL_ASSOC_RTX_MAX_DESC);
77042551e99SRandall Stewart 
771851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, path_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
772b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), 0, sysctl_sctp_check, "IU",
773851b7298SRandall Stewart     SCTPCTL_PATH_RTX_MAX_DESC);
77442551e99SRandall Stewart 
775851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, add_more_on_output, CTLTYPE_INT | CTLFLAG_RW,
776b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_add_more_threshold), 0, sysctl_sctp_check, "IU",
777851b7298SRandall Stewart     SCTPCTL_ADD_MORE_ON_OUTPUT_DESC);
77842551e99SRandall Stewart 
779851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLTYPE_INT | CTLFLAG_RW,
780b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), 0, sysctl_sctp_check, "IU",
781851b7298SRandall Stewart     SCTPCTL_OUTGOING_STREAMS_DESC);
78242551e99SRandall Stewart 
783851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLTYPE_INT | CTLFLAG_RW,
784b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_cmt_on_off), 0, sysctl_sctp_check, "IU",
785851b7298SRandall Stewart     SCTPCTL_CMT_ON_OFF_DESC);
78642551e99SRandall Stewart 
787830d754dSRandall Stewart /* EY */
788830d754dSRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nr_sack_on_off, CTLTYPE_INT | CTLFLAG_RW,
789830d754dSRandall Stewart     &SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), 0, sysctl_sctp_check, "IU",
790830d754dSRandall Stewart     SCTPCTL_NR_SACK_ON_OFF_DESC);
791830d754dSRandall Stewart 
792851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLTYPE_INT | CTLFLAG_RW,
793b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_cmt_use_dac), 0, sysctl_sctp_check, "IU",
794851b7298SRandall Stewart     SCTPCTL_CMT_USE_DAC_DESC);
795b54d3a6cSRandall Stewart 
796851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_pf, CTLTYPE_INT | CTLFLAG_RW,
797b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_cmt_pf), 0, sysctl_sctp_check, "IU",
798851b7298SRandall Stewart     SCTPCTL_CMT_PF_DESC);
799b54d3a6cSRandall Stewart 
800851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cwnd_maxburst, CTLTYPE_INT | CTLFLAG_RW,
801b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), 0, sysctl_sctp_check, "IU",
802851b7298SRandall Stewart     SCTPCTL_CWND_MAXBURST_DESC);
803c4739e2fSRandall Stewart 
804851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran, CTLTYPE_INT | CTLFLAG_RW,
805b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_early_fr), 0, sysctl_sctp_check, "IU",
806851b7298SRandall Stewart     SCTPCTL_EARLY_FAST_RETRAN_DESC);
807851b7298SRandall Stewart 
808851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran_msec, CTLTYPE_INT | CTLFLAG_RW,
809b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_early_fr_msec), 0, sysctl_sctp_check, "IU",
810851b7298SRandall Stewart     SCTPCTL_EARLY_FAST_RETRAN_MSEC_DESC);
811851b7298SRandall Stewart 
812851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLTYPE_INT | CTLFLAG_RW,
813b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), 0, sysctl_sctp_check, "IU",
814851b7298SRandall Stewart     SCTPCTL_ASCONF_AUTH_NOCHK_DESC);
815851b7298SRandall Stewart 
816851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auth_disable, CTLTYPE_INT | CTLFLAG_RW,
817b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_auth_disable), 0, sysctl_sctp_check, "IU",
818851b7298SRandall Stewart     SCTPCTL_AUTH_DISABLE_DESC);
819851b7298SRandall Stewart 
820851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nat_friendly, CTLTYPE_INT | CTLFLAG_RW,
821b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_nat_friendly), 0, sysctl_sctp_check, "IU",
822851b7298SRandall Stewart     SCTPCTL_NAT_FRIENDLY_DESC);
823851b7298SRandall Stewart 
824851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abc_l_var, CTLTYPE_INT | CTLFLAG_RW,
825b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_L2_abc_variable), 0, sysctl_sctp_check, "IU",
826851b7298SRandall Stewart     SCTPCTL_ABC_L_VAR_DESC);
827851b7298SRandall Stewart 
828851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_chained_mbufs, CTLTYPE_INT | CTLFLAG_RW,
829b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count), 0, sysctl_sctp_check, "IU",
830851b7298SRandall Stewart     SCTPCTL_MAX_CHAINED_MBUFS_DESC);
831851b7298SRandall Stewart 
832851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, do_sctp_drain, CTLTYPE_INT | CTLFLAG_RW,
833b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_do_drain), 0, sysctl_sctp_check, "IU",
834851b7298SRandall Stewart     SCTPCTL_DO_SCTP_DRAIN_DESC);
835851b7298SRandall Stewart 
836851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, hb_max_burst, CTLTYPE_INT | CTLFLAG_RW,
837b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_hb_maxburst), 0, sysctl_sctp_check, "IU",
838851b7298SRandall Stewart     SCTPCTL_HB_MAX_BURST_DESC);
839851b7298SRandall Stewart 
840851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abort_at_limit, CTLTYPE_INT | CTLFLAG_RW,
841b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit), 0, sysctl_sctp_check, "IU",
842851b7298SRandall Stewart     SCTPCTL_ABORT_AT_LIMIT_DESC);
843851b7298SRandall Stewart 
844851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_data_order, CTLTYPE_INT | CTLFLAG_RW,
845b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_strict_data_order), 0, sysctl_sctp_check, "IU",
846851b7298SRandall Stewart     SCTPCTL_STRICT_DATA_ORDER_DESC);
847851b7298SRandall Stewart 
848851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_residual, CTLTYPE_INT | CTLFLAG_RW,
849b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_min_residual), 0, sysctl_sctp_check, "IU",
850851b7298SRandall Stewart     SCTPCTL_MIN_RESIDUAL_DESC);
851851b7298SRandall Stewart 
852851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLTYPE_INT | CTLFLAG_RW,
853b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_max_retran_chunk), 0, sysctl_sctp_check, "IU",
854851b7298SRandall Stewart     SCTPCTL_MAX_RETRAN_CHUNK_DESC);
855851b7298SRandall Stewart 
856b27a6b7dSRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, log_level, CTLTYPE_INT | CTLFLAG_RW,
857b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_logging_level), 0, sysctl_sctp_check, "IU",
858851b7298SRandall Stewart     SCTPCTL_LOGGING_LEVEL_DESC);
859851b7298SRandall Stewart 
860851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_cc_module, CTLTYPE_INT | CTLFLAG_RW,
861b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_default_cc_module), 0, sysctl_sctp_check, "IU",
862851b7298SRandall Stewart     SCTPCTL_DEFAULT_CC_MODULE_DESC);
863851b7298SRandall Stewart 
864851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_frag_interleave, CTLTYPE_INT | CTLFLAG_RW,
865b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_default_frag_interleave), 0, sysctl_sctp_check, "IU",
866c4739e2fSRandall Stewart     SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DESC);
867c4739e2fSRandall Stewart 
868851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
869851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_base, CTLTYPE_INT | CTLFLAG_RW,
870b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_mobility_base), 0, sysctl_sctp_check, "IU",
871851b7298SRandall Stewart     SCTPCTL_MOBILITY_BASE_DESC);
872851b7298SRandall Stewart #endif
87342551e99SRandall Stewart 
874851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF)
875851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_fasthandoff, CTLTYPE_INT | CTLFLAG_RW,
876b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), 0, sysctl_sctp_check, "IU",
877851b7298SRandall Stewart     SCTPCTL_MOBILITY_FASTHANDOFF_DESC);
878851b7298SRandall Stewart #endif
87942551e99SRandall Stewart 
880b27a6b7dSRandall Stewart #if defined(SCTP_LOCAL_TRACE_BUF)
881b27a6b7dSRandall Stewart SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, log, CTLFLAG_RD,
882b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_log), sctp_log,
883b27a6b7dSRandall Stewart     "SCTP logging (struct sctp_log)");
884b3f1ea41SRandall Stewart 
885b3f1ea41SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, clear_trace, CTLTYPE_OPAQUE | CTLFLAG_RW,
886b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_log), 0, sysctl_sctp_cleartrace, "IU",
887b3f1ea41SRandall Stewart     "Clear SCTP Logging buffer");
888b3f1ea41SRandall Stewart 
889b3f1ea41SRandall Stewart 
890b3f1ea41SRandall Stewart 
891b27a6b7dSRandall Stewart #endif
892b27a6b7dSRandall Stewart 
893c54a18d2SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_for_client_enable, CTLTYPE_INT | CTLFLAG_RW,
894b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable), 0, sysctl_sctp_check, "IU",
895c54a18d2SRandall Stewart     SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_DESC);
896c54a18d2SRandall Stewart 
897c54a18d2SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_port, CTLTYPE_INT | CTLFLAG_RW,
898b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), 0, sysctl_sctp_udp_tunneling_check, "IU",
899c54a18d2SRandall Stewart     SCTPCTL_UDP_TUNNELING_PORT_DESC);
900c54a18d2SRandall Stewart 
901b3f1ea41SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, enable_sack_immediately, CTLTYPE_INT | CTLFLAG_RW,
902b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), 0, sysctl_sctp_check, "IU",
903b3f1ea41SRandall Stewart     SCTPCTL_SACK_IMMEDIATELY_ENABLE_DESC);
904b3f1ea41SRandall Stewart 
905830d754dSRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nat_friendly_init, CTLTYPE_INT | CTLFLAG_RW,
906830d754dSRandall Stewart     &SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), 0, sysctl_sctp_check, "IU",
907830d754dSRandall Stewart     SCTPCTL_NAT_FRIENDLY_DESC);
908830d754dSRandall Stewart 
909851b7298SRandall Stewart #ifdef SCTP_DEBUG
910851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW,
911b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU",
912851b7298SRandall Stewart     SCTPCTL_DEBUG_DESC);
913851b7298SRandall Stewart #endif				/* SCTP_DEBUG */
91442551e99SRandall Stewart 
91542551e99SRandall Stewart 
916b3f1ea41SRandall Stewart #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
917b3f1ea41SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, output_unlocked, CTLTYPE_INT | CTLFLAG_RW,
918b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_output_unlocked), 0, sysctl_sctp_check, "IU",
919b3f1ea41SRandall Stewart     SCTPCTL_OUTPUT_UNLOCKED_DESC);
920b3f1ea41SRandall Stewart #endif
921b3f1ea41SRandall Stewart 
92242551e99SRandall Stewart SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW,
923b3f1ea41SRandall Stewart     &SCTP_BASE_STATS, sctpstat,
924b27a6b7dSRandall Stewart     "SCTP statistics (struct sctp_stat)");
92542551e99SRandall Stewart 
92642551e99SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD,
92742551e99SRandall Stewart     0, 0, sctp_assoclist,
92842551e99SRandall Stewart     "S,xassoc", "List of active SCTP associations");
929