blob: bdc0f27b85140bedade19fe90de20ef203e5f996 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Eric W. Biederman4db67e82012-08-06 08:42:04 +00002#ifndef __NETNS_SCTP_H__
3#define __NETNS_SCTP_H__
4
Eric W. Biederman2ce95502012-08-06 08:43:06 +00005struct sock;
Eric W. Biederman13d782f2012-08-06 08:45:15 +00006struct proc_dir_entry;
Eric W. Biedermanb01a2402012-08-06 08:47:55 +00007struct sctp_mib;
Eric W. Biedermanebb7e952012-08-07 07:23:59 +00008struct ctl_table_header;
Eric W. Biederman2ce95502012-08-06 08:43:06 +00009
Eric W. Biederman4db67e82012-08-06 08:42:04 +000010struct netns_sctp {
Eric W. Biedermanb01a2402012-08-06 08:47:55 +000011 DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics);
12
Eric W. Biederman13d782f2012-08-06 08:45:15 +000013#ifdef CONFIG_PROC_FS
14 struct proc_dir_entry *proc_net_sctp;
15#endif
Eric W. Biedermanebb7e952012-08-07 07:23:59 +000016#ifdef CONFIG_SYSCTL
17 struct ctl_table_header *sysctl_header;
18#endif
Eric W. Biederman2ce95502012-08-06 08:43:06 +000019 /* This is the global socket data structure used for responding to
20 * the Out-of-the-blue (OOTB) packets. A control sock will be created
21 * for this socket at the initialization time.
22 */
23 struct sock *ctl_sock;
24
Eric W. Biederman4db67e82012-08-06 08:42:04 +000025 /* This is the global local address list.
26 * We actively maintain this complete list of addresses on
27 * the system by catching address add/delete events.
28 *
29 * It is a list of sctp_sockaddr_entry.
30 */
31 struct list_head local_addr_list;
32 struct list_head addr_waitq;
33 struct timer_list addr_wq_timer;
34 struct list_head auto_asconf_splist;
Marcelo Ricardo Leitner2d45a022015-06-12 10:16:41 -030035 /* Lock that protects both addr_waitq and auto_asconf_splist */
Eric W. Biederman4db67e82012-08-06 08:42:04 +000036 spinlock_t addr_wq_lock;
37
38 /* Lock that protects the local_addr_list writers */
39 spinlock_t local_addr_lock;
Eric W. Biedermanebb7e952012-08-07 07:23:59 +000040
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +000041 /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values
42 *
43 * The following protocol parameters are RECOMMENDED:
44 *
45 * RTO.Initial - 3 seconds
46 * RTO.Min - 1 second
47 * RTO.Max - 60 seconds
48 * RTO.Alpha - 1/8 (3 when converted to right shifts.)
49 * RTO.Beta - 1/4 (2 when converted to right shifts.)
50 */
51 unsigned int rto_initial;
52 unsigned int rto_min;
53 unsigned int rto_max;
54
55 /* Note: rto_alpha and rto_beta are really defined as inverse
56 * powers of two to facilitate integer operations.
57 */
58 int rto_alpha;
59 int rto_beta;
60
61 /* Max.Burst - 4 */
62 int max_burst;
63
64 /* Whether Cookie Preservative is enabled(1) or not(0) */
65 int cookie_preserve_enable;
66
Neil Horman3c681982012-10-24 09:20:03 +000067 /* The namespace default hmac alg */
68 char *sctp_hmac_alg;
69
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +000070 /* Valid.Cookie.Life - 60 seconds */
71 unsigned int valid_cookie_life;
72
73 /* Delayed SACK timeout 200ms default*/
74 unsigned int sack_timeout;
75
76 /* HB.interval - 30 seconds */
77 unsigned int hb_interval;
78
79 /* Association.Max.Retrans - 10 attempts
80 * Path.Max.Retrans - 5 attempts (per destination address)
81 * Max.Init.Retransmits - 8 attempts
82 */
83 int max_retrans_association;
84 int max_retrans_path;
85 int max_retrans_init;
86 /* Potentially-Failed.Max.Retrans sysctl value
87 * taken from:
88 * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05
89 */
90 int pf_retrans;
91
92 /*
Zhu Yanjun566178f2015-12-16 13:55:04 +080093 * Disable Potentially-Failed feature, the feature is enabled by default
94 * pf_enable - 0 : disable pf
95 * - >0 : enable pf
96 */
97 int pf_enable;
98
99 /*
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000100 * Policy for preforming sctp/socket accounting
101 * 0 - do socket level accounting, all assocs share sk_sndbuf
102 * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes
103 */
104 int sndbuf_policy;
105
106 /*
107 * Policy for preforming sctp/socket accounting
108 * 0 - do socket level accounting, all assocs share sk_rcvbuf
109 * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes
110 */
111 int rcvbuf_policy;
112
113 int default_auto_asconf;
114
115 /* Flag to indicate if addip is enabled. */
116 int addip_enable;
117 int addip_noauth;
118
119 /* Flag to indicate if PR-SCTP is enabled. */
120 int prsctp_enable;
121
Xin Longc28445c2017-01-18 00:44:45 +0800122 /* Flag to indicate if PR-CONFIG is enabled. */
123 int reconf_enable;
124
Xin Long772a5862017-12-08 21:03:58 +0800125 /* Flag to indicate if SCTP-AUTH is enabled */
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000126 int auth_enable;
127
Xin Long772a5862017-12-08 21:03:58 +0800128 /* Flag to indicate if stream interleave is enabled */
129 int intl_enable;
130
Xin Long1b0b8112019-08-26 16:30:02 +0800131 /* Flag to indicate if ecn is enabled */
132 int ecn_enable;
133
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000134 /*
135 * Policy to control SCTP IPv4 address scoping
136 * 0 - Disable IPv4 address scoping
137 * 1 - Enable IPv4 address scoping
138 * 2 - Selectively allow only IPv4 private addresses
139 * 3 - Selectively allow only IPv4 link local address
140 */
141 int scope_policy;
142
143 /* Threshold for rwnd update SACKS. Receive buffer shifted this many
144 * bits is an indicator of when to send and window update SACK.
145 */
146 int rwnd_upd_shift;
147
148 /* Threshold for autoclose timeout, in seconds. */
149 unsigned long max_autoclose;
Eric W. Biederman4db67e82012-08-06 08:42:04 +0000150};
151
152#endif /* __NETNS_SCTP_H__ */