xref: /freebsd/sys/netinet/sctp_sysctl.c (revision b1006367704bb48f19bf9ae63fef539028cff085)
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>
3942551e99SRandall Stewart 
4042551e99SRandall Stewart /*
4142551e99SRandall Stewart  * sysctl tunable variables
4242551e99SRandall Stewart  */
4342551e99SRandall Stewart uint32_t sctp_sendspace = (128 * 1024);
4442551e99SRandall Stewart uint32_t sctp_recvspace = 128 * (1024 +
4542551e99SRandall Stewart #ifdef INET6
4642551e99SRandall Stewart     sizeof(struct sockaddr_in6)
4742551e99SRandall Stewart #else
4842551e99SRandall Stewart     sizeof(struct sockaddr_in)
4942551e99SRandall Stewart #endif
5042551e99SRandall Stewart );
5142551e99SRandall Stewart uint32_t sctp_mbuf_threshold_count = SCTP_DEFAULT_MBUFS_IN_CHAIN;
5242551e99SRandall Stewart uint32_t sctp_auto_asconf = SCTP_DEFAULT_AUTO_ASCONF;
5342551e99SRandall Stewart uint32_t sctp_ecn_enable = 1;
5442551e99SRandall Stewart uint32_t sctp_ecn_nonce = 0;
5542551e99SRandall Stewart uint32_t sctp_strict_sacks = 0;
5642551e99SRandall Stewart uint32_t sctp_no_csum_on_loopback = 1;
5742551e99SRandall Stewart uint32_t sctp_strict_init = 1;
5842551e99SRandall Stewart uint32_t sctp_abort_if_one_2_one_hits_limit = 0;
5942551e99SRandall Stewart uint32_t sctp_strict_data_order = 0;
6042551e99SRandall Stewart 
6142551e99SRandall Stewart uint32_t sctp_peer_chunk_oh = sizeof(struct mbuf);
6242551e99SRandall Stewart uint32_t sctp_max_burst_default = SCTP_DEF_MAX_BURST;
6342551e99SRandall Stewart uint32_t sctp_use_cwnd_based_maxburst = 1;
6442551e99SRandall Stewart uint32_t sctp_do_drain = 1;
6542551e99SRandall Stewart uint32_t sctp_hb_maxburst = SCTP_DEF_MAX_BURST;
6642551e99SRandall Stewart 
6742551e99SRandall Stewart uint32_t sctp_max_chunks_on_queue = SCTP_ASOC_MAX_CHUNKS_ON_QUEUE;
6842551e99SRandall Stewart uint32_t sctp_delayed_sack_time_default = SCTP_RECV_MSEC;
6942551e99SRandall Stewart uint32_t sctp_sack_freq_default = SCTP_DEFAULT_SACK_FREQ;
7042551e99SRandall Stewart uint32_t sctp_heartbeat_interval_default = SCTP_HB_DEFAULT_MSEC;
7142551e99SRandall Stewart uint32_t sctp_pmtu_raise_time_default = SCTP_DEF_PMTU_RAISE_SEC;
7242551e99SRandall Stewart uint32_t sctp_shutdown_guard_time_default = SCTP_DEF_MAX_SHUTDOWN_SEC;
7342551e99SRandall Stewart uint32_t sctp_secret_lifetime_default = SCTP_DEFAULT_SECRET_LIFE_SEC;
7442551e99SRandall Stewart uint32_t sctp_rto_max_default = SCTP_RTO_UPPER_BOUND;
7542551e99SRandall Stewart uint32_t sctp_rto_min_default = SCTP_RTO_LOWER_BOUND;
7642551e99SRandall Stewart uint32_t sctp_rto_initial_default = SCTP_RTO_INITIAL;
7742551e99SRandall Stewart uint32_t sctp_init_rto_max_default = SCTP_RTO_UPPER_BOUND;
7842551e99SRandall Stewart uint32_t sctp_valid_cookie_life_default = SCTP_DEFAULT_COOKIE_LIFE;
7942551e99SRandall Stewart uint32_t sctp_init_rtx_max_default = SCTP_DEF_MAX_INIT;
8042551e99SRandall Stewart uint32_t sctp_assoc_rtx_max_default = SCTP_DEF_MAX_SEND;
8142551e99SRandall Stewart uint32_t sctp_path_rtx_max_default = SCTP_DEF_MAX_PATH_RTX;
8242551e99SRandall Stewart uint32_t sctp_nr_outgoing_streams_default = SCTP_OSTREAM_INITIAL;
8342551e99SRandall Stewart uint32_t sctp_add_more_threshold = SCTP_DEFAULT_ADD_MORE;
8442551e99SRandall Stewart uint32_t sctp_asoc_free_resc_limit = SCTP_DEF_ASOC_RESC_LIMIT;
8542551e99SRandall Stewart uint32_t sctp_system_free_resc_limit = SCTP_DEF_SYSTEM_RESC_LIMIT;
8642551e99SRandall Stewart 
8742551e99SRandall Stewart uint32_t sctp_min_split_point = SCTP_DEFAULT_SPLIT_POINT_MIN;
8842551e99SRandall Stewart uint32_t sctp_pcbtblsize = SCTP_PCBHASHSIZE;
8942551e99SRandall Stewart uint32_t sctp_hashtblsize = SCTP_TCBHASHSIZE;
9042551e99SRandall Stewart uint32_t sctp_chunkscale = SCTP_CHUNKQUEUE_SCALE;
9142551e99SRandall Stewart 
9242551e99SRandall Stewart uint32_t sctp_cmt_on_off = 0;
9342551e99SRandall Stewart uint32_t sctp_cmt_use_dac = 0;
94bff64a4dSRandall Stewart uint32_t sctp_max_retran_chunk = SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT;
955e54f665SRandall Stewart 
9642551e99SRandall Stewart 
9742551e99SRandall Stewart uint32_t sctp_L2_abc_variable = 1;
9842551e99SRandall Stewart uint32_t sctp_early_fr = 0;
9942551e99SRandall Stewart uint32_t sctp_early_fr_msec = SCTP_MINFR_MSEC_TIMER;
10042551e99SRandall Stewart uint32_t sctp_says_check_for_deadlock = 0;
10142551e99SRandall Stewart uint32_t sctp_asconf_auth_nochk = 0;
10242551e99SRandall Stewart uint32_t sctp_auth_disable = 0;
10342551e99SRandall Stewart uint32_t sctp_nat_friendly = 1;
1045e54f665SRandall Stewart uint32_t sctp_min_residual = SCTPCTL_MIN_RESIDUAL_DEFAULT;;
1055e54f665SRandall Stewart 
1065e54f665SRandall Stewart 
10742551e99SRandall Stewart struct sctpstat sctpstat;
10842551e99SRandall Stewart 
10942551e99SRandall Stewart #ifdef SCTP_DEBUG
11042551e99SRandall Stewart uint32_t sctp_debug_on = 0;
11142551e99SRandall Stewart 
11242551e99SRandall Stewart #endif
11342551e99SRandall Stewart 
11442551e99SRandall Stewart 
11542551e99SRandall Stewart /*
11642551e99SRandall Stewart  * sysctl functions
11742551e99SRandall Stewart  */
11842551e99SRandall Stewart static int
11942551e99SRandall Stewart sctp_assoclist(SYSCTL_HANDLER_ARGS)
12042551e99SRandall Stewart {
12142551e99SRandall Stewart 	unsigned int number_of_endpoints;
12242551e99SRandall Stewart 	unsigned int number_of_local_addresses;
12342551e99SRandall Stewart 	unsigned int number_of_associations;
12442551e99SRandall Stewart 	unsigned int number_of_remote_addresses;
12542551e99SRandall Stewart 	unsigned int n;
12642551e99SRandall Stewart 	int error;
12742551e99SRandall Stewart 	struct sctp_inpcb *inp;
12842551e99SRandall Stewart 	struct sctp_tcb *stcb;
12942551e99SRandall Stewart 	struct sctp_nets *net;
13042551e99SRandall Stewart 	struct sctp_laddr *laddr;
13142551e99SRandall Stewart 	struct xsctp_inpcb xinpcb;
13242551e99SRandall Stewart 	struct xsctp_tcb xstcb;
13342551e99SRandall Stewart 
13442551e99SRandall Stewart /*	struct xsctp_laddr xladdr; */
13542551e99SRandall Stewart 	struct xsctp_raddr xraddr;
13642551e99SRandall Stewart 
13742551e99SRandall Stewart 	number_of_endpoints = 0;
13842551e99SRandall Stewart 	number_of_local_addresses = 0;
13942551e99SRandall Stewart 	number_of_associations = 0;
14042551e99SRandall Stewart 	number_of_remote_addresses = 0;
14142551e99SRandall Stewart 
14242551e99SRandall Stewart 	SCTP_INP_INFO_RLOCK();
14342551e99SRandall Stewart 	if (req->oldptr == USER_ADDR_NULL) {
14442551e99SRandall Stewart 		LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
14542551e99SRandall Stewart 			SCTP_INP_RLOCK(inp);
14642551e99SRandall Stewart 			number_of_endpoints++;
14742551e99SRandall Stewart 			/* FIXME MT */
14842551e99SRandall Stewart 			LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
14942551e99SRandall Stewart 				number_of_local_addresses++;
15042551e99SRandall Stewart 			}
15142551e99SRandall Stewart 			LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
15242551e99SRandall Stewart 				number_of_associations++;
15342551e99SRandall Stewart 				TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
15442551e99SRandall Stewart 					number_of_remote_addresses++;
15542551e99SRandall Stewart 				}
15642551e99SRandall Stewart 			}
15742551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
15842551e99SRandall Stewart 		}
15942551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
16042551e99SRandall Stewart 		n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) +
16142551e99SRandall Stewart 		    number_of_local_addresses * sizeof(struct xsctp_laddr) +
16242551e99SRandall Stewart 		    number_of_associations * sizeof(struct xsctp_tcb) +
16342551e99SRandall Stewart 		    number_of_remote_addresses * sizeof(struct xsctp_raddr);
16442551e99SRandall Stewart #ifdef SCTP_DEBUG
16542551e99SRandall Stewart 		printf("inps = %u, stcbs = %u, laddrs = %u, raddrs = %u\n",
16642551e99SRandall Stewart 		    number_of_endpoints, number_of_associations,
16742551e99SRandall Stewart 		    number_of_local_addresses, number_of_remote_addresses);
16842551e99SRandall Stewart #endif
16942551e99SRandall Stewart 		/* request some more memory than needed */
17042551e99SRandall Stewart 		req->oldidx = (n + n / 8);
17142551e99SRandall Stewart 		return 0;
17242551e99SRandall Stewart 	}
17342551e99SRandall Stewart 	if (req->newptr != USER_ADDR_NULL) {
17442551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
17542551e99SRandall Stewart 		return EPERM;
17642551e99SRandall Stewart 	}
17742551e99SRandall Stewart 	LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
17842551e99SRandall Stewart 		SCTP_INP_RLOCK(inp);
17942551e99SRandall Stewart 		number_of_local_addresses = 0;
18042551e99SRandall Stewart 		number_of_associations = 0;
18142551e99SRandall Stewart 		/*
18242551e99SRandall Stewart 		 * LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr)
18342551e99SRandall Stewart 		 * { number_of_local_addresses++; }
18442551e99SRandall Stewart 		 */
18542551e99SRandall Stewart 		LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
18642551e99SRandall Stewart 			number_of_associations++;
18742551e99SRandall Stewart 		}
18842551e99SRandall Stewart 		xinpcb.last = 0;
18942551e99SRandall Stewart 		xinpcb.local_port = ntohs(inp->sctp_lport);
19042551e99SRandall Stewart 		xinpcb.number_local_addresses = number_of_local_addresses;
19142551e99SRandall Stewart 		xinpcb.number_associations = number_of_associations;
19242551e99SRandall Stewart 		xinpcb.flags = inp->sctp_flags;
19342551e99SRandall Stewart 		xinpcb.features = inp->sctp_features;
19442551e99SRandall Stewart 		xinpcb.total_sends = inp->total_sends;
19542551e99SRandall Stewart 		xinpcb.total_recvs = inp->total_recvs;
19642551e99SRandall Stewart 		xinpcb.total_nospaces = inp->total_nospaces;
19717205eccSRandall Stewart 		xinpcb.fragmentation_point = inp->sctp_frag_point;
19842551e99SRandall Stewart 		SCTP_INP_INCR_REF(inp);
19942551e99SRandall Stewart 		SCTP_INP_RUNLOCK(inp);
20042551e99SRandall Stewart 		SCTP_INP_INFO_RUNLOCK();
20142551e99SRandall Stewart 		error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
20242551e99SRandall Stewart 		if (error) {
20342551e99SRandall Stewart 			return error;
20442551e99SRandall Stewart 		}
20542551e99SRandall Stewart 		SCTP_INP_INFO_RLOCK();
20642551e99SRandall Stewart 		SCTP_INP_RLOCK(inp);
20742551e99SRandall Stewart 		/* FIXME MT */
20842551e99SRandall Stewart 		/*
20942551e99SRandall Stewart 		 * LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr)
21042551e99SRandall Stewart 		 * { error = SYSCTL_OUT(req, &xladdr, sizeof(struct
21142551e99SRandall Stewart 		 * xsctp_laddr)); if (error) { #if
21242551e99SRandall Stewart 		 * defined(SCTP_PER_SOCKET_LOCKING)
21342551e99SRandall Stewart 		 * SCTP_SOCKET_UNLOCK(SCTP_INP_SO(inp), 1);
21442551e99SRandall Stewart 		 * SCTP_UNLOCK_SHARED(sctppcbinfo.ipi_ep_mtx); #endif
21542551e99SRandall Stewart 		 * SCTP_INP_RUNLOCK(inp); SCTP_INP_INFO_RUNLOCK(); return
21642551e99SRandall Stewart 		 * error; }			}
21742551e99SRandall Stewart 		 */
21842551e99SRandall Stewart 		LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
21942551e99SRandall Stewart 			SCTP_TCB_LOCK(stcb);
22042551e99SRandall Stewart 			atomic_add_int(&stcb->asoc.refcnt, 1);
22142551e99SRandall Stewart 			SCTP_TCB_UNLOCK(stcb);
22242551e99SRandall Stewart 			number_of_local_addresses = 0;
22342551e99SRandall Stewart 			number_of_remote_addresses = 0;
22442551e99SRandall Stewart 			TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
22542551e99SRandall Stewart 				number_of_remote_addresses++;
22642551e99SRandall Stewart 			}
22742551e99SRandall Stewart 			xstcb.LocalPort = ntohs(inp->sctp_lport);
22842551e99SRandall Stewart 			xstcb.RemPort = ntohs(stcb->rport);
22942551e99SRandall Stewart 			if (stcb->asoc.primary_destination != NULL)
23042551e99SRandall Stewart 				xstcb.RemPrimAddr = stcb->asoc.primary_destination->ro._l_addr;
23142551e99SRandall Stewart 			xstcb.HeartBeatInterval = stcb->asoc.heart_beat_delay;
23242551e99SRandall Stewart 			xstcb.State = SCTP_GET_STATE(&stcb->asoc);	/* FIXME */
23342551e99SRandall Stewart 			xstcb.InStreams = stcb->asoc.streamincnt;
23442551e99SRandall Stewart 			xstcb.OutStreams = stcb->asoc.streamoutcnt;
23542551e99SRandall Stewart 			xstcb.MaxRetr = stcb->asoc.overall_error_count;
23642551e99SRandall Stewart 			xstcb.PrimProcess = 0;	/* not really supported yet */
23742551e99SRandall Stewart 			xstcb.T1expireds = stcb->asoc.timoinit + stcb->asoc.timocookie;
23842551e99SRandall Stewart 			xstcb.T2expireds = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack;
23942551e99SRandall Stewart 			xstcb.RtxChunks = stcb->asoc.marked_retrans;
24042551e99SRandall Stewart 			xstcb.StartTime = stcb->asoc.start_time;
24142551e99SRandall Stewart 			xstcb.DiscontinuityTime = stcb->asoc.discontinuity_time;
24242551e99SRandall Stewart 
24342551e99SRandall Stewart 			xstcb.number_local_addresses = number_of_local_addresses;
24442551e99SRandall Stewart 			xstcb.number_remote_addresses = number_of_remote_addresses;
24542551e99SRandall Stewart 			xstcb.total_sends = stcb->total_sends;
24642551e99SRandall Stewart 			xstcb.total_recvs = stcb->total_recvs;
24742551e99SRandall Stewart 			xstcb.local_tag = stcb->asoc.my_vtag;
24842551e99SRandall Stewart 			xstcb.remote_tag = stcb->asoc.peer_vtag;
24942551e99SRandall Stewart 			xstcb.initial_tsn = stcb->asoc.init_seq_number;
25042551e99SRandall Stewart 			xstcb.highest_tsn = stcb->asoc.sending_seq - 1;
25142551e99SRandall Stewart 			xstcb.cumulative_tsn = stcb->asoc.last_acked_seq;
25242551e99SRandall Stewart 			xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn;
25317205eccSRandall Stewart 			xstcb.mtu = stcb->asoc.smallest_mtu;
25442551e99SRandall Stewart 			SCTP_INP_RUNLOCK(inp);
25542551e99SRandall Stewart 			SCTP_INP_INFO_RUNLOCK();
25642551e99SRandall Stewart 			error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb));
25742551e99SRandall Stewart 			if (error) {
25842551e99SRandall Stewart 				atomic_add_int(&stcb->asoc.refcnt, -1);
25942551e99SRandall Stewart 				return error;
26042551e99SRandall Stewart 			}
26142551e99SRandall Stewart 			TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
26242551e99SRandall Stewart 				xraddr.RemAddr = net->ro._l_addr;
26342551e99SRandall Stewart 				xraddr.RemAddrActive = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE);
26442551e99SRandall Stewart 				xraddr.RemAddrConfirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0);
26542551e99SRandall Stewart 				xraddr.RemAddrHBActive = ((net->dest_state & SCTP_ADDR_NOHB) == 0);
26642551e99SRandall Stewart 				xraddr.RemAddrRTO = net->RTO;
26742551e99SRandall Stewart 				xraddr.RemAddrMaxPathRtx = net->failure_threshold;
26842551e99SRandall Stewart 				xraddr.RemAddrRtx = net->marked_retrans;
26942551e99SRandall Stewart 				xraddr.RemAddrErrorCounter = net->error_count;
27042551e99SRandall Stewart 				xraddr.RemAddrCwnd = net->cwnd;
27142551e99SRandall Stewart 				xraddr.RemAddrFlightSize = net->flight_size;
27242551e99SRandall Stewart 				xraddr.RemAddrStartTime = net->start_time;
27317205eccSRandall Stewart 				xraddr.RemAddrMTU = net->mtu;
27442551e99SRandall Stewart 				error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
27542551e99SRandall Stewart 				if (error) {
27642551e99SRandall Stewart 					atomic_add_int(&stcb->asoc.refcnt, -1);
27742551e99SRandall Stewart 					return error;
27842551e99SRandall Stewart 				}
27942551e99SRandall Stewart 			}
28042551e99SRandall Stewart 			atomic_add_int(&stcb->asoc.refcnt, -1);
28142551e99SRandall Stewart 			SCTP_INP_INFO_RLOCK();
28242551e99SRandall Stewart 			SCTP_INP_RLOCK(inp);
28342551e99SRandall Stewart 		}
28442551e99SRandall Stewart 		SCTP_INP_DECR_REF(inp);
28542551e99SRandall Stewart 		SCTP_INP_RUNLOCK(inp);
28642551e99SRandall Stewart 	}
28742551e99SRandall Stewart 	SCTP_INP_INFO_RUNLOCK();
28842551e99SRandall Stewart 
28942551e99SRandall Stewart 	xinpcb.last = 1;
29042551e99SRandall Stewart 	xinpcb.local_port = 0;
29142551e99SRandall Stewart 	xinpcb.number_local_addresses = 0;
29242551e99SRandall Stewart 	xinpcb.number_associations = 0;
29342551e99SRandall Stewart 	xinpcb.flags = 0;
29442551e99SRandall Stewart 	xinpcb.features = 0;
29542551e99SRandall Stewart 	error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb));
29642551e99SRandall Stewart 	return error;
29742551e99SRandall Stewart }
29842551e99SRandall Stewart 
29942551e99SRandall Stewart 
30042551e99SRandall Stewart /*
30142551e99SRandall Stewart  * sysctl definitions
30242551e99SRandall Stewart  */
30342551e99SRandall Stewart 
30442551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, sendspace, CTLFLAG_RW,
30542551e99SRandall Stewart     &sctp_sendspace, 0, "Maximum outgoing SCTP buffer size");
30642551e99SRandall Stewart 
30742551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, recvspace, CTLFLAG_RW,
30842551e99SRandall Stewart     &sctp_recvspace, 0, "Maximum incoming SCTP buffer size");
30942551e99SRandall Stewart 
31042551e99SRandall Stewart #if defined(__FreeBSD__) || defined(SCTP_APPLE_AUTO_ASCONF)
31142551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, auto_asconf, CTLFLAG_RW,
31242551e99SRandall Stewart     &sctp_auto_asconf, 0, "Enable SCTP Auto-ASCONF");
31342551e99SRandall Stewart #endif
31442551e99SRandall Stewart 
31542551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, ecn_enable, CTLFLAG_RW,
31642551e99SRandall Stewart     &sctp_ecn_enable, 0, "Enable SCTP ECN");
31742551e99SRandall Stewart 
31842551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, ecn_nonce, CTLFLAG_RW,
31942551e99SRandall Stewart     &sctp_ecn_nonce, 0, "Enable SCTP ECN Nonce");
32042551e99SRandall Stewart 
32142551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, strict_sacks, CTLFLAG_RW,
32242551e99SRandall Stewart     &sctp_strict_sacks, 0, "Enable SCTP Strict SACK checking");
32342551e99SRandall Stewart 
32442551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLFLAG_RW,
32542551e99SRandall Stewart     &sctp_no_csum_on_loopback, 0,
32642551e99SRandall Stewart     "Enable NO Csum on packets sent on loopback");
32742551e99SRandall Stewart 
32842551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, strict_init, CTLFLAG_RW,
32942551e99SRandall Stewart     &sctp_strict_init, 0,
33042551e99SRandall Stewart     "Enable strict INIT/INIT-ACK singleton enforcement");
33142551e99SRandall Stewart 
33242551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLFLAG_RW,
33342551e99SRandall Stewart     &sctp_peer_chunk_oh, 0,
33442551e99SRandall Stewart     "Amount to debit peers rwnd per chunk sent");
33542551e99SRandall Stewart 
33642551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, maxburst, CTLFLAG_RW,
33742551e99SRandall Stewart     &sctp_max_burst_default, 0,
33842551e99SRandall Stewart     "Default max burst for sctp endpoints");
33942551e99SRandall Stewart 
34042551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, maxchunks, CTLFLAG_RW,
34142551e99SRandall Stewart     &sctp_max_chunks_on_queue, 0,
34242551e99SRandall Stewart     "Default max chunks on queue per asoc");
34342551e99SRandall Stewart 
34442551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, tcbhashsize, CTLFLAG_RW,
34542551e99SRandall Stewart     &sctp_hashtblsize, 0,
34642551e99SRandall Stewart     "Tuneable for Hash table sizes");
34742551e99SRandall Stewart 
34842551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, min_split_point, CTLFLAG_RW,
34942551e99SRandall Stewart     &sctp_min_split_point, 0,
35042551e99SRandall Stewart     "Minimum size when splitting a chunk");
35142551e99SRandall Stewart 
35242551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, pcbhashsize, CTLFLAG_RW,
35342551e99SRandall Stewart     &sctp_pcbtblsize, 0,
35442551e99SRandall Stewart     "Tuneable for PCB Hash table sizes");
35542551e99SRandall Stewart 
35642551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, sys_resource, CTLFLAG_RW,
35742551e99SRandall Stewart     &sctp_system_free_resc_limit, 0,
35842551e99SRandall Stewart     "Max number of cached resources in the system");
35942551e99SRandall Stewart 
36042551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, asoc_resource, CTLFLAG_RW,
36142551e99SRandall Stewart     &sctp_asoc_free_resc_limit, 0,
36242551e99SRandall Stewart     "Max number of cached resources in an asoc");
36342551e99SRandall Stewart 
36442551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, chunkscale, CTLFLAG_RW,
36542551e99SRandall Stewart     &sctp_chunkscale, 0,
36642551e99SRandall Stewart     "Tuneable for Scaling of number of chunks and messages");
36742551e99SRandall Stewart 
36842551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, delayed_sack_time, CTLFLAG_RW,
36942551e99SRandall Stewart     &sctp_delayed_sack_time_default, 0,
37042551e99SRandall Stewart     "Default delayed SACK timer in msec");
37142551e99SRandall Stewart 
37242551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, sack_freq, CTLFLAG_RW,
37342551e99SRandall Stewart     &sctp_sack_freq_default, 0,
37442551e99SRandall Stewart     "Default SACK frequency");
37542551e99SRandall Stewart 
37642551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, heartbeat_interval, CTLFLAG_RW,
37742551e99SRandall Stewart     &sctp_heartbeat_interval_default, 0,
37842551e99SRandall Stewart     "Default heartbeat interval in msec");
37942551e99SRandall Stewart 
38042551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, pmtu_raise_time, CTLFLAG_RW,
38142551e99SRandall Stewart     &sctp_pmtu_raise_time_default, 0,
38242551e99SRandall Stewart     "Default PMTU raise timer in sec");
38342551e99SRandall Stewart 
38442551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, shutdown_guard_time, CTLFLAG_RW,
38542551e99SRandall Stewart     &sctp_shutdown_guard_time_default, 0,
38642551e99SRandall Stewart     "Default shutdown guard timer in sec");
38742551e99SRandall Stewart 
38842551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, secret_lifetime, CTLFLAG_RW,
38942551e99SRandall Stewart     &sctp_secret_lifetime_default, 0,
39042551e99SRandall Stewart     "Default secret lifetime in sec");
39142551e99SRandall Stewart 
39242551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, rto_max, CTLFLAG_RW,
39342551e99SRandall Stewart     &sctp_rto_max_default, 0,
39442551e99SRandall Stewart     "Default maximum retransmission timeout in msec");
39542551e99SRandall Stewart 
39642551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, rto_min, CTLFLAG_RW,
39742551e99SRandall Stewart     &sctp_rto_min_default, 0,
39842551e99SRandall Stewart     "Default minimum retransmission timeout in msec");
39942551e99SRandall Stewart 
40042551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, rto_initial, CTLFLAG_RW,
40142551e99SRandall Stewart     &sctp_rto_initial_default, 0,
40242551e99SRandall Stewart     "Default initial retransmission timeout in msec");
40342551e99SRandall Stewart 
40442551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, init_rto_max, CTLFLAG_RW,
40542551e99SRandall Stewart     &sctp_init_rto_max_default, 0,
40642551e99SRandall Stewart     "Default maximum retransmission timeout during association setup in msec");
40742551e99SRandall Stewart 
40842551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, valid_cookie_life, CTLFLAG_RW,
40942551e99SRandall Stewart     &sctp_valid_cookie_life_default, 0,
41042551e99SRandall Stewart     "Default cookie lifetime in sec");
41142551e99SRandall Stewart 
41242551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, init_rtx_max, CTLFLAG_RW,
41342551e99SRandall Stewart     &sctp_init_rtx_max_default, 0,
41442551e99SRandall Stewart     "Default maximum number of retransmission for INIT chunks");
41542551e99SRandall Stewart 
41642551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, assoc_rtx_max, CTLFLAG_RW,
41742551e99SRandall Stewart     &sctp_assoc_rtx_max_default, 0,
41842551e99SRandall Stewart     "Default maximum number of retransmissions per association");
41942551e99SRandall Stewart 
42042551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, path_rtx_max, CTLFLAG_RW,
42142551e99SRandall Stewart     &sctp_path_rtx_max_default, 0,
42242551e99SRandall Stewart     "Default maximum of retransmissions per path");
42342551e99SRandall Stewart 
42442551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, add_more_on_output, CTLFLAG_RW,
42542551e99SRandall Stewart     &sctp_add_more_threshold, 0,
42642551e99SRandall Stewart     "When space wise is it worthwhile to try to add more to a socket send buffer");
42742551e99SRandall Stewart 
42842551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLFLAG_RW,
42942551e99SRandall Stewart     &sctp_nr_outgoing_streams_default, 0,
43042551e99SRandall Stewart     "Default number of outgoing streams");
43142551e99SRandall Stewart 
43242551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLFLAG_RW,
43342551e99SRandall Stewart     &sctp_cmt_on_off, 0,
43442551e99SRandall Stewart     "CMT ON/OFF flag");
43542551e99SRandall Stewart 
43642551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, cwnd_maxburst, CTLFLAG_RW,
43742551e99SRandall Stewart     &sctp_use_cwnd_based_maxburst, 0,
43842551e99SRandall Stewart     "Use a CWND adjusting maxburst");
43942551e99SRandall Stewart 
44042551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, early_fast_retran, CTLFLAG_RW,
44142551e99SRandall Stewart     &sctp_early_fr, 0,
44242551e99SRandall Stewart     "Early Fast Retransmit with timer");
44342551e99SRandall Stewart 
44442551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, deadlock_detect, CTLFLAG_RW,
44542551e99SRandall Stewart     &sctp_says_check_for_deadlock, 0,
44642551e99SRandall Stewart     "SMP Deadlock detection on/off");
44742551e99SRandall Stewart 
44842551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, early_fast_retran_msec, CTLFLAG_RW,
44942551e99SRandall Stewart     &sctp_early_fr_msec, 0,
45042551e99SRandall Stewart     "Early Fast Retransmit minimum timer value");
45142551e99SRandall Stewart 
45242551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLFLAG_RW,
45342551e99SRandall Stewart     &sctp_asconf_auth_nochk, 0,
45442551e99SRandall Stewart     "Disable SCTP ASCONF AUTH requirement");
45542551e99SRandall Stewart 
45642551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, auth_disable, CTLFLAG_RW,
45742551e99SRandall Stewart     &sctp_auth_disable, 0,
45842551e99SRandall Stewart     "Disable SCTP AUTH function");
45942551e99SRandall Stewart 
46042551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, nat_friendly, CTLFLAG_RW,
46142551e99SRandall Stewart     &sctp_nat_friendly, 0,
46242551e99SRandall Stewart     "SCTP NAT friendly operation");
46342551e99SRandall Stewart 
46442551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, abc_l_var, CTLFLAG_RW,
46542551e99SRandall Stewart     &sctp_L2_abc_variable, 0,
46642551e99SRandall Stewart     "SCTP ABC max increase per SACK (L)");
46742551e99SRandall Stewart 
46842551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, max_chained_mbufs, CTLFLAG_RW,
46942551e99SRandall Stewart     &sctp_mbuf_threshold_count, 0,
47042551e99SRandall Stewart     "Default max number of small mbufs on a chain");
47142551e99SRandall Stewart 
47242551e99SRandall Stewart SYSCTL_UINT(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLFLAG_RW,
47342551e99SRandall Stewart     &sctp_cmt_use_dac, 0,
47442551e99SRandall Stewart     "CMT DAC ON/OFF flag");
47542551e99SRandall Stewart 
47642551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, do_sctp_drain, CTLFLAG_RW,
47742551e99SRandall Stewart     &sctp_do_drain, 0,
47842551e99SRandall Stewart     "Should SCTP respond to the drain calls");
47942551e99SRandall Stewart 
48042551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, hb_max_burst, CTLFLAG_RW,
48142551e99SRandall Stewart     &sctp_hb_maxburst, 0,
48242551e99SRandall Stewart     "Confirmation Heartbeat max burst?");
48342551e99SRandall Stewart 
48442551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, abort_at_limit, CTLFLAG_RW,
48542551e99SRandall Stewart     &sctp_abort_if_one_2_one_hits_limit, 0,
48642551e99SRandall Stewart     "When one-2-one hits qlimit abort");
48742551e99SRandall Stewart 
48842551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, strict_data_order, CTLFLAG_RW,
48942551e99SRandall Stewart     &sctp_strict_data_order, 0,
49042551e99SRandall Stewart     "Enforce strict data ordering, abort if control inside data");
49142551e99SRandall Stewart 
49242551e99SRandall Stewart SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW,
49342551e99SRandall Stewart     &sctpstat, sctpstat,
49442551e99SRandall Stewart     "SCTP statistics (struct sctps_stat, netinet/sctp.h");
49542551e99SRandall Stewart 
49642551e99SRandall Stewart SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD,
49742551e99SRandall Stewart     0, 0, sctp_assoclist,
49842551e99SRandall Stewart     "S,xassoc", "List of active SCTP associations");
49942551e99SRandall Stewart 
500bff64a4dSRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, min_residual, CTLFLAG_RW,
501bff64a4dSRandall Stewart     &sctp_min_residual, 0,
502bff64a4dSRandall Stewart     SCTPCTL_MIN_RESIDUAL_DESC);
503bff64a4dSRandall Stewart 
504bff64a4dSRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLFLAG_RW,
505bff64a4dSRandall Stewart     &sctp_max_retran_chunk, 0,
506bff64a4dSRandall Stewart     SCTPCTL_MAX_RETRAN_CHUNK_DESC);
507bff64a4dSRandall Stewart 
50842551e99SRandall Stewart #ifdef SCTP_DEBUG
50942551e99SRandall Stewart SYSCTL_INT(_net_inet_sctp, OID_AUTO, debug, CTLFLAG_RW,
51042551e99SRandall Stewart     &sctp_debug_on, 0, "Configure debug output");
51142551e99SRandall Stewart #endif				/* SCTP_DEBUG */
512