blob: ae03ded2bf1a4a2a10342a2e1bd5ae2c8210eff8 [file] [log] [blame]
Vlad Yasevich60c778b2008-01-11 09:57:09 -05001/* SCTP kernel implementation
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * (C) Copyright IBM Corp. 2002, 2004
3 * Copyright (c) 2002 Intel Corp.
4 *
Vlad Yasevich60c778b2008-01-11 09:57:09 -05005 * This file is part of the SCTP kernel implementation
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
7 * Sysctl related interfaces for SCTP.
8 *
Vlad Yasevich60c778b2008-01-11 09:57:09 -05009 * This SCTP implementation is free software;
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 * you can redistribute it and/or modify it under the terms of
11 * the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version.
14 *
Vlad Yasevich60c778b2008-01-11 09:57:09 -050015 * This SCTP implementation is distributed in the hope that it
Linus Torvalds1da177e2005-04-16 15:20:36 -070016 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
17 * ************************
18 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 * See the GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with GNU CC; see the file COPYING. If not, write to
23 * the Free Software Foundation, 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
25 *
26 * Please send any bug reports or fixes you make to the
27 * email address(es):
28 * lksctp developers <lksctp-developers@lists.sourceforge.net>
29 *
30 * Or submit a bug report through the following website:
31 * http://www.sf.net/projects/lksctp
32 *
33 * Written or modified by:
34 * Mingqin Liu <liuming@us.ibm.com>
35 * Jon Grimm <jgrimm@us.ibm.com>
36 * Ardelle Fan <ardelle.fan@intel.com>
37 * Ryan Layer <rmlayer@us.ibm.com>
38 * Sridhar Samudrala <sri@us.ibm.com>
39 *
40 * Any bugs reported given to us we will try to fix... any fixes shared will
41 * be incorporated into the next SCTP release.
42 */
43
44#include <net/sctp/structs.h>
Adrian Bunk8c5955d2005-09-05 18:07:42 -070045#include <net/sctp/sctp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include <linux/sysctl.h>
47
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070048static int zero = 0;
49static int one = 1;
50static int timer_max = 86400000; /* ms in one day */
51static int int_max = INT_MAX;
Jean-Mickael Guerind48e0742009-05-13 00:03:20 +020052static int sack_timer_min = 1;
53static int sack_timer_max = 500;
Bhaskar Dutta72388432009-09-03 17:25:47 +053054static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
Vlad Yasevich90f2f532009-11-23 15:53:57 -050055static int rwnd_scale_max = 16;
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Vlad Yasevich007e3932007-09-16 16:04:37 -070057extern int sysctl_sctp_mem[3];
58extern int sysctl_sctp_rmem[3];
59extern int sysctl_sctp_wmem[3];
Neil Horman4d93df02007-08-15 16:07:44 -070060
Linus Torvalds1da177e2005-04-16 15:20:36 -070061static ctl_table sctp_table[] = {
62 {
63 .ctl_name = NET_SCTP_RTO_INITIAL,
64 .procname = "rto_initial",
65 .data = &sctp_rto_initial,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070066 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080068 .proc_handler = proc_dointvec_minmax,
69 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070070 .extra1 = &one,
71 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 },
73 {
74 .ctl_name = NET_SCTP_RTO_MIN,
75 .procname = "rto_min",
76 .data = &sctp_rto_min,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070077 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080079 .proc_handler = proc_dointvec_minmax,
80 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070081 .extra1 = &one,
82 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 },
84 {
85 .ctl_name = NET_SCTP_RTO_MAX,
86 .procname = "rto_max",
87 .data = &sctp_rto_max,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070088 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080090 .proc_handler = proc_dointvec_minmax,
91 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070092 .extra1 = &one,
93 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 },
95 {
96 .ctl_name = NET_SCTP_VALID_COOKIE_LIFE,
97 .procname = "valid_cookie_life",
98 .data = &sctp_valid_cookie_life,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070099 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800101 .proc_handler = proc_dointvec_minmax,
102 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700103 .extra1 = &one,
104 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 },
106 {
107 .ctl_name = NET_SCTP_MAX_BURST,
108 .procname = "max_burst",
109 .data = &sctp_max_burst,
110 .maxlen = sizeof(int),
111 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800112 .proc_handler = proc_dointvec_minmax,
113 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700114 .extra1 = &zero,
115 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 },
117 {
118 .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS,
119 .procname = "association_max_retrans",
120 .data = &sctp_max_retrans_association,
121 .maxlen = sizeof(int),
122 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800123 .proc_handler = proc_dointvec_minmax,
124 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700125 .extra1 = &one,
126 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127 },
128 {
Neil Horman4eb701d2005-04-28 12:02:04 -0700129 .ctl_name = NET_SCTP_SNDBUF_POLICY,
130 .procname = "sndbuf_policy",
131 .data = &sctp_sndbuf_policy,
132 .maxlen = sizeof(int),
133 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800134 .proc_handler = proc_dointvec,
135 .strategy = sysctl_intvec
Neil Horman4eb701d2005-04-28 12:02:04 -0700136 },
137 {
Neil Horman049b3ff2005-11-11 16:08:24 -0800138 .ctl_name = NET_SCTP_RCVBUF_POLICY,
139 .procname = "rcvbuf_policy",
140 .data = &sctp_rcvbuf_policy,
141 .maxlen = sizeof(int),
142 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800143 .proc_handler = proc_dointvec,
144 .strategy = sysctl_intvec
Neil Horman049b3ff2005-11-11 16:08:24 -0800145 },
146 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 .ctl_name = NET_SCTP_PATH_MAX_RETRANS,
148 .procname = "path_max_retrans",
149 .data = &sctp_max_retrans_path,
150 .maxlen = sizeof(int),
151 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800152 .proc_handler = proc_dointvec_minmax,
153 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700154 .extra1 = &one,
155 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 },
157 {
158 .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS,
159 .procname = "max_init_retransmits",
160 .data = &sctp_max_retrans_init,
161 .maxlen = sizeof(int),
162 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800163 .proc_handler = proc_dointvec_minmax,
164 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700165 .extra1 = &one,
166 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 },
168 {
169 .ctl_name = NET_SCTP_HB_INTERVAL,
170 .procname = "hb_interval",
171 .data = &sctp_hb_interval,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700172 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800174 .proc_handler = proc_dointvec_minmax,
175 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700176 .extra1 = &one,
177 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178 },
179 {
180 .ctl_name = NET_SCTP_PRESERVE_ENABLE,
181 .procname = "cookie_preserve_enable",
182 .data = &sctp_cookie_preserve_enable,
Vlad Yasevich8116ffa2006-01-17 11:55:17 -0800183 .maxlen = sizeof(int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800185 .proc_handler = proc_dointvec,
186 .strategy = sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 },
188 {
189 .ctl_name = NET_SCTP_RTO_ALPHA,
190 .procname = "rto_alpha_exp_divisor",
191 .data = &sctp_rto_alpha,
192 .maxlen = sizeof(int),
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700193 .mode = 0444,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800194 .proc_handler = proc_dointvec,
195 .strategy = sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196 },
197 {
198 .ctl_name = NET_SCTP_RTO_BETA,
199 .procname = "rto_beta_exp_divisor",
200 .data = &sctp_rto_beta,
201 .maxlen = sizeof(int),
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700202 .mode = 0444,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800203 .proc_handler = proc_dointvec,
204 .strategy = sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205 },
206 {
207 .ctl_name = NET_SCTP_ADDIP_ENABLE,
208 .procname = "addip_enable",
209 .data = &sctp_addip_enable,
210 .maxlen = sizeof(int),
211 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800212 .proc_handler = proc_dointvec,
213 .strategy = sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 },
215 {
216 .ctl_name = NET_SCTP_PRSCTP_ENABLE,
217 .procname = "prsctp_enable",
218 .data = &sctp_prsctp_enable,
219 .maxlen = sizeof(int),
220 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800221 .proc_handler = proc_dointvec,
222 .strategy = sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 },
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700224 {
225 .ctl_name = NET_SCTP_SACK_TIMEOUT,
226 .procname = "sack_timeout",
227 .data = &sctp_sack_timeout,
Jean-Mickael Guerind48e0742009-05-13 00:03:20 +0200228 .maxlen = sizeof(int),
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700229 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800230 .proc_handler = proc_dointvec_minmax,
231 .strategy = sysctl_intvec,
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700232 .extra1 = &sack_timer_min,
233 .extra2 = &sack_timer_max,
234 },
Neil Horman4d93df02007-08-15 16:07:44 -0700235 {
236 .ctl_name = CTL_UNNUMBERED,
237 .procname = "sctp_mem",
238 .data = &sysctl_sctp_mem,
239 .maxlen = sizeof(sysctl_sctp_mem),
240 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800241 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700242 },
243 {
244 .ctl_name = CTL_UNNUMBERED,
245 .procname = "sctp_rmem",
246 .data = &sysctl_sctp_rmem,
247 .maxlen = sizeof(sysctl_sctp_rmem),
248 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800249 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700250 },
251 {
252 .ctl_name = CTL_UNNUMBERED,
253 .procname = "sctp_wmem",
254 .data = &sysctl_sctp_wmem,
255 .maxlen = sizeof(sysctl_sctp_wmem),
256 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800257 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700258 },
Vlad Yasevicha29a5bd2007-09-16 19:31:35 -0700259 {
260 .ctl_name = CTL_UNNUMBERED,
261 .procname = "auth_enable",
262 .data = &sctp_auth_enable,
263 .maxlen = sizeof(int),
264 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800265 .proc_handler = proc_dointvec,
266 .strategy = sysctl_intvec
Vlad Yasevicha29a5bd2007-09-16 19:31:35 -0700267 },
Vlad Yasevich73d9c4f2007-10-24 17:24:26 -0400268 {
269 .ctl_name = CTL_UNNUMBERED,
270 .procname = "addip_noauth_enable",
271 .data = &sctp_addip_noauth,
272 .maxlen = sizeof(int),
273 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800274 .proc_handler = proc_dointvec,
275 .strategy = sysctl_intvec
Vlad Yasevich73d9c4f2007-10-24 17:24:26 -0400276 },
Bhaskar Dutta72388432009-09-03 17:25:47 +0530277 {
278 .ctl_name = CTL_UNNUMBERED,
279 .procname = "addr_scope_policy",
280 .data = &sctp_scope_policy,
281 .maxlen = sizeof(int),
282 .mode = 0644,
283 .proc_handler = &proc_dointvec_minmax,
284 .strategy = &sysctl_intvec,
285 .extra1 = &zero,
286 .extra2 = &addr_scope_max,
287 },
Vlad Yasevich90f2f532009-11-23 15:53:57 -0500288 {
289 .ctl_name = CTL_UNNUMBERED,
290 .procname = "rwnd_update_shift",
291 .data = &sctp_rwnd_upd_shift,
292 .maxlen = sizeof(int),
293 .mode = 0644,
294 .proc_handler = &proc_dointvec_minmax,
295 .strategy = &sysctl_intvec,
296 .extra1 = &one,
297 .extra2 = &rwnd_scale_max,
298 },
299
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300 { .ctl_name = 0 }
301};
302
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800303static struct ctl_path sctp_path[] = {
304 { .procname = "net", .ctl_name = CTL_NET, },
305 { .procname = "sctp", .ctl_name = NET_SCTP, },
306 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307};
308
309static struct ctl_table_header * sctp_sysctl_header;
310
311/* Sysctl registration. */
312void sctp_sysctl_register(void)
313{
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800314 sctp_sysctl_header = register_sysctl_paths(sctp_path, sctp_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315}
316
317/* Sysctl deregistration. */
318void sctp_sysctl_unregister(void)
319{
320 unregister_sysctl_table(sctp_sysctl_header);
321}