xref: /freebsd/sys/netinet/sctp_sysctl.c (revision 4f6b49338e96612ed4c55cf6aa850d32b6f56ea2)
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 */
4124f6b4933SRandall Stewart 			/* 7.0 does not support these */
413a99b6783SRandall Stewart 			xstcb.assoc_id = sctp_get_associd(stcb);
4144f6b4933SRandall Stewart 			xstcb.peers_rwnd = stcb->asoc.peers_rwnd;
415d61a0ae0SRandall Stewart 			xstcb.in_streams = stcb->asoc.streamincnt;
416d61a0ae0SRandall Stewart 			xstcb.out_streams = stcb->asoc.streamoutcnt;
417d61a0ae0SRandall Stewart 			xstcb.max_nr_retrans = stcb->asoc.overall_error_count;
418d61a0ae0SRandall Stewart 			xstcb.primary_process = 0;	/* not really supported
419d61a0ae0SRandall Stewart 							 * yet */
420d61a0ae0SRandall Stewart 			xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie;
421d61a0ae0SRandall Stewart 			xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack;
422d61a0ae0SRandall Stewart 			xstcb.retransmitted_tsns = stcb->asoc.marked_retrans;
423851b7298SRandall Stewart 			xstcb.start_time.tv_sec = (uint32_t) stcb->asoc.start_time.tv_sec;
424851b7298SRandall Stewart 			xstcb.start_time.tv_usec = (uint32_t) stcb->asoc.start_time.tv_usec;
425851b7298SRandall Stewart 			xstcb.discontinuity_time.tv_sec = (uint32_t) stcb->asoc.discontinuity_time.tv_sec;
426851b7298SRandall Stewart 			xstcb.discontinuity_time.tv_usec = (uint32_t) stcb->asoc.discontinuity_time.tv_usec;
42742551e99SRandall Stewart 			xstcb.total_sends = stcb->total_sends;
42842551e99SRandall Stewart 			xstcb.total_recvs = stcb->total_recvs;
42942551e99SRandall Stewart 			xstcb.local_tag = stcb->asoc.my_vtag;
43042551e99SRandall Stewart 			xstcb.remote_tag = stcb->asoc.peer_vtag;
43142551e99SRandall Stewart 			xstcb.initial_tsn = stcb->asoc.init_seq_number;
43242551e99SRandall Stewart 			xstcb.highest_tsn = stcb->asoc.sending_seq - 1;
43342551e99SRandall Stewart 			xstcb.cumulative_tsn = stcb->asoc.last_acked_seq;
43442551e99SRandall Stewart 			xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn;
43517205eccSRandall Stewart 			xstcb.mtu = stcb->asoc.smallest_mtu;
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 
522be27fdd0SRandall Stewart 	SCTP_INP_INFO_RLOCK();
523b3f1ea41SRandall Stewart 	old_sctp_udp_tunneling_port = SCTP_BASE_SYSCTL(sctp_udp_tunneling_port);
524be27fdd0SRandall Stewart 	SCTP_INP_INFO_RUNLOCK();
525c54a18d2SRandall Stewart 	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
526c54a18d2SRandall Stewart 	if (error == 0) {
527b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), SCTPCTL_UDP_TUNNELING_PORT_MIN, SCTPCTL_UDP_TUNNELING_PORT_MAX);
528a99b6783SRandall Stewart 		if (old_sctp_udp_tunneling_port == SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) {
529a99b6783SRandall Stewart 			error = 0;
530a99b6783SRandall Stewart 			goto out;
531a99b6783SRandall Stewart 		}
532be27fdd0SRandall Stewart 		SCTP_INP_INFO_WLOCK();
533c54a18d2SRandall Stewart 		if (old_sctp_udp_tunneling_port) {
534c54a18d2SRandall Stewart 			sctp_over_udp_stop();
535c54a18d2SRandall Stewart 		}
536b3f1ea41SRandall Stewart 		if (SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) {
537c54a18d2SRandall Stewart 			if (sctp_over_udp_start()) {
538b3f1ea41SRandall Stewart 				SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = 0;
539c54a18d2SRandall Stewart 			}
540c54a18d2SRandall Stewart 		}
541be27fdd0SRandall Stewart 		SCTP_INP_INFO_WUNLOCK();
542c54a18d2SRandall Stewart 	}
543a99b6783SRandall Stewart out:
544c54a18d2SRandall Stewart 	return (error);
545c54a18d2SRandall Stewart }
546c54a18d2SRandall Stewart 
547b3f1ea41SRandall Stewart 
548c54a18d2SRandall Stewart static int
549851b7298SRandall Stewart sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
550851b7298SRandall Stewart {
551851b7298SRandall Stewart 	int error;
552851b7298SRandall Stewart 
553851b7298SRandall Stewart 	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
554851b7298SRandall Stewart 	if (error == 0) {
555b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_sendspace), SCTPCTL_MAXDGRAM_MIN, SCTPCTL_MAXDGRAM_MAX);
556b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_recvspace), SCTPCTL_RECVSPACE_MIN, SCTPCTL_RECVSPACE_MAX);
557851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
558b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_auto_asconf), SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX);
559851b7298SRandall Stewart #endif
560b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX);
561b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_nonce), SCTPCTL_ECN_NONCE_MIN, SCTPCTL_ECN_NONCE_MAX);
562b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX);
563b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX);
564b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_init), SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX);
565b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX);
566b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX);
567b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), SCTPCTL_MAXCHUNKS_MIN, SCTPCTL_MAXCHUNKS_MAX);
568b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_hashtblsize), SCTPCTL_TCBHASHSIZE_MIN, SCTPCTL_TCBHASHSIZE_MAX);
569b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_pcbtblsize), SCTPCTL_PCBHASHSIZE_MIN, SCTPCTL_PCBHASHSIZE_MAX);
570b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_min_split_point), SCTPCTL_MIN_SPLIT_POINT_MIN, SCTPCTL_MIN_SPLIT_POINT_MAX);
571b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_chunkscale), SCTPCTL_CHUNKSCALE_MIN, SCTPCTL_CHUNKSCALE_MAX);
572b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default), SCTPCTL_DELAYED_SACK_TIME_MIN, SCTPCTL_DELAYED_SACK_TIME_MAX);
573b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_sack_freq_default), SCTPCTL_SACK_FREQ_MIN, SCTPCTL_SACK_FREQ_MAX);
574b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_system_free_resc_limit), SCTPCTL_SYS_RESOURCE_MIN, SCTPCTL_SYS_RESOURCE_MAX);
575b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit), SCTPCTL_ASOC_RESOURCE_MIN, SCTPCTL_ASOC_RESOURCE_MAX);
576b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default), SCTPCTL_HEARTBEAT_INTERVAL_MIN, SCTPCTL_HEARTBEAT_INTERVAL_MAX);
577b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default), SCTPCTL_PMTU_RAISE_TIME_MIN, SCTPCTL_PMTU_RAISE_TIME_MAX);
578b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default), SCTPCTL_SHUTDOWN_GUARD_TIME_MIN, SCTPCTL_SHUTDOWN_GUARD_TIME_MAX);
579b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_secret_lifetime_default), SCTPCTL_SECRET_LIFETIME_MIN, SCTPCTL_SECRET_LIFETIME_MAX);
580b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_max_default), SCTPCTL_RTO_MAX_MIN, SCTPCTL_RTO_MAX_MAX);
581b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_min_default), SCTPCTL_RTO_MIN_MIN, SCTPCTL_RTO_MIN_MAX);
582b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_rto_initial_default), SCTPCTL_RTO_INITIAL_MIN, SCTPCTL_RTO_INITIAL_MAX);
583b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_init_rto_max_default), SCTPCTL_INIT_RTO_MAX_MIN, SCTPCTL_INIT_RTO_MAX_MAX);
584b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default), SCTPCTL_VALID_COOKIE_LIFE_MIN, SCTPCTL_VALID_COOKIE_LIFE_MAX);
585b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_init_rtx_max_default), SCTPCTL_INIT_RTX_MAX_MIN, SCTPCTL_INIT_RTX_MAX_MAX);
586b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default), SCTPCTL_ASSOC_RTX_MAX_MIN, SCTPCTL_ASSOC_RTX_MAX_MAX);
587b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), SCTPCTL_PATH_RTX_MAX_MIN, SCTPCTL_PATH_RTX_MAX_MAX);
588b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_add_more_threshold), SCTPCTL_ADD_MORE_ON_OUTPUT_MIN, SCTPCTL_ADD_MORE_ON_OUTPUT_MAX);
589b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), SCTPCTL_OUTGOING_STREAMS_MIN, SCTPCTL_OUTGOING_STREAMS_MAX);
590b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_on_off), SCTPCTL_CMT_ON_OFF_MIN, SCTPCTL_CMT_ON_OFF_MAX);
591830d754dSRandall Stewart 		/* EY */
592830d754dSRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), SCTPCTL_NR_SACK_ON_OFF_MIN, SCTPCTL_NR_SACK_ON_OFF_MAX);
593b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_use_dac), SCTPCTL_CMT_USE_DAC_MIN, SCTPCTL_CMT_USE_DAC_MAX);
594b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_pf), SCTPCTL_CMT_PF_MIN, SCTPCTL_CMT_PF_MAX);
595b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), SCTPCTL_CWND_MAXBURST_MIN, SCTPCTL_CWND_MAXBURST_MAX);
596b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_early_fr), SCTPCTL_EARLY_FAST_RETRAN_MIN, SCTPCTL_EARLY_FAST_RETRAN_MAX);
597b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_early_fr_msec), SCTPCTL_EARLY_FAST_RETRAN_MSEC_MIN, SCTPCTL_EARLY_FAST_RETRAN_MSEC_MAX);
598b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), SCTPCTL_ASCONF_AUTH_NOCHK_MIN, SCTPCTL_ASCONF_AUTH_NOCHK_MAX);
599b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_auth_disable), SCTPCTL_AUTH_DISABLE_MIN, SCTPCTL_AUTH_DISABLE_MAX);
600b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_nat_friendly), SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX);
601b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_L2_abc_variable), SCTPCTL_ABC_L_VAR_MIN, SCTPCTL_ABC_L_VAR_MAX);
602b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count), SCTPCTL_MAX_CHAINED_MBUFS_MIN, SCTPCTL_MAX_CHAINED_MBUFS_MAX);
603b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_do_drain), SCTPCTL_DO_SCTP_DRAIN_MIN, SCTPCTL_DO_SCTP_DRAIN_MAX);
604b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_hb_maxburst), SCTPCTL_HB_MAX_BURST_MIN, SCTPCTL_HB_MAX_BURST_MAX);
605b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit), SCTPCTL_ABORT_AT_LIMIT_MIN, SCTPCTL_ABORT_AT_LIMIT_MAX);
606b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_data_order), SCTPCTL_STRICT_DATA_ORDER_MIN, SCTPCTL_STRICT_DATA_ORDER_MAX);
607b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_min_residual), SCTPCTL_MIN_RESIDUAL_MIN, SCTPCTL_MIN_RESIDUAL_MAX);
608b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_max_retran_chunk), SCTPCTL_MAX_RETRAN_CHUNK_MIN, SCTPCTL_MAX_RETRAN_CHUNK_MAX);
609b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_logging_level), SCTPCTL_LOGGING_LEVEL_MIN, SCTPCTL_LOGGING_LEVEL_MAX);
610b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_default_cc_module), SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX);
611b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX);
612851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
613b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX);
614851b7298SRandall Stewart #endif
615851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF)
616b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX);
617851b7298SRandall Stewart #endif
618b3f1ea41SRandall 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);
619b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), SCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN, SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX);
620830d754dSRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX);
621830d754dSRandall Stewart 
622851b7298SRandall Stewart #ifdef SCTP_DEBUG
623b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_debug_on), SCTPCTL_DEBUG_MIN, SCTPCTL_DEBUG_MAX);
624b3f1ea41SRandall Stewart #endif
625b3f1ea41SRandall Stewart #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
626b3f1ea41SRandall Stewart 		RANGECHK(SCTP_BASE_SYSCTL(sctp_output_unlocked), SCTPCTL_OUTPUT_UNLOCKED_MIN, SCTPCTL_OUTPUT_UNLOCKED_MAX);
627851b7298SRandall Stewart #endif
628851b7298SRandall Stewart 	}
629851b7298SRandall Stewart 	return (error);
630851b7298SRandall Stewart }
63142551e99SRandall Stewart 
632b3f1ea41SRandall Stewart 
633b3f1ea41SRandall Stewart 
634b3f1ea41SRandall Stewart #if defined(SCTP_LOCAL_TRACE_BUF)
635b3f1ea41SRandall Stewart static int
636b3f1ea41SRandall Stewart sysctl_sctp_cleartrace(SYSCTL_HANDLER_ARGS)
637b3f1ea41SRandall Stewart {
638a99b6783SRandall Stewart 	int error = 0;
639a99b6783SRandall Stewart 
640b3f1ea41SRandall Stewart 	memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
641a99b6783SRandall Stewart 	return (error);
642b3f1ea41SRandall Stewart }
643b3f1ea41SRandall Stewart 
644b3f1ea41SRandall Stewart #endif
645b3f1ea41SRandall Stewart 
646b3f1ea41SRandall Stewart 
64742551e99SRandall Stewart /*
64842551e99SRandall Stewart  * sysctl definitions
64942551e99SRandall Stewart  */
65042551e99SRandall Stewart 
651851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sendspace, CTLTYPE_INT | CTLFLAG_RW,
652b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_sendspace), 0, sysctl_sctp_check, "IU",
653851b7298SRandall Stewart     SCTPCTL_MAXDGRAM_DESC);
65442551e99SRandall Stewart 
655851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, recvspace, CTLTYPE_INT | CTLFLAG_RW,
656b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_recvspace), 0, sysctl_sctp_check, "IU",
657851b7298SRandall Stewart     SCTPCTL_RECVSPACE_DESC);
65842551e99SRandall Stewart 
65942551e99SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
660851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auto_asconf, CTLTYPE_INT | CTLFLAG_RW,
661b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_auto_asconf), 0, sysctl_sctp_check, "IU",
662851b7298SRandall Stewart     SCTPCTL_AUTOASCONF_DESC);
66342551e99SRandall Stewart #endif
66442551e99SRandall Stewart 
665851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_enable, CTLTYPE_INT | CTLFLAG_RW,
666b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_ecn_enable), 0, sysctl_sctp_check, "IU",
667851b7298SRandall Stewart     SCTPCTL_ECN_ENABLE_DESC);
66842551e99SRandall Stewart 
669851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_nonce, CTLTYPE_INT | CTLFLAG_RW,
670b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_ecn_nonce), 0, sysctl_sctp_check, "IU",
671851b7298SRandall Stewart     SCTPCTL_ECN_NONCE_DESC);
67242551e99SRandall Stewart 
673851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_INT | CTLFLAG_RW,
674b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU",
675851b7298SRandall Stewart     SCTPCTL_STRICT_SACKS_DESC);
67642551e99SRandall Stewart 
677851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_INT | CTLFLAG_RW,
678b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), 0, sysctl_sctp_check, "IU",
679851b7298SRandall Stewart     SCTPCTL_LOOPBACK_NOCSUM_DESC);
68042551e99SRandall Stewart 
681851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_INT | CTLFLAG_RW,
682b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_strict_init), 0, sysctl_sctp_check, "IU",
683851b7298SRandall Stewart     SCTPCTL_STRICT_INIT_DESC);
68442551e99SRandall Stewart 
685851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_INT | CTLFLAG_RW,
686b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), 0, sysctl_sctp_check, "IU",
687851b7298SRandall Stewart     SCTPCTL_PEER_CHKOH_DESC);
68842551e99SRandall Stewart 
689851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxburst, CTLTYPE_INT | CTLFLAG_RW,
690b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_max_burst_default), 0, sysctl_sctp_check, "IU",
691851b7298SRandall Stewart     SCTPCTL_MAXBURST_DESC);
69242551e99SRandall Stewart 
693851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxchunks, CTLTYPE_INT | CTLFLAG_RW,
694b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), 0, sysctl_sctp_check, "IU",
695851b7298SRandall Stewart     SCTPCTL_MAXCHUNKS_DESC);
69642551e99SRandall Stewart 
697851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, tcbhashsize, CTLTYPE_INT | CTLFLAG_RW,
698b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_hashtblsize), 0, sysctl_sctp_check, "IU",
699851b7298SRandall Stewart     SCTPCTL_TCBHASHSIZE_DESC);
70042551e99SRandall Stewart 
701851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pcbhashsize, CTLTYPE_INT | CTLFLAG_RW,
702b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_pcbtblsize), 0, sysctl_sctp_check, "IU",
703851b7298SRandall Stewart     SCTPCTL_PCBHASHSIZE_DESC);
70442551e99SRandall Stewart 
705851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_split_point, CTLTYPE_INT | CTLFLAG_RW,
706b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_min_split_point), 0, sysctl_sctp_check, "IU",
707851b7298SRandall Stewart     SCTPCTL_MIN_SPLIT_POINT_DESC);
70842551e99SRandall Stewart 
709851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, chunkscale, CTLTYPE_INT | CTLFLAG_RW,
710b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_chunkscale), 0, sysctl_sctp_check, "IU",
711851b7298SRandall Stewart     SCTPCTL_CHUNKSCALE_DESC);
71242551e99SRandall Stewart 
713851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, delayed_sack_time, CTLTYPE_INT | CTLFLAG_RW,
714b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default), 0, sysctl_sctp_check, "IU",
715851b7298SRandall Stewart     SCTPCTL_DELAYED_SACK_TIME_DESC);
71642551e99SRandall Stewart 
717851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sack_freq, CTLTYPE_INT | CTLFLAG_RW,
718b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_sack_freq_default), 0, sysctl_sctp_check, "IU",
719851b7298SRandall Stewart     SCTPCTL_SACK_FREQ_DESC);
72042551e99SRandall Stewart 
721851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sys_resource, CTLTYPE_INT | CTLFLAG_RW,
722b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_system_free_resc_limit), 0, sysctl_sctp_check, "IU",
723851b7298SRandall Stewart     SCTPCTL_SYS_RESOURCE_DESC);
72442551e99SRandall Stewart 
725851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asoc_resource, CTLTYPE_INT | CTLFLAG_RW,
726b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit), 0, sysctl_sctp_check, "IU",
727851b7298SRandall Stewart     SCTPCTL_ASOC_RESOURCE_DESC);
72842551e99SRandall Stewart 
729851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, heartbeat_interval, CTLTYPE_INT | CTLFLAG_RW,
730b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default), 0, sysctl_sctp_check, "IU",
731851b7298SRandall Stewart     SCTPCTL_HEARTBEAT_INTERVAL_DESC);
73242551e99SRandall Stewart 
733851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pmtu_raise_time, CTLTYPE_INT | CTLFLAG_RW,
734b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default), 0, sysctl_sctp_check, "IU",
735851b7298SRandall Stewart     SCTPCTL_PMTU_RAISE_TIME_DESC);
73642551e99SRandall Stewart 
737851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, shutdown_guard_time, CTLTYPE_INT | CTLFLAG_RW,
738b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default), 0, sysctl_sctp_check, "IU",
739851b7298SRandall Stewart     SCTPCTL_SHUTDOWN_GUARD_TIME_DESC);
74042551e99SRandall Stewart 
741851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, secret_lifetime, CTLTYPE_INT | CTLFLAG_RW,
742b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_secret_lifetime_default), 0, sysctl_sctp_check, "IU",
743851b7298SRandall Stewart     SCTPCTL_SECRET_LIFETIME_DESC);
74442551e99SRandall Stewart 
745851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_max, CTLTYPE_INT | CTLFLAG_RW,
746b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_rto_max_default), 0, sysctl_sctp_check, "IU",
747851b7298SRandall Stewart     SCTPCTL_RTO_MAX_DESC);
74842551e99SRandall Stewart 
749851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_min, CTLTYPE_INT | CTLFLAG_RW,
750b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_rto_min_default), 0, sysctl_sctp_check, "IU",
751851b7298SRandall Stewart     SCTPCTL_RTO_MIN_DESC);
75242551e99SRandall Stewart 
753851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_initial, CTLTYPE_INT | CTLFLAG_RW,
754b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_rto_initial_default), 0, sysctl_sctp_check, "IU",
755851b7298SRandall Stewart     SCTPCTL_RTO_INITIAL_DESC);
75642551e99SRandall Stewart 
757851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rto_max, CTLTYPE_INT | CTLFLAG_RW,
758b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_init_rto_max_default), 0, sysctl_sctp_check, "IU",
759851b7298SRandall Stewart     SCTPCTL_INIT_RTO_MAX_DESC);
76042551e99SRandall Stewart 
761851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, valid_cookie_life, CTLTYPE_INT | CTLFLAG_RW,
762b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default), 0, sysctl_sctp_check, "IU",
763851b7298SRandall Stewart     SCTPCTL_VALID_COOKIE_LIFE_DESC);
76442551e99SRandall Stewart 
765851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
766b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_init_rtx_max_default), 0, sysctl_sctp_check, "IU",
767851b7298SRandall Stewart     SCTPCTL_INIT_RTX_MAX_DESC);
76842551e99SRandall Stewart 
769851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoc_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
770b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default), 0, sysctl_sctp_check, "IU",
771851b7298SRandall Stewart     SCTPCTL_ASSOC_RTX_MAX_DESC);
77242551e99SRandall Stewart 
773851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, path_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
774b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), 0, sysctl_sctp_check, "IU",
775851b7298SRandall Stewart     SCTPCTL_PATH_RTX_MAX_DESC);
77642551e99SRandall Stewart 
777851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, add_more_on_output, CTLTYPE_INT | CTLFLAG_RW,
778b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_add_more_threshold), 0, sysctl_sctp_check, "IU",
779851b7298SRandall Stewart     SCTPCTL_ADD_MORE_ON_OUTPUT_DESC);
78042551e99SRandall Stewart 
781851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLTYPE_INT | CTLFLAG_RW,
782b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), 0, sysctl_sctp_check, "IU",
783851b7298SRandall Stewart     SCTPCTL_OUTGOING_STREAMS_DESC);
78442551e99SRandall Stewart 
785851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLTYPE_INT | CTLFLAG_RW,
786b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_cmt_on_off), 0, sysctl_sctp_check, "IU",
787851b7298SRandall Stewart     SCTPCTL_CMT_ON_OFF_DESC);
78842551e99SRandall Stewart 
789830d754dSRandall Stewart /* EY */
790830d754dSRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nr_sack_on_off, CTLTYPE_INT | CTLFLAG_RW,
791830d754dSRandall Stewart     &SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), 0, sysctl_sctp_check, "IU",
792830d754dSRandall Stewart     SCTPCTL_NR_SACK_ON_OFF_DESC);
793830d754dSRandall Stewart 
794851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLTYPE_INT | CTLFLAG_RW,
795b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_cmt_use_dac), 0, sysctl_sctp_check, "IU",
796851b7298SRandall Stewart     SCTPCTL_CMT_USE_DAC_DESC);
797b54d3a6cSRandall Stewart 
798851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_pf, CTLTYPE_INT | CTLFLAG_RW,
799b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_cmt_pf), 0, sysctl_sctp_check, "IU",
800851b7298SRandall Stewart     SCTPCTL_CMT_PF_DESC);
801b54d3a6cSRandall Stewart 
802851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cwnd_maxburst, CTLTYPE_INT | CTLFLAG_RW,
803b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), 0, sysctl_sctp_check, "IU",
804851b7298SRandall Stewart     SCTPCTL_CWND_MAXBURST_DESC);
805c4739e2fSRandall Stewart 
806851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran, CTLTYPE_INT | CTLFLAG_RW,
807b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_early_fr), 0, sysctl_sctp_check, "IU",
808851b7298SRandall Stewart     SCTPCTL_EARLY_FAST_RETRAN_DESC);
809851b7298SRandall Stewart 
810851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran_msec, CTLTYPE_INT | CTLFLAG_RW,
811b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_early_fr_msec), 0, sysctl_sctp_check, "IU",
812851b7298SRandall Stewart     SCTPCTL_EARLY_FAST_RETRAN_MSEC_DESC);
813851b7298SRandall Stewart 
814851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLTYPE_INT | CTLFLAG_RW,
815b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), 0, sysctl_sctp_check, "IU",
816851b7298SRandall Stewart     SCTPCTL_ASCONF_AUTH_NOCHK_DESC);
817851b7298SRandall Stewart 
818851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auth_disable, CTLTYPE_INT | CTLFLAG_RW,
819b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_auth_disable), 0, sysctl_sctp_check, "IU",
820851b7298SRandall Stewart     SCTPCTL_AUTH_DISABLE_DESC);
821851b7298SRandall Stewart 
822851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nat_friendly, CTLTYPE_INT | CTLFLAG_RW,
823b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_nat_friendly), 0, sysctl_sctp_check, "IU",
824851b7298SRandall Stewart     SCTPCTL_NAT_FRIENDLY_DESC);
825851b7298SRandall Stewart 
826851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abc_l_var, CTLTYPE_INT | CTLFLAG_RW,
827b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_L2_abc_variable), 0, sysctl_sctp_check, "IU",
828851b7298SRandall Stewart     SCTPCTL_ABC_L_VAR_DESC);
829851b7298SRandall Stewart 
830851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_chained_mbufs, CTLTYPE_INT | CTLFLAG_RW,
831b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count), 0, sysctl_sctp_check, "IU",
832851b7298SRandall Stewart     SCTPCTL_MAX_CHAINED_MBUFS_DESC);
833851b7298SRandall Stewart 
834851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, do_sctp_drain, CTLTYPE_INT | CTLFLAG_RW,
835b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_do_drain), 0, sysctl_sctp_check, "IU",
836851b7298SRandall Stewart     SCTPCTL_DO_SCTP_DRAIN_DESC);
837851b7298SRandall Stewart 
838851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, hb_max_burst, CTLTYPE_INT | CTLFLAG_RW,
839b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_hb_maxburst), 0, sysctl_sctp_check, "IU",
840851b7298SRandall Stewart     SCTPCTL_HB_MAX_BURST_DESC);
841851b7298SRandall Stewart 
842851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abort_at_limit, CTLTYPE_INT | CTLFLAG_RW,
843b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit), 0, sysctl_sctp_check, "IU",
844851b7298SRandall Stewart     SCTPCTL_ABORT_AT_LIMIT_DESC);
845851b7298SRandall Stewart 
846851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_data_order, CTLTYPE_INT | CTLFLAG_RW,
847b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_strict_data_order), 0, sysctl_sctp_check, "IU",
848851b7298SRandall Stewart     SCTPCTL_STRICT_DATA_ORDER_DESC);
849851b7298SRandall Stewart 
850851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_residual, CTLTYPE_INT | CTLFLAG_RW,
851b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_min_residual), 0, sysctl_sctp_check, "IU",
852851b7298SRandall Stewart     SCTPCTL_MIN_RESIDUAL_DESC);
853851b7298SRandall Stewart 
854851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLTYPE_INT | CTLFLAG_RW,
855b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_max_retran_chunk), 0, sysctl_sctp_check, "IU",
856851b7298SRandall Stewart     SCTPCTL_MAX_RETRAN_CHUNK_DESC);
857851b7298SRandall Stewart 
858b27a6b7dSRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, log_level, CTLTYPE_INT | CTLFLAG_RW,
859b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_logging_level), 0, sysctl_sctp_check, "IU",
860851b7298SRandall Stewart     SCTPCTL_LOGGING_LEVEL_DESC);
861851b7298SRandall Stewart 
862851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_cc_module, CTLTYPE_INT | CTLFLAG_RW,
863b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_default_cc_module), 0, sysctl_sctp_check, "IU",
864851b7298SRandall Stewart     SCTPCTL_DEFAULT_CC_MODULE_DESC);
865851b7298SRandall Stewart 
866851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_frag_interleave, CTLTYPE_INT | CTLFLAG_RW,
867b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_default_frag_interleave), 0, sysctl_sctp_check, "IU",
868c4739e2fSRandall Stewart     SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DESC);
869c4739e2fSRandall Stewart 
870851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
871851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_base, CTLTYPE_INT | CTLFLAG_RW,
872b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_mobility_base), 0, sysctl_sctp_check, "IU",
873851b7298SRandall Stewart     SCTPCTL_MOBILITY_BASE_DESC);
874851b7298SRandall Stewart #endif
87542551e99SRandall Stewart 
876851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF)
877851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_fasthandoff, CTLTYPE_INT | CTLFLAG_RW,
878b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), 0, sysctl_sctp_check, "IU",
879851b7298SRandall Stewart     SCTPCTL_MOBILITY_FASTHANDOFF_DESC);
880851b7298SRandall Stewart #endif
88142551e99SRandall Stewart 
882b27a6b7dSRandall Stewart #if defined(SCTP_LOCAL_TRACE_BUF)
883b27a6b7dSRandall Stewart SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, log, CTLFLAG_RD,
884b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_log), sctp_log,
885b27a6b7dSRandall Stewart     "SCTP logging (struct sctp_log)");
886b3f1ea41SRandall Stewart 
887b3f1ea41SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, clear_trace, CTLTYPE_OPAQUE | CTLFLAG_RW,
888b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_log), 0, sysctl_sctp_cleartrace, "IU",
889b3f1ea41SRandall Stewart     "Clear SCTP Logging buffer");
890b3f1ea41SRandall Stewart 
891b3f1ea41SRandall Stewart 
892b3f1ea41SRandall Stewart 
893b27a6b7dSRandall Stewart #endif
894b27a6b7dSRandall Stewart 
895c54a18d2SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_for_client_enable, CTLTYPE_INT | CTLFLAG_RW,
896b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable), 0, sysctl_sctp_check, "IU",
897c54a18d2SRandall Stewart     SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_DESC);
898c54a18d2SRandall Stewart 
899c54a18d2SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_port, CTLTYPE_INT | CTLFLAG_RW,
900b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), 0, sysctl_sctp_udp_tunneling_check, "IU",
901c54a18d2SRandall Stewart     SCTPCTL_UDP_TUNNELING_PORT_DESC);
902c54a18d2SRandall Stewart 
903b3f1ea41SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, enable_sack_immediately, CTLTYPE_INT | CTLFLAG_RW,
904b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), 0, sysctl_sctp_check, "IU",
905b3f1ea41SRandall Stewart     SCTPCTL_SACK_IMMEDIATELY_ENABLE_DESC);
906b3f1ea41SRandall Stewart 
907830d754dSRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nat_friendly_init, CTLTYPE_INT | CTLFLAG_RW,
908830d754dSRandall Stewart     &SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), 0, sysctl_sctp_check, "IU",
909830d754dSRandall Stewart     SCTPCTL_NAT_FRIENDLY_DESC);
910830d754dSRandall Stewart 
911851b7298SRandall Stewart #ifdef SCTP_DEBUG
912851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW,
913b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU",
914851b7298SRandall Stewart     SCTPCTL_DEBUG_DESC);
915851b7298SRandall Stewart #endif				/* SCTP_DEBUG */
91642551e99SRandall Stewart 
91742551e99SRandall Stewart 
918b3f1ea41SRandall Stewart #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
919b3f1ea41SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, output_unlocked, CTLTYPE_INT | CTLFLAG_RW,
920b3f1ea41SRandall Stewart     &SCTP_BASE_SYSCTL(sctp_output_unlocked), 0, sysctl_sctp_check, "IU",
921b3f1ea41SRandall Stewart     SCTPCTL_OUTPUT_UNLOCKED_DESC);
922b3f1ea41SRandall Stewart #endif
923b3f1ea41SRandall Stewart 
92442551e99SRandall Stewart SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW,
925b3f1ea41SRandall Stewart     &SCTP_BASE_STATS, sctpstat,
926b27a6b7dSRandall Stewart     "SCTP statistics (struct sctp_stat)");
92742551e99SRandall Stewart 
92842551e99SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD,
92942551e99SRandall Stewart     0, 0, sctp_assoclist,
93042551e99SRandall Stewart     "S,xassoc", "List of active SCTP associations");
931