xref: /freebsd/sys/netinet/sctp_sysctl.c (revision c54a18d26b6afde430af32090857d70da0983532)
142551e99SRandall Stewart /*-
2b1006367SRandall Stewart  * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved.
342551e99SRandall Stewart  *
442551e99SRandall Stewart  * Redistribution and use in source and binary forms, with or without
542551e99SRandall Stewart  * modification, are permitted provided that the following conditions are met:
642551e99SRandall Stewart  *
742551e99SRandall Stewart  * a) Redistributions of source code must retain the above copyright notice,
842551e99SRandall Stewart  *   this list of conditions and the following disclaimer.
942551e99SRandall Stewart  *
1042551e99SRandall Stewart  * b) Redistributions in binary form must reproduce the above copyright
1142551e99SRandall Stewart  *    notice, this list of conditions and the following disclaimer in
1242551e99SRandall Stewart  *   the documentation and/or other materials provided with the distribution.
1342551e99SRandall Stewart  *
1442551e99SRandall Stewart  * c) Neither the name of Cisco Systems, Inc. nor the names of its
1542551e99SRandall Stewart  *    contributors may be used to endorse or promote products derived
1642551e99SRandall Stewart  *    from this software without specific prior written permission.
1742551e99SRandall Stewart  *
1842551e99SRandall Stewart  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1942551e99SRandall Stewart  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
2042551e99SRandall Stewart  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2142551e99SRandall Stewart  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2242551e99SRandall Stewart  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2342551e99SRandall Stewart  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2442551e99SRandall Stewart  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2542551e99SRandall Stewart  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2642551e99SRandall Stewart  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2742551e99SRandall Stewart  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2842551e99SRandall Stewart  * THE POSSIBILITY OF SUCH DAMAGE.
2942551e99SRandall Stewart  */
3042551e99SRandall Stewart 
3142551e99SRandall Stewart #include <sys/cdefs.h>
3242551e99SRandall Stewart __FBSDID("$FreeBSD$");
3342551e99SRandall Stewart 
3442551e99SRandall Stewart #include <netinet/sctp_os.h>
3542551e99SRandall Stewart #include <netinet/sctp_constants.h>
3642551e99SRandall Stewart #include <netinet/sctp_sysctl.h>
3742551e99SRandall Stewart #include <netinet/sctp_pcb.h>
3842551e99SRandall Stewart #include <netinet/sctputil.h>
39d61a0ae0SRandall Stewart #include <netinet/sctp_output.h>
4042551e99SRandall Stewart /*
4142551e99SRandall Stewart  * sysctl tunable variables
4242551e99SRandall Stewart  */
43851b7298SRandall Stewart uint32_t sctp_sendspace = SCTPCTL_MAXDGRAM_DEFAULT;
44851b7298SRandall Stewart uint32_t sctp_recvspace = SCTPCTL_RECVSPACE_DEFAULT;
45851b7298SRandall Stewart uint32_t sctp_auto_asconf = SCTPCTL_AUTOASCONF_DEFAULT;
46c54a18d2SRandall Stewart uint32_t sctp_multiple_asconfs = SCTPCTL_MULTIPLEASCONFS_DEFAULT;
47851b7298SRandall Stewart uint32_t sctp_ecn_enable = SCTPCTL_ECN_ENABLE_DEFAULT;
48851b7298SRandall Stewart uint32_t sctp_ecn_nonce = SCTPCTL_ECN_NONCE_DEFAULT;
49851b7298SRandall Stewart uint32_t sctp_strict_sacks = SCTPCTL_STRICT_SACKS_DEFAULT;
50851b7298SRandall Stewart uint32_t sctp_no_csum_on_loopback = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT;
51851b7298SRandall Stewart uint32_t sctp_strict_init = SCTPCTL_STRICT_INIT_DEFAULT;
529a972525SRandall Stewart uint32_t sctp_peer_chunk_oh = SCTPCTL_PEER_CHKOH_DEFAULT;
53851b7298SRandall Stewart uint32_t sctp_max_burst_default = SCTPCTL_MAXBURST_DEFAULT;
54851b7298SRandall Stewart uint32_t sctp_max_chunks_on_queue = SCTPCTL_MAXCHUNKS_DEFAULT;
55851b7298SRandall Stewart uint32_t sctp_hashtblsize = SCTPCTL_TCBHASHSIZE_DEFAULT;
56851b7298SRandall Stewart uint32_t sctp_pcbtblsize = SCTPCTL_PCBHASHSIZE_DEFAULT;
57851b7298SRandall Stewart uint32_t sctp_min_split_point = SCTPCTL_MIN_SPLIT_POINT_DEFAULT;
58851b7298SRandall Stewart uint32_t sctp_chunkscale = SCTPCTL_CHUNKSCALE_DEFAULT;
59851b7298SRandall Stewart uint32_t sctp_delayed_sack_time_default = SCTPCTL_DELAYED_SACK_TIME_DEFAULT;
60851b7298SRandall Stewart uint32_t sctp_sack_freq_default = SCTPCTL_SACK_FREQ_DEFAULT;
61851b7298SRandall Stewart uint32_t sctp_system_free_resc_limit = SCTPCTL_SYS_RESOURCE_DEFAULT;
62851b7298SRandall Stewart uint32_t sctp_asoc_free_resc_limit = SCTPCTL_ASOC_RESOURCE_DEFAULT;
63851b7298SRandall Stewart uint32_t sctp_heartbeat_interval_default = SCTPCTL_HEARTBEAT_INTERVAL_DEFAULT;
64851b7298SRandall Stewart uint32_t sctp_pmtu_raise_time_default = SCTPCTL_PMTU_RAISE_TIME_DEFAULT;
65851b7298SRandall Stewart uint32_t sctp_shutdown_guard_time_default = SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULT;
66851b7298SRandall Stewart uint32_t sctp_secret_lifetime_default = SCTPCTL_SECRET_LIFETIME_DEFAULT;
67851b7298SRandall Stewart uint32_t sctp_rto_max_default = SCTPCTL_RTO_MAX_DEFAULT;
68851b7298SRandall Stewart uint32_t sctp_rto_min_default = SCTPCTL_RTO_MIN_DEFAULT;
69851b7298SRandall Stewart uint32_t sctp_rto_initial_default = SCTPCTL_RTO_INITIAL_DEFAULT;
70851b7298SRandall Stewart uint32_t sctp_init_rto_max_default = SCTPCTL_INIT_RTO_MAX_DEFAULT;
71851b7298SRandall Stewart uint32_t sctp_valid_cookie_life_default = SCTPCTL_VALID_COOKIE_LIFE_DEFAULT;
72851b7298SRandall Stewart uint32_t sctp_init_rtx_max_default = SCTPCTL_INIT_RTX_MAX_DEFAULT;
73851b7298SRandall Stewart uint32_t sctp_assoc_rtx_max_default = SCTPCTL_ASSOC_RTX_MAX_DEFAULT;
74851b7298SRandall Stewart uint32_t sctp_path_rtx_max_default = SCTPCTL_PATH_RTX_MAX_DEFAULT;
75851b7298SRandall Stewart uint32_t sctp_add_more_threshold = SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT;
76851b7298SRandall Stewart uint32_t sctp_nr_outgoing_streams_default = SCTPCTL_OUTGOING_STREAMS_DEFAULT;
77851b7298SRandall Stewart uint32_t sctp_cmt_on_off = SCTPCTL_CMT_ON_OFF_DEFAULT;
78851b7298SRandall Stewart uint32_t sctp_cmt_use_dac = SCTPCTL_CMT_USE_DAC_DEFAULT;
79851b7298SRandall Stewart uint32_t sctp_cmt_pf = SCTPCTL_CMT_PF_DEFAULT;
80851b7298SRandall Stewart uint32_t sctp_use_cwnd_based_maxburst = SCTPCTL_CWND_MAXBURST_DEFAULT;
81851b7298SRandall Stewart uint32_t sctp_early_fr = SCTPCTL_EARLY_FAST_RETRAN_DEFAULT;
82851b7298SRandall Stewart uint32_t sctp_early_fr_msec = SCTPCTL_EARLY_FAST_RETRAN_MSEC_DEFAULT;
83851b7298SRandall Stewart uint32_t sctp_asconf_auth_nochk = SCTPCTL_ASCONF_AUTH_NOCHK_DEFAULT;
84851b7298SRandall Stewart uint32_t sctp_auth_disable = SCTPCTL_AUTH_DISABLE_DEFAULT;
85851b7298SRandall Stewart uint32_t sctp_nat_friendly = SCTPCTL_NAT_FRIENDLY_DEFAULT;
86851b7298SRandall Stewart uint32_t sctp_L2_abc_variable = SCTPCTL_ABC_L_VAR_DEFAULT;
87851b7298SRandall Stewart uint32_t sctp_mbuf_threshold_count = SCTPCTL_MAX_CHAINED_MBUFS_DEFAULT;
88851b7298SRandall Stewart uint32_t sctp_do_drain = SCTPCTL_DO_SCTP_DRAIN_DEFAULT;
89851b7298SRandall Stewart uint32_t sctp_hb_maxburst = SCTPCTL_HB_MAX_BURST_DEFAULT;
90851b7298SRandall Stewart uint32_t sctp_abort_if_one_2_one_hits_limit = SCTPCTL_ABORT_AT_LIMIT_DEFAULT;
91851b7298SRandall Stewart uint32_t sctp_strict_data_order = SCTPCTL_STRICT_DATA_ORDER_DEFAULT;
92851b7298SRandall Stewart uint32_t sctp_min_residual = SCTPCTL_MIN_RESIDUAL_DEFAULT;
93bff64a4dSRandall Stewart uint32_t sctp_max_retran_chunk = SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT;
94851b7298SRandall Stewart uint32_t sctp_logging_level = SCTPCTL_LOGGING_LEVEL_DEFAULT;
955e54f665SRandall Stewart 
96b54d3a6cSRandall Stewart /* JRS - Variable for default congestion control module */
97b54d3a6cSRandall Stewart uint32_t sctp_default_cc_module = SCTPCTL_DEFAULT_CC_MODULE_DEFAULT;
98c4739e2fSRandall Stewart uint32_t sctp_default_frag_interleave = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT;
99851b7298SRandall Stewart uint32_t sctp_mobility_base = SCTPCTL_MOBILITY_BASE_DEFAULT;
100851b7298SRandall Stewart uint32_t sctp_mobility_fasthandoff = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT;
10142551e99SRandall Stewart 
102b27a6b7dSRandall Stewart #if defined(SCTP_LOCAL_TRACE_BUF)
103b27a6b7dSRandall Stewart struct sctp_log sctp_log;
104b27a6b7dSRandall Stewart 
105b27a6b7dSRandall Stewart #endif
106c54a18d2SRandall Stewart uint32_t sctp_udp_tunneling_for_client_enable = SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_DEFAULT;
107c54a18d2SRandall Stewart uint32_t sctp_udp_tunneling_port = SCTPCTL_UDP_TUNNELING_PORT_DEFAULT;
108c54a18d2SRandall Stewart 
10942551e99SRandall Stewart #ifdef SCTP_DEBUG
110851b7298SRandall Stewart uint32_t sctp_debug_on = SCTPCTL_DEBUG_DEFAULT;
11142551e99SRandall Stewart 
11242551e99SRandall Stewart #endif
113851b7298SRandall Stewart struct sctpstat sctpstat;
11442551e99SRandall Stewart 
115d61a0ae0SRandall Stewart 
116d61a0ae0SRandall Stewart /* It returns an upper limit. No filtering is done here */
117d61a0ae0SRandall Stewart static unsigned int
118d61a0ae0SRandall Stewart number_of_addresses(struct sctp_inpcb *inp)
119d61a0ae0SRandall Stewart {
120d61a0ae0SRandall Stewart 	int cnt;
121d61a0ae0SRandall Stewart 	struct sctp_vrf *vrf;
122d61a0ae0SRandall Stewart 	struct sctp_ifn *sctp_ifn;
123d61a0ae0SRandall Stewart 	struct sctp_ifa *sctp_ifa;
124d61a0ae0SRandall Stewart 	struct sctp_laddr *laddr;
125d61a0ae0SRandall Stewart 
126d61a0ae0SRandall Stewart 	cnt = 0;
127d61a0ae0SRandall Stewart 	/* neither Mac OS X nor FreeBSD support mulitple routing functions */
128d61a0ae0SRandall Stewart 	if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) {
129d61a0ae0SRandall Stewart 		return (0);
130d61a0ae0SRandall Stewart 	}
131d61a0ae0SRandall Stewart 	if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
132d61a0ae0SRandall Stewart 		LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
133d61a0ae0SRandall Stewart 			LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
134d61a0ae0SRandall Stewart 				if ((sctp_ifa->address.sa.sa_family == AF_INET) ||
135d61a0ae0SRandall Stewart 				    (sctp_ifa->address.sa.sa_family == AF_INET6)) {
136d61a0ae0SRandall Stewart 					cnt++;
137d61a0ae0SRandall Stewart 				}
138d61a0ae0SRandall Stewart 			}
139d61a0ae0SRandall Stewart 		}
140d61a0ae0SRandall Stewart 	} else {
141d61a0ae0SRandall Stewart 		LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
142d61a0ae0SRandall Stewart 			if ((laddr->ifa->address.sa.sa_family == AF_INET) ||
143d61a0ae0SRandall Stewart 			    (laddr->ifa->address.sa.sa_family == AF_INET6)) {
144d61a0ae0SRandall Stewart 				cnt++;
145d61a0ae0SRandall Stewart 			}
146d61a0ae0SRandall Stewart 		}
147d61a0ae0SRandall Stewart 	}
148d61a0ae0SRandall Stewart 	return (cnt);
149d61a0ae0SRandall Stewart }
150d61a0ae0SRandall Stewart 
151d61a0ae0SRandall Stewart static int
152d61a0ae0SRandall Stewart copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sysctl_req *req)
153d61a0ae0SRandall Stewart {
154d61a0ae0SRandall Stewart 	struct sctp_ifn *sctp_ifn;
155d61a0ae0SRandall Stewart 	struct sctp_ifa *sctp_ifa;
156d61a0ae0SRandall Stewart 	int loopback_scope, ipv4_local_scope, local_scope, site_scope;
157d61a0ae0SRandall Stewart 	int ipv4_addr_legal, ipv6_addr_legal;
158d61a0ae0SRandall Stewart 	struct sctp_vrf *vrf;
159d61a0ae0SRandall Stewart 	struct xsctp_laddr xladdr;
160d61a0ae0SRandall Stewart 	struct sctp_laddr *laddr;
161d61a0ae0SRandall Stewart 	int error;
162d61a0ae0SRandall Stewart 
163d61a0ae0SRandall Stewart 	/* Turn on all the appropriate scope */
164d61a0ae0SRandall Stewart 	if (stcb) {
165d61a0ae0SRandall Stewart 		/* use association specific values */
166d61a0ae0SRandall Stewart 		loopback_scope = stcb->asoc.loopback_scope;
167d61a0ae0SRandall Stewart 		ipv4_local_scope = stcb->asoc.ipv4_local_scope;
168d61a0ae0SRandall Stewart 		local_scope = stcb->asoc.local_scope;
169d61a0ae0SRandall Stewart 		site_scope = stcb->asoc.site_scope;
170d61a0ae0SRandall Stewart 	} else {
171d61a0ae0SRandall Stewart 		/* use generic values for endpoints */
172d61a0ae0SRandall Stewart 		loopback_scope = 1;
173d61a0ae0SRandall Stewart 		ipv4_local_scope = 1;
174d61a0ae0SRandall Stewart 		local_scope = 1;
175d61a0ae0SRandall Stewart 		site_scope = 1;
176d61a0ae0SRandall Stewart 	}
177d61a0ae0SRandall Stewart 
178d61a0ae0SRandall Stewart 	/* use only address families of interest */
179d61a0ae0SRandall Stewart 	if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
180d61a0ae0SRandall Stewart 		ipv6_addr_legal = 1;
181d61a0ae0SRandall Stewart 		if (SCTP_IPV6_V6ONLY(inp)) {
182d61a0ae0SRandall Stewart 			ipv4_addr_legal = 0;
183d61a0ae0SRandall Stewart 		} else {
184d61a0ae0SRandall Stewart 			ipv4_addr_legal = 1;
185d61a0ae0SRandall Stewart 		}
186d61a0ae0SRandall Stewart 	} else {
187d61a0ae0SRandall Stewart 		ipv4_addr_legal = 1;
188d61a0ae0SRandall Stewart 		ipv6_addr_legal = 0;
189d61a0ae0SRandall Stewart 	}
190d61a0ae0SRandall Stewart 
191d61a0ae0SRandall Stewart 	error = 0;
192d61a0ae0SRandall Stewart 
193d61a0ae0SRandall Stewart 	/* neither Mac OS X nor FreeBSD support mulitple routing functions */
194d61a0ae0SRandall Stewart 	if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) {
1955f26a41dSRandall Stewart 		SCTP_INP_RUNLOCK(inp);
1965f26a41dSRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
197d61a0ae0SRandall Stewart 		return (-1);
198d61a0ae0SRandall Stewart 	}
199d61a0ae0SRandall Stewart 	if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
200d61a0ae0SRandall Stewart 		LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
201d61a0ae0SRandall Stewart 			if ((loopback_scope == 0) && SCTP_IFN_IS_IFT_LOOP(sctp_ifn))
202d61a0ae0SRandall Stewart 				/* Skip loopback if loopback_scope not set */
203d61a0ae0SRandall Stewart 				continue;
204d61a0ae0SRandall Stewart 			LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
205d61a0ae0SRandall Stewart 				if (stcb) {
206d61a0ae0SRandall Stewart 					/*
207d61a0ae0SRandall Stewart 					 * ignore if blacklisted at
208d61a0ae0SRandall Stewart 					 * association level
209d61a0ae0SRandall Stewart 					 */
210d61a0ae0SRandall Stewart 					if (sctp_is_addr_restricted(stcb, sctp_ifa))
211d61a0ae0SRandall Stewart 						continue;
212d61a0ae0SRandall Stewart 				}
2135e2c2d87SRandall Stewart 				switch (sctp_ifa->address.sa.sa_family) {
2145e2c2d87SRandall Stewart 				case AF_INET:
2155e2c2d87SRandall Stewart 					if (ipv4_addr_legal) {
216d61a0ae0SRandall Stewart 						struct sockaddr_in *sin;
217d61a0ae0SRandall Stewart 
218d61a0ae0SRandall Stewart 						sin = (struct sockaddr_in *)&sctp_ifa->address.sa;
219d61a0ae0SRandall Stewart 						if (sin->sin_addr.s_addr == 0)
220d61a0ae0SRandall Stewart 							continue;
221d61a0ae0SRandall Stewart 						if ((ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)))
222d61a0ae0SRandall Stewart 							continue;
2235e2c2d87SRandall Stewart 					} else {
2245e2c2d87SRandall Stewart 						continue;
2255e2c2d87SRandall Stewart 					}
2265e2c2d87SRandall Stewart 					break;
2275e2c2d87SRandall Stewart #ifdef INET6
2285e2c2d87SRandall Stewart 				case AF_INET6:
2295e2c2d87SRandall Stewart 					if (ipv6_addr_legal) {
230d61a0ae0SRandall Stewart 						struct sockaddr_in6 *sin6;
231d61a0ae0SRandall Stewart 
232d61a0ae0SRandall Stewart 						sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sa;
233d61a0ae0SRandall Stewart 						if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
234d61a0ae0SRandall Stewart 							continue;
235d61a0ae0SRandall Stewart 						if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
236d61a0ae0SRandall Stewart 							if (local_scope == 0)
237d61a0ae0SRandall Stewart 								continue;
238d61a0ae0SRandall Stewart 							if (sin6->sin6_scope_id == 0) {
239d61a0ae0SRandall Stewart 								/*
2405e2c2d87SRandall Stewart 								 * bad link
2415e2c2d87SRandall Stewart 								 * local
242d61a0ae0SRandall Stewart 								 * address
243d61a0ae0SRandall Stewart 								 */
244d61a0ae0SRandall Stewart 								if (sa6_recoverscope(sin6) != 0)
245d61a0ae0SRandall Stewart 									continue;
246d61a0ae0SRandall Stewart 							}
247d61a0ae0SRandall Stewart 						}
248d61a0ae0SRandall Stewart 						if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)))
249d61a0ae0SRandall Stewart 							continue;
2505e2c2d87SRandall Stewart 					} else {
251d61a0ae0SRandall Stewart 						continue;
2525e2c2d87SRandall Stewart 					}
2535e2c2d87SRandall Stewart 					break;
2545e2c2d87SRandall Stewart #endif
2555e2c2d87SRandall Stewart 				default:
2565e2c2d87SRandall Stewart 					continue;
2575e2c2d87SRandall Stewart 				}
258851b7298SRandall Stewart 				memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
259d61a0ae0SRandall Stewart 				memcpy((void *)&xladdr.address, (const void *)&sctp_ifa->address, sizeof(union sctp_sockstore));
260d61a0ae0SRandall Stewart 				SCTP_INP_RUNLOCK(inp);
261d61a0ae0SRandall Stewart 				SCTP_INP_INFO_RUNLOCK();
262d61a0ae0SRandall Stewart 				error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
263851b7298SRandall Stewart 				if (error) {
264d61a0ae0SRandall Stewart 					return (error);
265851b7298SRandall Stewart 				} else {
266d61a0ae0SRandall Stewart 					SCTP_INP_INFO_RLOCK();
267d61a0ae0SRandall Stewart 					SCTP_INP_RLOCK(inp);
268d61a0ae0SRandall Stewart 				}
269d61a0ae0SRandall Stewart 			}
270d61a0ae0SRandall Stewart 		}
271d61a0ae0SRandall Stewart 	} else {
272d61a0ae0SRandall Stewart 		LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
273d61a0ae0SRandall Stewart 			/* ignore if blacklisted at association level */
274d61a0ae0SRandall Stewart 			if (stcb && sctp_is_addr_restricted(stcb, laddr->ifa))
275d61a0ae0SRandall Stewart 				continue;
276851b7298SRandall Stewart 			memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
277d61a0ae0SRandall Stewart 			memcpy((void *)&xladdr.address, (const void *)&laddr->ifa->address, sizeof(union sctp_sockstore));
278851b7298SRandall Stewart 			xladdr.start_time.tv_sec = (uint32_t) laddr->start_time.tv_sec;
279851b7298SRandall Stewart 			xladdr.start_time.tv_usec = (uint32_t) laddr->start_time.tv_usec;
280d61a0ae0SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
281d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RUNLOCK();
282d61a0ae0SRandall Stewart 			error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
283851b7298SRandall Stewart 			if (error) {
284d61a0ae0SRandall Stewart 				return (error);
285851b7298SRandall Stewart 			} else {
286d61a0ae0SRandall Stewart 				SCTP_INP_INFO_RLOCK();
287d61a0ae0SRandall Stewart 				SCTP_INP_RLOCK(inp);
288d61a0ae0SRandall Stewart 			}
289d61a0ae0SRandall Stewart 		}
290d61a0ae0SRandall Stewart 	}
291851b7298SRandall Stewart 	memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
292d61a0ae0SRandall Stewart 	xladdr.last = 1;
2935f26a41dSRandall Stewart 	SCTP_INP_RUNLOCK(inp);
2945f26a41dSRandall Stewart 	SCTP_INP_INFO_RUNLOCK();
295d61a0ae0SRandall Stewart 	error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
2965f26a41dSRandall Stewart 
297851b7298SRandall Stewart 	if (error) {
298d61a0ae0SRandall Stewart 		return (error);
299851b7298SRandall Stewart 	} else {
3005f26a41dSRandall Stewart 		SCTP_INP_INFO_RLOCK();
3015f26a41dSRandall Stewart 		SCTP_INP_RLOCK(inp);
302d61a0ae0SRandall Stewart 		return (0);
303d61a0ae0SRandall Stewart 	}
3045f26a41dSRandall Stewart }
305d61a0ae0SRandall Stewart 
30642551e99SRandall Stewart /*
30742551e99SRandall Stewart  * sysctl functions
30842551e99SRandall Stewart  */
30942551e99SRandall Stewart static int
31042551e99SRandall Stewart sctp_assoclist(SYSCTL_HANDLER_ARGS)
31142551e99SRandall Stewart {
31242551e99SRandall Stewart 	unsigned int number_of_endpoints;
31342551e99SRandall Stewart 	unsigned int number_of_local_addresses;
31442551e99SRandall Stewart 	unsigned int number_of_associations;
31542551e99SRandall Stewart 	unsigned int number_of_remote_addresses;
31642551e99SRandall Stewart 	unsigned int n;
31742551e99SRandall Stewart 	int error;
31842551e99SRandall Stewart 	struct sctp_inpcb *inp;
31942551e99SRandall Stewart 	struct sctp_tcb *stcb;
32042551e99SRandall Stewart 	struct sctp_nets *net;
32142551e99SRandall Stewart 	struct xsctp_inpcb xinpcb;
32242551e99SRandall Stewart 	struct xsctp_tcb xstcb;
32342551e99SRandall Stewart 	struct xsctp_raddr xraddr;
32442551e99SRandall Stewart 
32542551e99SRandall Stewart 	number_of_endpoints = 0;
32642551e99SRandall Stewart 	number_of_local_addresses = 0;
32742551e99SRandall Stewart 	number_of_associations = 0;
32842551e99SRandall Stewart 	number_of_remote_addresses = 0;
32942551e99SRandall Stewart 
33042551e99SRandall Stewart 	SCTP_INP_INFO_RLOCK();
33142551e99SRandall Stewart 	if (req->oldptr == USER_ADDR_NULL) {
33242551e99SRandall Stewart 		LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
33342551e99SRandall Stewart 			SCTP_INP_RLOCK(inp);
33442551e99SRandall Stewart 			number_of_endpoints++;
335d61a0ae0SRandall Stewart 			number_of_local_addresses += number_of_addresses(inp);
33642551e99SRandall Stewart 			LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
33742551e99SRandall Stewart 				number_of_associations++;
338d61a0ae0SRandall Stewart 				number_of_local_addresses += number_of_addresses(inp);
33942551e99SRandall Stewart 				TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
34042551e99SRandall Stewart 					number_of_remote_addresses++;
34142551e99SRandall Stewart 				}
34242551e99SRandall Stewart 			}
34342551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
34442551e99SRandall Stewart 		}
34542551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
34642551e99SRandall Stewart 		n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) +
347d61a0ae0SRandall Stewart 		    (number_of_local_addresses + number_of_endpoints + number_of_associations) * sizeof(struct xsctp_laddr) +
348d61a0ae0SRandall Stewart 		    (number_of_associations + number_of_endpoints) * sizeof(struct xsctp_tcb) +
349d61a0ae0SRandall Stewart 		    (number_of_remote_addresses + number_of_associations) * sizeof(struct xsctp_raddr);
350d61a0ae0SRandall Stewart 
35142551e99SRandall Stewart 		/* request some more memory than needed */
35242551e99SRandall Stewart 		req->oldidx = (n + n / 8);
35342551e99SRandall Stewart 		return 0;
35442551e99SRandall Stewart 	}
35542551e99SRandall Stewart 	if (req->newptr != USER_ADDR_NULL) {
35642551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
357c4739e2fSRandall Stewart 		SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_SYSCTL, EPERM);
35842551e99SRandall Stewart 		return EPERM;
35942551e99SRandall Stewart 	}
36042551e99SRandall Stewart 	LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
36142551e99SRandall Stewart 		SCTP_INP_RLOCK(inp);
36242551e99SRandall Stewart 		xinpcb.last = 0;
36342551e99SRandall Stewart 		xinpcb.local_port = ntohs(inp->sctp_lport);
36442551e99SRandall Stewart 		xinpcb.flags = inp->sctp_flags;
36542551e99SRandall Stewart 		xinpcb.features = inp->sctp_features;
36642551e99SRandall Stewart 		xinpcb.total_sends = inp->total_sends;
36742551e99SRandall Stewart 		xinpcb.total_recvs = inp->total_recvs;
36842551e99SRandall Stewart 		xinpcb.total_nospaces = inp->total_nospaces;
36917205eccSRandall Stewart 		xinpcb.fragmentation_point = inp->sctp_frag_point;
370851b7298SRandall Stewart 		if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
371851b7298SRandall Stewart 		    (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
372851b7298SRandall Stewart 			xinpcb.qlen = 0;
373851b7298SRandall Stewart 			xinpcb.maxqlen = 0;
374851b7298SRandall Stewart 		} else {
375d61a0ae0SRandall Stewart 			xinpcb.qlen = inp->sctp_socket->so_qlen;
376d61a0ae0SRandall Stewart 			xinpcb.maxqlen = inp->sctp_socket->so_qlimit;
377851b7298SRandall Stewart 		}
37842551e99SRandall Stewart 		SCTP_INP_INCR_REF(inp);
37942551e99SRandall Stewart 		SCTP_INP_RUNLOCK(inp);
38042551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
38142551e99SRandall Stewart 		error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
38242551e99SRandall Stewart 		if (error) {
383d61a0ae0SRandall Stewart 			SCTP_INP_DECR_REF(inp);
38442551e99SRandall Stewart 			return error;
38542551e99SRandall Stewart 		}
38642551e99SRandall Stewart 		SCTP_INP_INFO_RLOCK();
38742551e99SRandall Stewart 		SCTP_INP_RLOCK(inp);
388d61a0ae0SRandall Stewart 		error = copy_out_local_addresses(inp, NULL, req);
389d61a0ae0SRandall Stewart 		if (error) {
390d61a0ae0SRandall Stewart 			SCTP_INP_DECR_REF(inp);
391d61a0ae0SRandall Stewart 			return error;
392d61a0ae0SRandall Stewart 		}
39342551e99SRandall Stewart 		LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
39442551e99SRandall Stewart 			SCTP_TCB_LOCK(stcb);
39542551e99SRandall Stewart 			atomic_add_int(&stcb->asoc.refcnt, 1);
39642551e99SRandall Stewart 			SCTP_TCB_UNLOCK(stcb);
397d61a0ae0SRandall Stewart 			xstcb.last = 0;
398d61a0ae0SRandall Stewart 			xstcb.local_port = ntohs(inp->sctp_lport);
399d61a0ae0SRandall Stewart 			xstcb.remote_port = ntohs(stcb->rport);
40042551e99SRandall Stewart 			if (stcb->asoc.primary_destination != NULL)
401d61a0ae0SRandall Stewart 				xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr;
402d61a0ae0SRandall Stewart 			xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay;
403d61a0ae0SRandall Stewart 			xstcb.state = SCTP_GET_STATE(&stcb->asoc);	/* FIXME */
404d61a0ae0SRandall Stewart 			xstcb.in_streams = stcb->asoc.streamincnt;
405d61a0ae0SRandall Stewart 			xstcb.out_streams = stcb->asoc.streamoutcnt;
406d61a0ae0SRandall Stewart 			xstcb.max_nr_retrans = stcb->asoc.overall_error_count;
407d61a0ae0SRandall Stewart 			xstcb.primary_process = 0;	/* not really supported
408d61a0ae0SRandall Stewart 							 * yet */
409d61a0ae0SRandall Stewart 			xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie;
410d61a0ae0SRandall Stewart 			xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack;
411d61a0ae0SRandall Stewart 			xstcb.retransmitted_tsns = stcb->asoc.marked_retrans;
412851b7298SRandall Stewart 			xstcb.start_time.tv_sec = (uint32_t) stcb->asoc.start_time.tv_sec;
413851b7298SRandall Stewart 			xstcb.start_time.tv_usec = (uint32_t) stcb->asoc.start_time.tv_usec;
414851b7298SRandall Stewart 			xstcb.discontinuity_time.tv_sec = (uint32_t) stcb->asoc.discontinuity_time.tv_sec;
415851b7298SRandall Stewart 			xstcb.discontinuity_time.tv_usec = (uint32_t) stcb->asoc.discontinuity_time.tv_usec;
41642551e99SRandall Stewart 			xstcb.total_sends = stcb->total_sends;
41742551e99SRandall Stewart 			xstcb.total_recvs = stcb->total_recvs;
41842551e99SRandall Stewart 			xstcb.local_tag = stcb->asoc.my_vtag;
41942551e99SRandall Stewart 			xstcb.remote_tag = stcb->asoc.peer_vtag;
42042551e99SRandall Stewart 			xstcb.initial_tsn = stcb->asoc.init_seq_number;
42142551e99SRandall Stewart 			xstcb.highest_tsn = stcb->asoc.sending_seq - 1;
42242551e99SRandall Stewart 			xstcb.cumulative_tsn = stcb->asoc.last_acked_seq;
42342551e99SRandall Stewart 			xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn;
42417205eccSRandall Stewart 			xstcb.mtu = stcb->asoc.smallest_mtu;
425207304d4SRandall Stewart 			xstcb.refcnt = stcb->asoc.refcnt;
42642551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
42742551e99SRandall Stewart 			SCTP_INP_INFO_RUNLOCK();
42842551e99SRandall Stewart 			error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
42942551e99SRandall Stewart 			if (error) {
430d61a0ae0SRandall Stewart 				SCTP_INP_DECR_REF(inp);
431851b7298SRandall Stewart 				atomic_subtract_int(&stcb->asoc.refcnt, 1);
432d61a0ae0SRandall Stewart 				return error;
433d61a0ae0SRandall Stewart 			}
434d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RLOCK();
435d61a0ae0SRandall Stewart 			SCTP_INP_RLOCK(inp);
436d61a0ae0SRandall Stewart 			error = copy_out_local_addresses(inp, stcb, req);
437d61a0ae0SRandall Stewart 			if (error) {
438d61a0ae0SRandall Stewart 				SCTP_INP_DECR_REF(inp);
439851b7298SRandall Stewart 				atomic_subtract_int(&stcb->asoc.refcnt, 1);
44042551e99SRandall Stewart 				return error;
44142551e99SRandall Stewart 			}
44242551e99SRandall Stewart 			TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
443d61a0ae0SRandall Stewart 				xraddr.last = 0;
444d61a0ae0SRandall Stewart 				xraddr.address = net->ro._l_addr;
445d61a0ae0SRandall Stewart 				xraddr.active = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE);
446d61a0ae0SRandall Stewart 				xraddr.confirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0);
447d61a0ae0SRandall Stewart 				xraddr.heartbeat_enabled = ((net->dest_state & SCTP_ADDR_NOHB) == 0);
448d61a0ae0SRandall Stewart 				xraddr.rto = net->RTO;
449d61a0ae0SRandall Stewart 				xraddr.max_path_rtx = net->failure_threshold;
450d61a0ae0SRandall Stewart 				xraddr.rtx = net->marked_retrans;
451d61a0ae0SRandall Stewart 				xraddr.error_counter = net->error_count;
452d61a0ae0SRandall Stewart 				xraddr.cwnd = net->cwnd;
453d61a0ae0SRandall Stewart 				xraddr.flight_size = net->flight_size;
454d61a0ae0SRandall Stewart 				xraddr.mtu = net->mtu;
455851b7298SRandall Stewart 				xraddr.start_time.tv_sec = (uint32_t) net->start_time.tv_sec;
456851b7298SRandall Stewart 				xraddr.start_time.tv_usec = (uint32_t) net->start_time.tv_usec;
457d61a0ae0SRandall Stewart 				SCTP_INP_RUNLOCK(inp);
458d61a0ae0SRandall Stewart 				SCTP_INP_INFO_RUNLOCK();
45942551e99SRandall Stewart 				error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
46042551e99SRandall Stewart 				if (error) {
461d61a0ae0SRandall Stewart 					SCTP_INP_DECR_REF(inp);
462851b7298SRandall Stewart 					atomic_subtract_int(&stcb->asoc.refcnt, 1);
46342551e99SRandall Stewart 					return error;
46442551e99SRandall Stewart 				}
46542551e99SRandall Stewart 				SCTP_INP_INFO_RLOCK();
46642551e99SRandall Stewart 				SCTP_INP_RLOCK(inp);
46742551e99SRandall Stewart 			}
468851b7298SRandall Stewart 			atomic_subtract_int(&stcb->asoc.refcnt, 1);
469d61a0ae0SRandall Stewart 			memset((void *)&xraddr, 0, sizeof(struct xsctp_raddr));
470d61a0ae0SRandall Stewart 			xraddr.last = 1;
47142551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
472d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RUNLOCK();
473d61a0ae0SRandall Stewart 			error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
474d61a0ae0SRandall Stewart 			if (error) {
475d61a0ae0SRandall Stewart 				SCTP_INP_DECR_REF(inp);
476d61a0ae0SRandall Stewart 				return error;
477d61a0ae0SRandall Stewart 			}
478d61a0ae0SRandall Stewart 			SCTP_INP_INFO_RLOCK();
479d61a0ae0SRandall Stewart 			SCTP_INP_RLOCK(inp);
480d61a0ae0SRandall Stewart 		}
481851b7298SRandall Stewart 		SCTP_INP_DECR_REF(inp);
482d61a0ae0SRandall Stewart 		SCTP_INP_RUNLOCK(inp);
483d61a0ae0SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
484d61a0ae0SRandall Stewart 		memset((void *)&xstcb, 0, sizeof(struct xsctp_tcb));
485d61a0ae0SRandall Stewart 		xstcb.last = 1;
486d61a0ae0SRandall Stewart 		error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
487d61a0ae0SRandall Stewart 		if (error) {
488d61a0ae0SRandall Stewart 			return error;
489d61a0ae0SRandall Stewart 		}
490d61a0ae0SRandall Stewart 		SCTP_INP_INFO_RLOCK();
49142551e99SRandall Stewart 	}
49242551e99SRandall Stewart 	SCTP_INP_INFO_RUNLOCK();
49342551e99SRandall Stewart 
494d61a0ae0SRandall Stewart 	memset((void *)&xinpcb, 0, sizeof(struct xsctp_inpcb));
49542551e99SRandall Stewart 	xinpcb.last = 1;
49642551e99SRandall Stewart 	error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
49742551e99SRandall Stewart 	return error;
49842551e99SRandall Stewart }
49942551e99SRandall Stewart 
500c54a18d2SRandall Stewart 
501c54a18d2SRandall Stewart 
502851b7298SRandall Stewart #define RANGECHK(var, min, max) \
503851b7298SRandall Stewart 	if ((var) < (min)) { (var) = (min); } \
504851b7298SRandall Stewart 	else if ((var) > (max)) { (var) = (max); }
505851b7298SRandall Stewart 
506851b7298SRandall Stewart static int
507c54a18d2SRandall Stewart sysctl_sctp_udp_tunneling_check(SYSCTL_HANDLER_ARGS)
508c54a18d2SRandall Stewart {
509c54a18d2SRandall Stewart 	int error;
510c54a18d2SRandall Stewart 	uint32_t old_sctp_udp_tunneling_port;
511c54a18d2SRandall Stewart 
512c54a18d2SRandall Stewart 	old_sctp_udp_tunneling_port = sctp_udp_tunneling_port;
513c54a18d2SRandall Stewart 	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
514c54a18d2SRandall Stewart 	if (error == 0) {
515c54a18d2SRandall Stewart 		RANGECHK(sctp_udp_tunneling_port, SCTPCTL_UDP_TUNNELING_PORT_MIN, SCTPCTL_UDP_TUNNELING_PORT_MAX);
516c54a18d2SRandall Stewart 		if (old_sctp_udp_tunneling_port) {
517c54a18d2SRandall Stewart 			sctp_over_udp_stop();
518c54a18d2SRandall Stewart 		}
519c54a18d2SRandall Stewart 		if (sctp_udp_tunneling_port) {
520c54a18d2SRandall Stewart 			if (sctp_over_udp_start()) {
521c54a18d2SRandall Stewart 				sctp_udp_tunneling_port = 0;
522c54a18d2SRandall Stewart 			}
523c54a18d2SRandall Stewart 		}
524c54a18d2SRandall Stewart 	}
525c54a18d2SRandall Stewart 	return (error);
526c54a18d2SRandall Stewart }
527c54a18d2SRandall Stewart 
528c54a18d2SRandall Stewart static int
529851b7298SRandall Stewart sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
530851b7298SRandall Stewart {
531851b7298SRandall Stewart 	int error;
532851b7298SRandall Stewart 
533851b7298SRandall Stewart 	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
534851b7298SRandall Stewart 	if (error == 0) {
535851b7298SRandall Stewart 		RANGECHK(sctp_sendspace, SCTPCTL_MAXDGRAM_MIN, SCTPCTL_MAXDGRAM_MAX);
536851b7298SRandall Stewart 		RANGECHK(sctp_recvspace, SCTPCTL_RECVSPACE_MIN, SCTPCTL_RECVSPACE_MAX);
537851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
538851b7298SRandall Stewart 		RANGECHK(sctp_auto_asconf, SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX);
539851b7298SRandall Stewart #endif
540851b7298SRandall Stewart 		RANGECHK(sctp_ecn_enable, SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX);
541851b7298SRandall Stewart 		RANGECHK(sctp_ecn_nonce, SCTPCTL_ECN_NONCE_MIN, SCTPCTL_ECN_NONCE_MAX);
542851b7298SRandall Stewart 		RANGECHK(sctp_strict_sacks, SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX);
543851b7298SRandall Stewart 		RANGECHK(sctp_no_csum_on_loopback, SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX);
544851b7298SRandall Stewart 		RANGECHK(sctp_strict_init, SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX);
545851b7298SRandall Stewart 		RANGECHK(sctp_peer_chunk_oh, SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX);
546851b7298SRandall Stewart 		RANGECHK(sctp_max_burst_default, SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX);
547851b7298SRandall Stewart 		RANGECHK(sctp_max_chunks_on_queue, SCTPCTL_MAXCHUNKS_MIN, SCTPCTL_MAXCHUNKS_MAX);
548851b7298SRandall Stewart 		RANGECHK(sctp_hashtblsize, SCTPCTL_TCBHASHSIZE_MIN, SCTPCTL_TCBHASHSIZE_MAX);
549851b7298SRandall Stewart 		RANGECHK(sctp_pcbtblsize, SCTPCTL_PCBHASHSIZE_MIN, SCTPCTL_PCBHASHSIZE_MAX);
550851b7298SRandall Stewart 		RANGECHK(sctp_min_split_point, SCTPCTL_MIN_SPLIT_POINT_MIN, SCTPCTL_MIN_SPLIT_POINT_MAX);
551851b7298SRandall Stewart 		RANGECHK(sctp_chunkscale, SCTPCTL_CHUNKSCALE_MIN, SCTPCTL_CHUNKSCALE_MAX);
552851b7298SRandall Stewart 		RANGECHK(sctp_delayed_sack_time_default, SCTPCTL_DELAYED_SACK_TIME_MIN, SCTPCTL_DELAYED_SACK_TIME_MAX);
553851b7298SRandall Stewart 		RANGECHK(sctp_sack_freq_default, SCTPCTL_SACK_FREQ_MIN, SCTPCTL_SACK_FREQ_MAX);
554851b7298SRandall Stewart 		RANGECHK(sctp_system_free_resc_limit, SCTPCTL_SYS_RESOURCE_MIN, SCTPCTL_SYS_RESOURCE_MAX);
555851b7298SRandall Stewart 		RANGECHK(sctp_asoc_free_resc_limit, SCTPCTL_ASOC_RESOURCE_MIN, SCTPCTL_ASOC_RESOURCE_MAX);
556851b7298SRandall Stewart 		RANGECHK(sctp_heartbeat_interval_default, SCTPCTL_HEARTBEAT_INTERVAL_MIN, SCTPCTL_HEARTBEAT_INTERVAL_MAX);
557851b7298SRandall Stewart 		RANGECHK(sctp_pmtu_raise_time_default, SCTPCTL_PMTU_RAISE_TIME_MIN, SCTPCTL_PMTU_RAISE_TIME_MAX);
558851b7298SRandall Stewart 		RANGECHK(sctp_shutdown_guard_time_default, SCTPCTL_SHUTDOWN_GUARD_TIME_MIN, SCTPCTL_SHUTDOWN_GUARD_TIME_MAX);
559851b7298SRandall Stewart 		RANGECHK(sctp_secret_lifetime_default, SCTPCTL_SECRET_LIFETIME_MIN, SCTPCTL_SECRET_LIFETIME_MAX);
560851b7298SRandall Stewart 		RANGECHK(sctp_rto_max_default, SCTPCTL_RTO_MAX_MIN, SCTPCTL_RTO_MAX_MAX);
561851b7298SRandall Stewart 		RANGECHK(sctp_rto_min_default, SCTPCTL_RTO_MIN_MIN, SCTPCTL_RTO_MIN_MAX);
562851b7298SRandall Stewart 		RANGECHK(sctp_rto_initial_default, SCTPCTL_RTO_INITIAL_MIN, SCTPCTL_RTO_INITIAL_MAX);
563851b7298SRandall Stewart 		RANGECHK(sctp_init_rto_max_default, SCTPCTL_INIT_RTO_MAX_MIN, SCTPCTL_INIT_RTO_MAX_MAX);
564851b7298SRandall Stewart 		RANGECHK(sctp_valid_cookie_life_default, SCTPCTL_VALID_COOKIE_LIFE_MIN, SCTPCTL_VALID_COOKIE_LIFE_MAX);
565851b7298SRandall Stewart 		RANGECHK(sctp_init_rtx_max_default, SCTPCTL_INIT_RTX_MAX_MIN, SCTPCTL_INIT_RTX_MAX_MAX);
566851b7298SRandall Stewart 		RANGECHK(sctp_assoc_rtx_max_default, SCTPCTL_ASSOC_RTX_MAX_MIN, SCTPCTL_ASSOC_RTX_MAX_MAX);
567851b7298SRandall Stewart 		RANGECHK(sctp_path_rtx_max_default, SCTPCTL_PATH_RTX_MAX_MIN, SCTPCTL_PATH_RTX_MAX_MAX);
568851b7298SRandall Stewart 		RANGECHK(sctp_add_more_threshold, SCTPCTL_ADD_MORE_ON_OUTPUT_MIN, SCTPCTL_ADD_MORE_ON_OUTPUT_MAX);
569851b7298SRandall Stewart 		RANGECHK(sctp_nr_outgoing_streams_default, SCTPCTL_OUTGOING_STREAMS_MIN, SCTPCTL_OUTGOING_STREAMS_MAX);
570851b7298SRandall Stewart 		RANGECHK(sctp_cmt_on_off, SCTPCTL_CMT_ON_OFF_MIN, SCTPCTL_CMT_ON_OFF_MAX);
571851b7298SRandall Stewart 		RANGECHK(sctp_cmt_use_dac, SCTPCTL_CMT_USE_DAC_MIN, SCTPCTL_CMT_USE_DAC_MAX);
572851b7298SRandall Stewart 		RANGECHK(sctp_cmt_pf, SCTPCTL_CMT_PF_MIN, SCTPCTL_CMT_PF_MAX);
573851b7298SRandall Stewart 		RANGECHK(sctp_use_cwnd_based_maxburst, SCTPCTL_CWND_MAXBURST_MIN, SCTPCTL_CWND_MAXBURST_MAX);
574851b7298SRandall Stewart 		RANGECHK(sctp_early_fr, SCTPCTL_EARLY_FAST_RETRAN_MIN, SCTPCTL_EARLY_FAST_RETRAN_MAX);
575851b7298SRandall Stewart 		RANGECHK(sctp_early_fr_msec, SCTPCTL_EARLY_FAST_RETRAN_MSEC_MIN, SCTPCTL_EARLY_FAST_RETRAN_MSEC_MAX);
576851b7298SRandall Stewart 		RANGECHK(sctp_asconf_auth_nochk, SCTPCTL_ASCONF_AUTH_NOCHK_MIN, SCTPCTL_ASCONF_AUTH_NOCHK_MAX);
577851b7298SRandall Stewart 		RANGECHK(sctp_auth_disable, SCTPCTL_AUTH_DISABLE_MIN, SCTPCTL_AUTH_DISABLE_MAX);
578851b7298SRandall Stewart 		RANGECHK(sctp_nat_friendly, SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX);
579851b7298SRandall Stewart 		RANGECHK(sctp_L2_abc_variable, SCTPCTL_ABC_L_VAR_MIN, SCTPCTL_ABC_L_VAR_MAX);
580851b7298SRandall Stewart 		RANGECHK(sctp_mbuf_threshold_count, SCTPCTL_MAX_CHAINED_MBUFS_MIN, SCTPCTL_MAX_CHAINED_MBUFS_MAX);
581851b7298SRandall Stewart 		RANGECHK(sctp_do_drain, SCTPCTL_DO_SCTP_DRAIN_MIN, SCTPCTL_DO_SCTP_DRAIN_MAX);
582851b7298SRandall Stewart 		RANGECHK(sctp_hb_maxburst, SCTPCTL_HB_MAX_BURST_MIN, SCTPCTL_HB_MAX_BURST_MAX);
583851b7298SRandall Stewart 		RANGECHK(sctp_abort_if_one_2_one_hits_limit, SCTPCTL_ABORT_AT_LIMIT_MIN, SCTPCTL_ABORT_AT_LIMIT_MAX);
584851b7298SRandall Stewart 		RANGECHK(sctp_strict_data_order, SCTPCTL_STRICT_DATA_ORDER_MIN, SCTPCTL_STRICT_DATA_ORDER_MAX);
585851b7298SRandall Stewart 		RANGECHK(sctp_min_residual, SCTPCTL_MIN_RESIDUAL_MIN, SCTPCTL_MIN_RESIDUAL_MAX);
586851b7298SRandall Stewart 		RANGECHK(sctp_max_retran_chunk, SCTPCTL_MAX_RETRAN_CHUNK_MIN, SCTPCTL_MAX_RETRAN_CHUNK_MAX);
587851b7298SRandall Stewart 		RANGECHK(sctp_logging_level, SCTPCTL_LOGGING_LEVEL_MIN, SCTPCTL_LOGGING_LEVEL_MAX);
588851b7298SRandall Stewart 		RANGECHK(sctp_default_cc_module, SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX);
589851b7298SRandall Stewart 		RANGECHK(sctp_default_frag_interleave, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX);
590851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
591851b7298SRandall Stewart 		RANGECHK(sctp_mobility_base, SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX);
592851b7298SRandall Stewart #endif
593851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF)
594851b7298SRandall Stewart 		RANGECHK(sctp_mobility_fasthandoff, SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX);
595851b7298SRandall Stewart #endif
596c54a18d2SRandall Stewart 		RANGECHK(sctp_udp_tunneling_for_client_enable, SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MIN, SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MAX);
597851b7298SRandall Stewart #ifdef SCTP_DEBUG
598851b7298SRandall Stewart 		RANGECHK(sctp_debug_on, SCTPCTL_DEBUG_MIN, SCTPCTL_DEBUG_MAX);
599851b7298SRandall Stewart #endif
600851b7298SRandall Stewart 	}
601851b7298SRandall Stewart 	return (error);
602851b7298SRandall Stewart }
60342551e99SRandall Stewart 
60442551e99SRandall Stewart /*
60542551e99SRandall Stewart  * sysctl definitions
60642551e99SRandall Stewart  */
60742551e99SRandall Stewart 
608851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sendspace, CTLTYPE_INT | CTLFLAG_RW,
609851b7298SRandall Stewart     &sctp_sendspace, 0, sysctl_sctp_check, "IU",
610851b7298SRandall Stewart     SCTPCTL_MAXDGRAM_DESC);
61142551e99SRandall Stewart 
612851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, recvspace, CTLTYPE_INT | CTLFLAG_RW,
613851b7298SRandall Stewart     &sctp_recvspace, 0, sysctl_sctp_check, "IU",
614851b7298SRandall Stewart     SCTPCTL_RECVSPACE_DESC);
61542551e99SRandall Stewart 
61642551e99SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
617851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auto_asconf, CTLTYPE_INT | CTLFLAG_RW,
618851b7298SRandall Stewart     &sctp_auto_asconf, 0, sysctl_sctp_check, "IU",
619851b7298SRandall Stewart     SCTPCTL_AUTOASCONF_DESC);
62042551e99SRandall Stewart #endif
62142551e99SRandall Stewart 
622851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_enable, CTLTYPE_INT | CTLFLAG_RW,
623851b7298SRandall Stewart     &sctp_ecn_enable, 0, sysctl_sctp_check, "IU",
624851b7298SRandall Stewart     SCTPCTL_ECN_ENABLE_DESC);
62542551e99SRandall Stewart 
626851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ecn_nonce, CTLTYPE_INT | CTLFLAG_RW,
627851b7298SRandall Stewart     &sctp_ecn_nonce, 0, sysctl_sctp_check, "IU",
628851b7298SRandall Stewart     SCTPCTL_ECN_NONCE_DESC);
62942551e99SRandall Stewart 
630851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_INT | CTLFLAG_RW,
631851b7298SRandall Stewart     &sctp_strict_sacks, 0, sysctl_sctp_check, "IU",
632851b7298SRandall Stewart     SCTPCTL_STRICT_SACKS_DESC);
63342551e99SRandall Stewart 
634851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_INT | CTLFLAG_RW,
635851b7298SRandall Stewart     &sctp_no_csum_on_loopback, 0, sysctl_sctp_check, "IU",
636851b7298SRandall Stewart     SCTPCTL_LOOPBACK_NOCSUM_DESC);
63742551e99SRandall Stewart 
638851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_INT | CTLFLAG_RW,
639851b7298SRandall Stewart     &sctp_strict_init, 0, sysctl_sctp_check, "IU",
640851b7298SRandall Stewart     SCTPCTL_STRICT_INIT_DESC);
64142551e99SRandall Stewart 
642851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_INT | CTLFLAG_RW,
643851b7298SRandall Stewart     &sctp_peer_chunk_oh, 0, sysctl_sctp_check, "IU",
644851b7298SRandall Stewart     SCTPCTL_PEER_CHKOH_DESC);
64542551e99SRandall Stewart 
646851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxburst, CTLTYPE_INT | CTLFLAG_RW,
647851b7298SRandall Stewart     &sctp_max_burst_default, 0, sysctl_sctp_check, "IU",
648851b7298SRandall Stewart     SCTPCTL_MAXBURST_DESC);
64942551e99SRandall Stewart 
650851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxchunks, CTLTYPE_INT | CTLFLAG_RW,
651851b7298SRandall Stewart     &sctp_max_chunks_on_queue, 0, sysctl_sctp_check, "IU",
652851b7298SRandall Stewart     SCTPCTL_MAXCHUNKS_DESC);
65342551e99SRandall Stewart 
654851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, tcbhashsize, CTLTYPE_INT | CTLFLAG_RW,
655851b7298SRandall Stewart     &sctp_hashtblsize, 0, sysctl_sctp_check, "IU",
656851b7298SRandall Stewart     SCTPCTL_TCBHASHSIZE_DESC);
65742551e99SRandall Stewart 
658851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pcbhashsize, CTLTYPE_INT | CTLFLAG_RW,
659851b7298SRandall Stewart     &sctp_pcbtblsize, 0, sysctl_sctp_check, "IU",
660851b7298SRandall Stewart     SCTPCTL_PCBHASHSIZE_DESC);
66142551e99SRandall Stewart 
662851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_split_point, CTLTYPE_INT | CTLFLAG_RW,
663851b7298SRandall Stewart     &sctp_min_split_point, 0, sysctl_sctp_check, "IU",
664851b7298SRandall Stewart     SCTPCTL_MIN_SPLIT_POINT_DESC);
66542551e99SRandall Stewart 
666851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, chunkscale, CTLTYPE_INT | CTLFLAG_RW,
667851b7298SRandall Stewart     &sctp_chunkscale, 0, sysctl_sctp_check, "IU",
668851b7298SRandall Stewart     SCTPCTL_CHUNKSCALE_DESC);
66942551e99SRandall Stewart 
670851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, delayed_sack_time, CTLTYPE_INT | CTLFLAG_RW,
671851b7298SRandall Stewart     &sctp_delayed_sack_time_default, 0, sysctl_sctp_check, "IU",
672851b7298SRandall Stewart     SCTPCTL_DELAYED_SACK_TIME_DESC);
67342551e99SRandall Stewart 
674851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sack_freq, CTLTYPE_INT | CTLFLAG_RW,
675851b7298SRandall Stewart     &sctp_sack_freq_default, 0, sysctl_sctp_check, "IU",
676851b7298SRandall Stewart     SCTPCTL_SACK_FREQ_DESC);
67742551e99SRandall Stewart 
678851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, sys_resource, CTLTYPE_INT | CTLFLAG_RW,
679851b7298SRandall Stewart     &sctp_system_free_resc_limit, 0, sysctl_sctp_check, "IU",
680851b7298SRandall Stewart     SCTPCTL_SYS_RESOURCE_DESC);
68142551e99SRandall Stewart 
682851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asoc_resource, CTLTYPE_INT | CTLFLAG_RW,
683851b7298SRandall Stewart     &sctp_asoc_free_resc_limit, 0, sysctl_sctp_check, "IU",
684851b7298SRandall Stewart     SCTPCTL_ASOC_RESOURCE_DESC);
68542551e99SRandall Stewart 
686851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, heartbeat_interval, CTLTYPE_INT | CTLFLAG_RW,
687851b7298SRandall Stewart     &sctp_heartbeat_interval_default, 0, sysctl_sctp_check, "IU",
688851b7298SRandall Stewart     SCTPCTL_HEARTBEAT_INTERVAL_DESC);
68942551e99SRandall Stewart 
690851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, pmtu_raise_time, CTLTYPE_INT | CTLFLAG_RW,
691851b7298SRandall Stewart     &sctp_pmtu_raise_time_default, 0, sysctl_sctp_check, "IU",
692851b7298SRandall Stewart     SCTPCTL_PMTU_RAISE_TIME_DESC);
69342551e99SRandall Stewart 
694851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, shutdown_guard_time, CTLTYPE_INT | CTLFLAG_RW,
695851b7298SRandall Stewart     &sctp_shutdown_guard_time_default, 0, sysctl_sctp_check, "IU",
696851b7298SRandall Stewart     SCTPCTL_SHUTDOWN_GUARD_TIME_DESC);
69742551e99SRandall Stewart 
698851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, secret_lifetime, CTLTYPE_INT | CTLFLAG_RW,
699851b7298SRandall Stewart     &sctp_secret_lifetime_default, 0, sysctl_sctp_check, "IU",
700851b7298SRandall Stewart     SCTPCTL_SECRET_LIFETIME_DESC);
70142551e99SRandall Stewart 
702851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_max, CTLTYPE_INT | CTLFLAG_RW,
703851b7298SRandall Stewart     &sctp_rto_max_default, 0, sysctl_sctp_check, "IU",
704851b7298SRandall Stewart     SCTPCTL_RTO_MAX_DESC);
70542551e99SRandall Stewart 
706851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_min, CTLTYPE_INT | CTLFLAG_RW,
707851b7298SRandall Stewart     &sctp_rto_min_default, 0, sysctl_sctp_check, "IU",
708851b7298SRandall Stewart     SCTPCTL_RTO_MIN_DESC);
70942551e99SRandall Stewart 
710851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, rto_initial, CTLTYPE_INT | CTLFLAG_RW,
711851b7298SRandall Stewart     &sctp_rto_initial_default, 0, sysctl_sctp_check, "IU",
712851b7298SRandall Stewart     SCTPCTL_RTO_INITIAL_DESC);
71342551e99SRandall Stewart 
714851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rto_max, CTLTYPE_INT | CTLFLAG_RW,
715851b7298SRandall Stewart     &sctp_init_rto_max_default, 0, sysctl_sctp_check, "IU",
716851b7298SRandall Stewart     SCTPCTL_INIT_RTO_MAX_DESC);
71742551e99SRandall Stewart 
718851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, valid_cookie_life, CTLTYPE_INT | CTLFLAG_RW,
719851b7298SRandall Stewart     &sctp_valid_cookie_life_default, 0, sysctl_sctp_check, "IU",
720851b7298SRandall Stewart     SCTPCTL_VALID_COOKIE_LIFE_DESC);
72142551e99SRandall Stewart 
722851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, init_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
723851b7298SRandall Stewart     &sctp_init_rtx_max_default, 0, sysctl_sctp_check, "IU",
724851b7298SRandall Stewart     SCTPCTL_INIT_RTX_MAX_DESC);
72542551e99SRandall Stewart 
726851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoc_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
727851b7298SRandall Stewart     &sctp_assoc_rtx_max_default, 0, sysctl_sctp_check, "IU",
728851b7298SRandall Stewart     SCTPCTL_ASSOC_RTX_MAX_DESC);
72942551e99SRandall Stewart 
730851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, path_rtx_max, CTLTYPE_INT | CTLFLAG_RW,
731851b7298SRandall Stewart     &sctp_path_rtx_max_default, 0, sysctl_sctp_check, "IU",
732851b7298SRandall Stewart     SCTPCTL_PATH_RTX_MAX_DESC);
73342551e99SRandall Stewart 
734851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, add_more_on_output, CTLTYPE_INT | CTLFLAG_RW,
735851b7298SRandall Stewart     &sctp_add_more_threshold, 0, sysctl_sctp_check, "IU",
736851b7298SRandall Stewart     SCTPCTL_ADD_MORE_ON_OUTPUT_DESC);
73742551e99SRandall Stewart 
738851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLTYPE_INT | CTLFLAG_RW,
739851b7298SRandall Stewart     &sctp_nr_outgoing_streams_default, 0, sysctl_sctp_check, "IU",
740851b7298SRandall Stewart     SCTPCTL_OUTGOING_STREAMS_DESC);
74142551e99SRandall Stewart 
742851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLTYPE_INT | CTLFLAG_RW,
743851b7298SRandall Stewart     &sctp_cmt_on_off, 0, sysctl_sctp_check, "IU",
744851b7298SRandall Stewart     SCTPCTL_CMT_ON_OFF_DESC);
74542551e99SRandall Stewart 
746851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLTYPE_INT | CTLFLAG_RW,
747851b7298SRandall Stewart     &sctp_cmt_use_dac, 0, sysctl_sctp_check, "IU",
748851b7298SRandall Stewart     SCTPCTL_CMT_USE_DAC_DESC);
749b54d3a6cSRandall Stewart 
750851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cmt_pf, CTLTYPE_INT | CTLFLAG_RW,
751851b7298SRandall Stewart     &sctp_cmt_pf, 0, sysctl_sctp_check, "IU",
752851b7298SRandall Stewart     SCTPCTL_CMT_PF_DESC);
753b54d3a6cSRandall Stewart 
754851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, cwnd_maxburst, CTLTYPE_INT | CTLFLAG_RW,
755851b7298SRandall Stewart     &sctp_use_cwnd_based_maxburst, 0, sysctl_sctp_check, "IU",
756851b7298SRandall Stewart     SCTPCTL_CWND_MAXBURST_DESC);
757c4739e2fSRandall Stewart 
758851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran, CTLTYPE_INT | CTLFLAG_RW,
759851b7298SRandall Stewart     &sctp_early_fr, 0, sysctl_sctp_check, "IU",
760851b7298SRandall Stewart     SCTPCTL_EARLY_FAST_RETRAN_DESC);
761851b7298SRandall Stewart 
762851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, early_fast_retran_msec, CTLTYPE_INT | CTLFLAG_RW,
763851b7298SRandall Stewart     &sctp_early_fr_msec, 0, sysctl_sctp_check, "IU",
764851b7298SRandall Stewart     SCTPCTL_EARLY_FAST_RETRAN_MSEC_DESC);
765851b7298SRandall Stewart 
766851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLTYPE_INT | CTLFLAG_RW,
767851b7298SRandall Stewart     &sctp_asconf_auth_nochk, 0, sysctl_sctp_check, "IU",
768851b7298SRandall Stewart     SCTPCTL_ASCONF_AUTH_NOCHK_DESC);
769851b7298SRandall Stewart 
770851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auth_disable, CTLTYPE_INT | CTLFLAG_RW,
771851b7298SRandall Stewart     &sctp_auth_disable, 0, sysctl_sctp_check, "IU",
772851b7298SRandall Stewart     SCTPCTL_AUTH_DISABLE_DESC);
773851b7298SRandall Stewart 
774851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, nat_friendly, CTLTYPE_INT | CTLFLAG_RW,
775851b7298SRandall Stewart     &sctp_nat_friendly, 0, sysctl_sctp_check, "IU",
776851b7298SRandall Stewart     SCTPCTL_NAT_FRIENDLY_DESC);
777851b7298SRandall Stewart 
778851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abc_l_var, CTLTYPE_INT | CTLFLAG_RW,
779851b7298SRandall Stewart     &sctp_L2_abc_variable, 0, sysctl_sctp_check, "IU",
780851b7298SRandall Stewart     SCTPCTL_ABC_L_VAR_DESC);
781851b7298SRandall Stewart 
782851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_chained_mbufs, CTLTYPE_INT | CTLFLAG_RW,
783851b7298SRandall Stewart     &sctp_mbuf_threshold_count, 0, sysctl_sctp_check, "IU",
784851b7298SRandall Stewart     SCTPCTL_MAX_CHAINED_MBUFS_DESC);
785851b7298SRandall Stewart 
786851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, do_sctp_drain, CTLTYPE_INT | CTLFLAG_RW,
787851b7298SRandall Stewart     &sctp_do_drain, 0, sysctl_sctp_check, "IU",
788851b7298SRandall Stewart     SCTPCTL_DO_SCTP_DRAIN_DESC);
789851b7298SRandall Stewart 
790851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, hb_max_burst, CTLTYPE_INT | CTLFLAG_RW,
791851b7298SRandall Stewart     &sctp_hb_maxburst, 0, sysctl_sctp_check, "IU",
792851b7298SRandall Stewart     SCTPCTL_HB_MAX_BURST_DESC);
793851b7298SRandall Stewart 
794851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, abort_at_limit, CTLTYPE_INT | CTLFLAG_RW,
795851b7298SRandall Stewart     &sctp_abort_if_one_2_one_hits_limit, 0, sysctl_sctp_check, "IU",
796851b7298SRandall Stewart     SCTPCTL_ABORT_AT_LIMIT_DESC);
797851b7298SRandall Stewart 
798851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_data_order, CTLTYPE_INT | CTLFLAG_RW,
799851b7298SRandall Stewart     &sctp_strict_data_order, 0, sysctl_sctp_check, "IU",
800851b7298SRandall Stewart     SCTPCTL_STRICT_DATA_ORDER_DESC);
801851b7298SRandall Stewart 
802851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, min_residual, CTLTYPE_INT | CTLFLAG_RW,
803851b7298SRandall Stewart     &sctp_min_residual, 0, sysctl_sctp_check, "IU",
804851b7298SRandall Stewart     SCTPCTL_MIN_RESIDUAL_DESC);
805851b7298SRandall Stewart 
806851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLTYPE_INT | CTLFLAG_RW,
807851b7298SRandall Stewart     &sctp_max_retran_chunk, 0, sysctl_sctp_check, "IU",
808851b7298SRandall Stewart     SCTPCTL_MAX_RETRAN_CHUNK_DESC);
809851b7298SRandall Stewart 
810b27a6b7dSRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, log_level, CTLTYPE_INT | CTLFLAG_RW,
811851b7298SRandall Stewart     &sctp_logging_level, 0, sysctl_sctp_check, "IU",
812851b7298SRandall Stewart     SCTPCTL_LOGGING_LEVEL_DESC);
813851b7298SRandall Stewart 
814851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_cc_module, CTLTYPE_INT | CTLFLAG_RW,
815851b7298SRandall Stewart     &sctp_default_cc_module, 0, sysctl_sctp_check, "IU",
816851b7298SRandall Stewart     SCTPCTL_DEFAULT_CC_MODULE_DESC);
817851b7298SRandall Stewart 
818851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, default_frag_interleave, CTLTYPE_INT | CTLFLAG_RW,
819851b7298SRandall Stewart     &sctp_default_frag_interleave, 0, sysctl_sctp_check, "IU",
820c4739e2fSRandall Stewart     SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DESC);
821c4739e2fSRandall Stewart 
822851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
823851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_base, CTLTYPE_INT | CTLFLAG_RW,
824851b7298SRandall Stewart     &sctp_mobility_base, 0, sysctl_sctp_check, "IU",
825851b7298SRandall Stewart     SCTPCTL_MOBILITY_BASE_DESC);
826851b7298SRandall Stewart #endif
82742551e99SRandall Stewart 
828851b7298SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_FASTHANDOFF)
829851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_fasthandoff, CTLTYPE_INT | CTLFLAG_RW,
830851b7298SRandall Stewart     &sctp_mobility_fasthandoff, 0, sysctl_sctp_check, "IU",
831851b7298SRandall Stewart     SCTPCTL_MOBILITY_FASTHANDOFF_DESC);
832851b7298SRandall Stewart #endif
83342551e99SRandall Stewart 
834b27a6b7dSRandall Stewart #if defined(SCTP_LOCAL_TRACE_BUF)
835b27a6b7dSRandall Stewart SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, log, CTLFLAG_RD,
836b27a6b7dSRandall Stewart     &sctp_log, sctp_log,
837b27a6b7dSRandall Stewart     "SCTP logging (struct sctp_log)");
838b27a6b7dSRandall Stewart #endif
839b27a6b7dSRandall Stewart 
840c54a18d2SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_for_client_enable, CTLTYPE_INT | CTLFLAG_RW,
841c54a18d2SRandall Stewart     &sctp_udp_tunneling_for_client_enable, 0, sysctl_sctp_check, "IU",
842c54a18d2SRandall Stewart     SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_DESC);
843c54a18d2SRandall Stewart 
844c54a18d2SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_port, CTLTYPE_INT | CTLFLAG_RW,
845c54a18d2SRandall Stewart     &sctp_udp_tunneling_port, 0, sysctl_sctp_udp_tunneling_check, "IU",
846c54a18d2SRandall Stewart     SCTPCTL_UDP_TUNNELING_PORT_DESC);
847c54a18d2SRandall Stewart 
848851b7298SRandall Stewart #ifdef SCTP_DEBUG
849851b7298SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW,
850851b7298SRandall Stewart     &sctp_debug_on, 0, sysctl_sctp_check, "IU",
851851b7298SRandall Stewart     SCTPCTL_DEBUG_DESC);
852851b7298SRandall Stewart #endif				/* SCTP_DEBUG */
85342551e99SRandall Stewart 
85442551e99SRandall Stewart 
85542551e99SRandall Stewart SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW,
85642551e99SRandall Stewart     &sctpstat, sctpstat,
857b27a6b7dSRandall Stewart     "SCTP statistics (struct sctp_stat)");
85842551e99SRandall Stewart 
85942551e99SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD,
86042551e99SRandall Stewart     0, 0, sctp_assoclist,
86142551e99SRandall Stewart     "S,xassoc", "List of active SCTP associations");
862