blob: c4ece9829541d6bde5f1c1f39eeca84440cf5bcf [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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
Vlad Yasevich007e3932007-09-16 16:04:37 -070056extern int sysctl_sctp_mem[3];
57extern int sysctl_sctp_rmem[3];
58extern int sysctl_sctp_wmem[3];
Neil Horman4d93df02007-08-15 16:07:44 -070059
Linus Torvalds1da177e2005-04-16 15:20:36 -070060static ctl_table sctp_table[] = {
61 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 .procname = "rto_initial",
63 .data = &sctp_rto_initial,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070064 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080066 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070067 .extra1 = &one,
68 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 },
70 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 .procname = "rto_min",
72 .data = &sctp_rto_min,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070073 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080075 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070076 .extra1 = &one,
77 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 },
79 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 .procname = "rto_max",
81 .data = &sctp_rto_max,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070082 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080084 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070085 .extra1 = &one,
86 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 },
88 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 .procname = "valid_cookie_life",
90 .data = &sctp_valid_cookie_life,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070091 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080093 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070094 .extra1 = &one,
95 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 },
97 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 .procname = "max_burst",
99 .data = &sctp_max_burst,
100 .maxlen = sizeof(int),
101 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800102 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700103 .extra1 = &zero,
104 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 },
106 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 .procname = "association_max_retrans",
108 .data = &sctp_max_retrans_association,
109 .maxlen = sizeof(int),
110 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800111 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700112 .extra1 = &one,
113 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 },
115 {
Neil Horman4eb701d2005-04-28 12:02:04 -0700116 .procname = "sndbuf_policy",
117 .data = &sctp_sndbuf_policy,
118 .maxlen = sizeof(int),
119 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800120 .proc_handler = proc_dointvec,
Neil Horman4eb701d2005-04-28 12:02:04 -0700121 },
122 {
Neil Horman049b3ff2005-11-11 16:08:24 -0800123 .procname = "rcvbuf_policy",
124 .data = &sctp_rcvbuf_policy,
125 .maxlen = sizeof(int),
126 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800127 .proc_handler = proc_dointvec,
Neil Horman049b3ff2005-11-11 16:08:24 -0800128 },
129 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130 .procname = "path_max_retrans",
131 .data = &sctp_max_retrans_path,
132 .maxlen = sizeof(int),
133 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800134 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700135 .extra1 = &one,
136 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 },
138 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139 .procname = "max_init_retransmits",
140 .data = &sctp_max_retrans_init,
141 .maxlen = sizeof(int),
142 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800143 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700144 .extra1 = &one,
145 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 },
147 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 .procname = "hb_interval",
149 .data = &sctp_hb_interval,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700150 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800152 .proc_handler = proc_dointvec_minmax,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700153 .extra1 = &one,
154 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 },
156 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 .procname = "cookie_preserve_enable",
158 .data = &sctp_cookie_preserve_enable,
Vlad Yasevich8116ffa2006-01-17 11:55:17 -0800159 .maxlen = sizeof(int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800161 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 },
163 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 .procname = "rto_alpha_exp_divisor",
165 .data = &sctp_rto_alpha,
166 .maxlen = sizeof(int),
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700167 .mode = 0444,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800168 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 },
170 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171 .procname = "rto_beta_exp_divisor",
172 .data = &sctp_rto_beta,
173 .maxlen = sizeof(int),
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700174 .mode = 0444,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800175 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176 },
177 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178 .procname = "addip_enable",
179 .data = &sctp_addip_enable,
180 .maxlen = sizeof(int),
181 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800182 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 },
184 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 .procname = "prsctp_enable",
186 .data = &sctp_prsctp_enable,
187 .maxlen = sizeof(int),
188 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800189 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190 },
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700191 {
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700192 .procname = "sack_timeout",
193 .data = &sctp_sack_timeout,
Jean-Mickael Guerind48e0742009-05-13 00:03:20 +0200194 .maxlen = sizeof(int),
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700195 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800196 .proc_handler = proc_dointvec_minmax,
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700197 .extra1 = &sack_timer_min,
198 .extra2 = &sack_timer_max,
199 },
Neil Horman4d93df02007-08-15 16:07:44 -0700200 {
Neil Horman4d93df02007-08-15 16:07:44 -0700201 .procname = "sctp_mem",
202 .data = &sysctl_sctp_mem,
203 .maxlen = sizeof(sysctl_sctp_mem),
204 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800205 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700206 },
207 {
Neil Horman4d93df02007-08-15 16:07:44 -0700208 .procname = "sctp_rmem",
209 .data = &sysctl_sctp_rmem,
210 .maxlen = sizeof(sysctl_sctp_rmem),
211 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800212 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700213 },
214 {
Neil Horman4d93df02007-08-15 16:07:44 -0700215 .procname = "sctp_wmem",
216 .data = &sysctl_sctp_wmem,
217 .maxlen = sizeof(sysctl_sctp_wmem),
218 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800219 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700220 },
Vlad Yasevicha29a5bd2007-09-16 19:31:35 -0700221 {
Vlad Yasevicha29a5bd2007-09-16 19:31:35 -0700222 .procname = "auth_enable",
223 .data = &sctp_auth_enable,
224 .maxlen = sizeof(int),
225 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800226 .proc_handler = proc_dointvec,
Vlad Yasevicha29a5bd2007-09-16 19:31:35 -0700227 },
Vlad Yasevich73d9c4f2007-10-24 17:24:26 -0400228 {
Vlad Yasevich73d9c4f2007-10-24 17:24:26 -0400229 .procname = "addip_noauth_enable",
230 .data = &sctp_addip_noauth,
231 .maxlen = sizeof(int),
232 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800233 .proc_handler = proc_dointvec,
Vlad Yasevich73d9c4f2007-10-24 17:24:26 -0400234 },
Bhaskar Dutta72388432009-09-03 17:25:47 +0530235 {
Bhaskar Dutta72388432009-09-03 17:25:47 +0530236 .procname = "addr_scope_policy",
237 .data = &sctp_scope_policy,
238 .maxlen = sizeof(int),
239 .mode = 0644,
240 .proc_handler = &proc_dointvec_minmax,
Bhaskar Dutta72388432009-09-03 17:25:47 +0530241 .extra1 = &zero,
242 .extra2 = &addr_scope_max,
243 },
Eric W. Biedermanf8572d82009-11-05 13:32:03 -0800244 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245};
246
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800247static struct ctl_path sctp_path[] = {
Eric W. Biedermanf8572d82009-11-05 13:32:03 -0800248 { .procname = "net", },
249 { .procname = "sctp", },
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800250 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251};
252
253static struct ctl_table_header * sctp_sysctl_header;
254
255/* Sysctl registration. */
256void sctp_sysctl_register(void)
257{
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800258 sctp_sysctl_header = register_sysctl_paths(sctp_path, sctp_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259}
260
261/* Sysctl deregistration. */
262void sctp_sysctl_unregister(void)
263{
264 unregister_sysctl_table(sctp_sysctl_header);
265}