blob: 832590bbe0c046ec83fcb58af7c98605fefec342 [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 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 .procname = "rto_initial",
64 .data = &sctp_rto_initial,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070065 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080067 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070068 .extra1 = &one,
69 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 },
71 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 .procname = "rto_min",
73 .data = &sctp_rto_min,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070074 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080076 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070077 .extra1 = &one,
78 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 },
80 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 .procname = "rto_max",
82 .data = &sctp_rto_max,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070083 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080085 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070086 .extra1 = &one,
87 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 },
89 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 .procname = "valid_cookie_life",
91 .data = &sctp_valid_cookie_life,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070092 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080094 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070095 .extra1 = &one,
96 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 },
98 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 .procname = "max_burst",
100 .data = &sctp_max_burst,
101 .maxlen = sizeof(int),
102 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800103 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700104 .extra1 = &zero,
105 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 },
107 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 .procname = "association_max_retrans",
109 .data = &sctp_max_retrans_association,
110 .maxlen = sizeof(int),
111 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800112 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700113 .extra1 = &one,
114 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 },
116 {
Neil Horman4eb701d2005-04-28 12:02:04 -0700117 .procname = "sndbuf_policy",
118 .data = &sctp_sndbuf_policy,
119 .maxlen = sizeof(int),
120 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800121 .proc_handler = proc_dointvec,
Neil Horman4eb701d2005-04-28 12:02:04 -0700122 },
123 {
Neil Horman049b3ff2005-11-11 16:08:24 -0800124 .procname = "rcvbuf_policy",
125 .data = &sctp_rcvbuf_policy,
126 .maxlen = sizeof(int),
127 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800128 .proc_handler = proc_dointvec,
Neil Horman049b3ff2005-11-11 16:08:24 -0800129 },
130 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 .procname = "path_max_retrans",
132 .data = &sctp_max_retrans_path,
133 .maxlen = sizeof(int),
134 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800135 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700136 .extra1 = &one,
137 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 },
139 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 .procname = "max_init_retransmits",
141 .data = &sctp_max_retrans_init,
142 .maxlen = sizeof(int),
143 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800144 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700145 .extra1 = &one,
146 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 },
148 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149 .procname = "hb_interval",
150 .data = &sctp_hb_interval,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700151 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800153 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700154 .extra1 = &one,
155 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 },
157 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 .procname = "cookie_preserve_enable",
159 .data = &sctp_cookie_preserve_enable,
Vlad Yasevich8116ffa2006-01-17 11:55:17 -0800160 .maxlen = sizeof(int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800162 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 },
164 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 .procname = "rto_alpha_exp_divisor",
166 .data = &sctp_rto_alpha,
167 .maxlen = sizeof(int),
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700168 .mode = 0444,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800169 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 },
171 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 .procname = "rto_beta_exp_divisor",
173 .data = &sctp_rto_beta,
174 .maxlen = sizeof(int),
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700175 .mode = 0444,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800176 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 },
178 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 .procname = "addip_enable",
180 .data = &sctp_addip_enable,
181 .maxlen = sizeof(int),
182 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800183 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 },
185 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 .procname = "prsctp_enable",
187 .data = &sctp_prsctp_enable,
188 .maxlen = sizeof(int),
189 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800190 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 },
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700192 {
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700193 .procname = "sack_timeout",
194 .data = &sctp_sack_timeout,
Jean-Mickael Guerind48e0742009-05-13 00:03:20 +0200195 .maxlen = sizeof(int),
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700196 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800197 .proc_handler = proc_dointvec_minmax,
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700198 .extra1 = &sack_timer_min,
199 .extra2 = &sack_timer_max,
200 },
Neil Horman4d93df02007-08-15 16:07:44 -0700201 {
Neil Horman4d93df02007-08-15 16:07:44 -0700202 .procname = "sctp_mem",
203 .data = &sysctl_sctp_mem,
204 .maxlen = sizeof(sysctl_sctp_mem),
205 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800206 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700207 },
208 {
Neil Horman4d93df02007-08-15 16:07:44 -0700209 .procname = "sctp_rmem",
210 .data = &sysctl_sctp_rmem,
211 .maxlen = sizeof(sysctl_sctp_rmem),
212 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800213 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700214 },
215 {
Neil Horman4d93df02007-08-15 16:07:44 -0700216 .procname = "sctp_wmem",
217 .data = &sysctl_sctp_wmem,
218 .maxlen = sizeof(sysctl_sctp_wmem),
219 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800220 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700221 },
Vlad Yasevicha29a5bd2007-09-16 19:31:35 -0700222 {
Vlad Yasevicha29a5bd2007-09-16 19:31:35 -0700223 .procname = "auth_enable",
224 .data = &sctp_auth_enable,
225 .maxlen = sizeof(int),
226 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800227 .proc_handler = proc_dointvec,
Vlad Yasevicha29a5bd2007-09-16 19:31:35 -0700228 },
Vlad Yasevich73d9c4f2007-10-24 17:24:26 -0400229 {
Vlad Yasevich73d9c4f2007-10-24 17:24:26 -0400230 .procname = "addip_noauth_enable",
231 .data = &sctp_addip_noauth,
232 .maxlen = sizeof(int),
233 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800234 .proc_handler = proc_dointvec,
Vlad Yasevich73d9c4f2007-10-24 17:24:26 -0400235 },
Bhaskar Dutta72388432009-09-03 17:25:47 +0530236 {
Bhaskar Dutta72388432009-09-03 17:25:47 +0530237 .procname = "addr_scope_policy",
238 .data = &sctp_scope_policy,
239 .maxlen = sizeof(int),
240 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800241 .proc_handler = proc_dointvec_minmax,
Bhaskar Dutta72388432009-09-03 17:25:47 +0530242 .extra1 = &zero,
243 .extra2 = &addr_scope_max,
244 },
Vlad Yasevich90f2f532009-11-23 15:53:57 -0500245 {
Vlad Yasevich90f2f532009-11-23 15:53:57 -0500246 .procname = "rwnd_update_shift",
247 .data = &sctp_rwnd_upd_shift,
248 .maxlen = sizeof(int),
249 .mode = 0644,
250 .proc_handler = &proc_dointvec_minmax,
Vlad Yasevich90f2f532009-11-23 15:53:57 -0500251 .extra1 = &one,
252 .extra2 = &rwnd_scale_max,
253 },
254
Linus Torvaldsd7fc02c2009-12-08 07:55:01 -0800255 { /* sentinel */ }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256};
257
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800258static struct ctl_path sctp_path[] = {
Eric W. Biedermanf8572d82009-11-05 13:32:03 -0800259 { .procname = "net", },
260 { .procname = "sctp", },
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800261 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262};
263
264static struct ctl_table_header * sctp_sysctl_header;
265
266/* Sysctl registration. */
267void sctp_sysctl_register(void)
268{
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800269 sctp_sysctl_header = register_sysctl_paths(sctp_path, sctp_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270}
271
272/* Sysctl deregistration. */
273void sctp_sysctl_unregister(void)
274{
275 unregister_sysctl_table(sctp_sysctl_header);
276}