xref: /openbmc/linux/include/net/netns/sctp.h (revision d1e462a7a5f359cbb9a0e8fbfafcfb6657034105)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
24db67e80SEric W. Biederman #ifndef __NETNS_SCTP_H__
34db67e80SEric W. Biederman #define __NETNS_SCTP_H__
44db67e80SEric W. Biederman 
52ce95503SEric W. Biederman struct sock;
613d782f6SEric W. Biederman struct proc_dir_entry;
7b01a2407SEric W. Biederman struct sctp_mib;
8ebb7e95dSEric W. Biederman struct ctl_table_header;
92ce95503SEric W. Biederman 
104db67e80SEric W. Biederman struct netns_sctp {
11b01a2407SEric W. Biederman 	DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics);
12b01a2407SEric W. Biederman 
1313d782f6SEric W. Biederman #ifdef CONFIG_PROC_FS
1413d782f6SEric W. Biederman 	struct proc_dir_entry *proc_net_sctp;
1513d782f6SEric W. Biederman #endif
16ebb7e95dSEric W. Biederman #ifdef CONFIG_SYSCTL
17ebb7e95dSEric W. Biederman 	struct ctl_table_header *sysctl_header;
18ebb7e95dSEric W. Biederman #endif
192ce95503SEric W. Biederman 	/* This is the global socket data structure used for responding to
202ce95503SEric W. Biederman 	 * the Out-of-the-blue (OOTB) packets.  A control sock will be created
212ce95503SEric W. Biederman 	 * for this socket at the initialization time.
222ce95503SEric W. Biederman 	 */
232ce95503SEric W. Biederman 	struct sock *ctl_sock;
242ce95503SEric W. Biederman 
25965ae444SXin Long 	/* UDP tunneling listening sock. */
26965ae444SXin Long 	struct sock *udp4_sock;
279d6ba260SXin Long 	struct sock *udp6_sock;
28965ae444SXin Long 	/* UDP tunneling listening port. */
29965ae444SXin Long 	int udp_port;
30e8a3001cSXin Long 	/* UDP tunneling remote encap port. */
31e8a3001cSXin Long 	int encap_port;
32965ae444SXin Long 
334db67e80SEric W. Biederman 	/* This is the global local address list.
344db67e80SEric W. Biederman 	 * We actively maintain this complete list of addresses on
354db67e80SEric W. Biederman 	 * the system by catching address add/delete events.
364db67e80SEric W. Biederman 	 *
374db67e80SEric W. Biederman 	 * It is a list of sctp_sockaddr_entry.
384db67e80SEric W. Biederman 	 */
394db67e80SEric W. Biederman 	struct list_head local_addr_list;
404db67e80SEric W. Biederman 	struct list_head addr_waitq;
414db67e80SEric W. Biederman 	struct timer_list addr_wq_timer;
424db67e80SEric W. Biederman 	struct list_head auto_asconf_splist;
432d45a02dSMarcelo Ricardo Leitner 	/* Lock that protects both addr_waitq and auto_asconf_splist */
444db67e80SEric W. Biederman 	spinlock_t addr_wq_lock;
454db67e80SEric W. Biederman 
464db67e80SEric W. Biederman 	/* Lock that protects the local_addr_list writers */
474db67e80SEric W. Biederman 	spinlock_t local_addr_lock;
48ebb7e95dSEric W. Biederman 
49e1fc3b14SEric W. Biederman 	/* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values
50e1fc3b14SEric W. Biederman 	 *
51e1fc3b14SEric W. Biederman 	 * The following protocol parameters are RECOMMENDED:
52e1fc3b14SEric W. Biederman 	 *
53e1fc3b14SEric W. Biederman 	 * RTO.Initial		    - 3	 seconds
54e1fc3b14SEric W. Biederman 	 * RTO.Min		    - 1	 second
55e1fc3b14SEric W. Biederman 	 * RTO.Max		   -  60 seconds
56e1fc3b14SEric W. Biederman 	 * RTO.Alpha		    - 1/8  (3 when converted to right shifts.)
57e1fc3b14SEric W. Biederman 	 * RTO.Beta		    - 1/4  (2 when converted to right shifts.)
58e1fc3b14SEric W. Biederman 	 */
59e1fc3b14SEric W. Biederman 	unsigned int rto_initial;
60e1fc3b14SEric W. Biederman 	unsigned int rto_min;
61e1fc3b14SEric W. Biederman 	unsigned int rto_max;
62e1fc3b14SEric W. Biederman 
63e1fc3b14SEric W. Biederman 	/* Note: rto_alpha and rto_beta are really defined as inverse
64e1fc3b14SEric W. Biederman 	 * powers of two to facilitate integer operations.
65e1fc3b14SEric W. Biederman 	 */
66e1fc3b14SEric W. Biederman 	int rto_alpha;
67e1fc3b14SEric W. Biederman 	int rto_beta;
68e1fc3b14SEric W. Biederman 
69e1fc3b14SEric W. Biederman 	/* Max.Burst		    - 4 */
70e1fc3b14SEric W. Biederman 	int max_burst;
71e1fc3b14SEric W. Biederman 
72e1fc3b14SEric W. Biederman 	/* Whether Cookie Preservative is enabled(1) or not(0) */
73e1fc3b14SEric W. Biederman 	int cookie_preserve_enable;
74e1fc3b14SEric W. Biederman 
753c68198eSNeil Horman 	/* The namespace default hmac alg */
763c68198eSNeil Horman 	char *sctp_hmac_alg;
773c68198eSNeil Horman 
78e1fc3b14SEric W. Biederman 	/* Valid.Cookie.Life	    - 60  seconds  */
79e1fc3b14SEric W. Biederman 	unsigned int valid_cookie_life;
80e1fc3b14SEric W. Biederman 
81e1fc3b14SEric W. Biederman 	/* Delayed SACK timeout  200ms default*/
82e1fc3b14SEric W. Biederman 	unsigned int sack_timeout;
83e1fc3b14SEric W. Biederman 
84e1fc3b14SEric W. Biederman 	/* HB.interval		    - 30 seconds  */
85e1fc3b14SEric W. Biederman 	unsigned int hb_interval;
86e1fc3b14SEric W. Biederman 
87*d1e462a7SXin Long 	/* The interval for PLPMTUD probe timer */
88*d1e462a7SXin Long 	unsigned int probe_interval;
89*d1e462a7SXin Long 
90e1fc3b14SEric W. Biederman 	/* Association.Max.Retrans  - 10 attempts
91e1fc3b14SEric W. Biederman 	 * Path.Max.Retrans	    - 5	 attempts (per destination address)
92e1fc3b14SEric W. Biederman 	 * Max.Init.Retransmits	    - 8	 attempts
93e1fc3b14SEric W. Biederman 	 */
94e1fc3b14SEric W. Biederman 	int max_retrans_association;
95e1fc3b14SEric W. Biederman 	int max_retrans_path;
96e1fc3b14SEric W. Biederman 	int max_retrans_init;
97e1fc3b14SEric W. Biederman 	/* Potentially-Failed.Max.Retrans sysctl value
98e1fc3b14SEric W. Biederman 	 * taken from:
99e1fc3b14SEric W. Biederman 	 * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05
100e1fc3b14SEric W. Biederman 	 */
101e1fc3b14SEric W. Biederman 	int pf_retrans;
102e1fc3b14SEric W. Biederman 
10334515e94SXin Long 	/* Primary.Switchover.Max.Retrans sysctl value
10434515e94SXin Long 	 * taken from:
10534515e94SXin Long 	 * https://tools.ietf.org/html/rfc7829
10634515e94SXin Long 	 */
10734515e94SXin Long 	int ps_retrans;
10834515e94SXin Long 
109e1fc3b14SEric W. Biederman 	/*
110566178f8SZhu Yanjun 	 * Disable Potentially-Failed feature, the feature is enabled by default
111566178f8SZhu Yanjun 	 * pf_enable	-  0  : disable pf
112566178f8SZhu Yanjun 	 *		- >0  : enable pf
113566178f8SZhu Yanjun 	 */
114566178f8SZhu Yanjun 	int pf_enable;
115566178f8SZhu Yanjun 
116566178f8SZhu Yanjun 	/*
117aef587beSXin Long 	 * Disable Potentially-Failed state exposure, ignored by default
118aef587beSXin Long 	 * pf_expose	-  0  : compatible with old applications (by default)
119aef587beSXin Long 	 *		-  1  : disable pf state exposure
120aef587beSXin Long 	 *		-  2  : enable  pf state exposure
121aef587beSXin Long 	 */
122aef587beSXin Long 	int pf_expose;
123aef587beSXin Long 
124aef587beSXin Long 	/*
125e1fc3b14SEric W. Biederman 	 * Policy for preforming sctp/socket accounting
126e1fc3b14SEric W. Biederman 	 * 0   - do socket level accounting, all assocs share sk_sndbuf
127e1fc3b14SEric W. Biederman 	 * 1   - do sctp accounting, each asoc may use sk_sndbuf bytes
128e1fc3b14SEric W. Biederman 	 */
129e1fc3b14SEric W. Biederman 	int sndbuf_policy;
130e1fc3b14SEric W. Biederman 
131e1fc3b14SEric W. Biederman 	/*
132e1fc3b14SEric W. Biederman 	 * Policy for preforming sctp/socket accounting
133e1fc3b14SEric W. Biederman 	 * 0   - do socket level accounting, all assocs share sk_rcvbuf
134e1fc3b14SEric W. Biederman 	 * 1   - do sctp accounting, each asoc may use sk_rcvbuf bytes
135e1fc3b14SEric W. Biederman 	 */
136e1fc3b14SEric W. Biederman 	int rcvbuf_policy;
137e1fc3b14SEric W. Biederman 
138e1fc3b14SEric W. Biederman 	int default_auto_asconf;
139e1fc3b14SEric W. Biederman 
140e1fc3b14SEric W. Biederman 	/* Flag to indicate if addip is enabled. */
141e1fc3b14SEric W. Biederman 	int addip_enable;
142e1fc3b14SEric W. Biederman 	int addip_noauth;
143e1fc3b14SEric W. Biederman 
144e1fc3b14SEric W. Biederman 	/* Flag to indicate if PR-SCTP is enabled. */
145e1fc3b14SEric W. Biederman 	int prsctp_enable;
146e1fc3b14SEric W. Biederman 
147c28445c3SXin Long 	/* Flag to indicate if PR-CONFIG is enabled. */
148c28445c3SXin Long 	int reconf_enable;
149c28445c3SXin Long 
150772a5869SXin Long 	/* Flag to indicate if SCTP-AUTH is enabled */
151e1fc3b14SEric W. Biederman 	int auth_enable;
152e1fc3b14SEric W. Biederman 
153772a5869SXin Long 	/* Flag to indicate if stream interleave is enabled */
154772a5869SXin Long 	int intl_enable;
155772a5869SXin Long 
1561b0b8114SXin Long 	/* Flag to indicate if ecn is enabled */
1571b0b8114SXin Long 	int ecn_enable;
1581b0b8114SXin Long 
159e1fc3b14SEric W. Biederman 	/*
160e1fc3b14SEric W. Biederman 	 * Policy to control SCTP IPv4 address scoping
161e1fc3b14SEric W. Biederman 	 * 0   - Disable IPv4 address scoping
162e1fc3b14SEric W. Biederman 	 * 1   - Enable IPv4 address scoping
163e1fc3b14SEric W. Biederman 	 * 2   - Selectively allow only IPv4 private addresses
164e1fc3b14SEric W. Biederman 	 * 3   - Selectively allow only IPv4 link local address
165e1fc3b14SEric W. Biederman 	 */
166e1fc3b14SEric W. Biederman 	int scope_policy;
167e1fc3b14SEric W. Biederman 
168e1fc3b14SEric W. Biederman 	/* Threshold for rwnd update SACKS.  Receive buffer shifted this many
169e1fc3b14SEric W. Biederman 	 * bits is an indicator of when to send and window update SACK.
170e1fc3b14SEric W. Biederman 	 */
171e1fc3b14SEric W. Biederman 	int rwnd_upd_shift;
172e1fc3b14SEric W. Biederman 
173e1fc3b14SEric W. Biederman 	/* Threshold for autoclose timeout, in seconds. */
174e1fc3b14SEric W. Biederman 	unsigned long max_autoclose;
1754db67e80SEric W. Biederman };
1764db67e80SEric W. Biederman 
1774db67e80SEric W. Biederman #endif /* __NETNS_SCTP_H__ */
178