blob: 63eabbc71298a30b76196aa8f341db78bdf30f31 [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;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Vlad Yasevich007e3932007-09-16 16:04:37 -070055extern int sysctl_sctp_mem[3];
56extern int sysctl_sctp_rmem[3];
57extern int sysctl_sctp_wmem[3];
Neil Horman4d93df02007-08-15 16:07:44 -070058
Linus Torvalds1da177e2005-04-16 15:20:36 -070059static ctl_table sctp_table[] = {
60 {
61 .ctl_name = NET_SCTP_RTO_INITIAL,
62 .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,
67 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070068 .extra1 = &one,
69 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 },
71 {
72 .ctl_name = NET_SCTP_RTO_MIN,
73 .procname = "rto_min",
74 .data = &sctp_rto_min,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070075 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080077 .proc_handler = proc_dointvec_minmax,
78 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070079 .extra1 = &one,
80 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 },
82 {
83 .ctl_name = NET_SCTP_RTO_MAX,
84 .procname = "rto_max",
85 .data = &sctp_rto_max,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070086 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080088 .proc_handler = proc_dointvec_minmax,
89 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070090 .extra1 = &one,
91 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 },
93 {
94 .ctl_name = NET_SCTP_VALID_COOKIE_LIFE,
95 .procname = "valid_cookie_life",
96 .data = &sctp_valid_cookie_life,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070097 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080099 .proc_handler = proc_dointvec_minmax,
100 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700101 .extra1 = &one,
102 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 },
104 {
105 .ctl_name = NET_SCTP_MAX_BURST,
106 .procname = "max_burst",
107 .data = &sctp_max_burst,
108 .maxlen = sizeof(int),
109 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800110 .proc_handler = proc_dointvec_minmax,
111 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700112 .extra1 = &zero,
113 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 },
115 {
116 .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS,
117 .procname = "association_max_retrans",
118 .data = &sctp_max_retrans_association,
119 .maxlen = sizeof(int),
120 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800121 .proc_handler = proc_dointvec_minmax,
122 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700123 .extra1 = &one,
124 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 },
126 {
Neil Horman4eb701d2005-04-28 12:02:04 -0700127 .ctl_name = NET_SCTP_SNDBUF_POLICY,
128 .procname = "sndbuf_policy",
129 .data = &sctp_sndbuf_policy,
130 .maxlen = sizeof(int),
131 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800132 .proc_handler = proc_dointvec,
133 .strategy = sysctl_intvec
Neil Horman4eb701d2005-04-28 12:02:04 -0700134 },
135 {
Neil Horman049b3ff2005-11-11 16:08:24 -0800136 .ctl_name = NET_SCTP_RCVBUF_POLICY,
137 .procname = "rcvbuf_policy",
138 .data = &sctp_rcvbuf_policy,
139 .maxlen = sizeof(int),
140 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800141 .proc_handler = proc_dointvec,
142 .strategy = sysctl_intvec
Neil Horman049b3ff2005-11-11 16:08:24 -0800143 },
144 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 .ctl_name = NET_SCTP_PATH_MAX_RETRANS,
146 .procname = "path_max_retrans",
147 .data = &sctp_max_retrans_path,
148 .maxlen = sizeof(int),
149 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800150 .proc_handler = proc_dointvec_minmax,
151 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700152 .extra1 = &one,
153 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 },
155 {
156 .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS,
157 .procname = "max_init_retransmits",
158 .data = &sctp_max_retrans_init,
159 .maxlen = sizeof(int),
160 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800161 .proc_handler = proc_dointvec_minmax,
162 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700163 .extra1 = &one,
164 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 },
166 {
167 .ctl_name = NET_SCTP_HB_INTERVAL,
168 .procname = "hb_interval",
169 .data = &sctp_hb_interval,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700170 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800172 .proc_handler = proc_dointvec_minmax,
173 .strategy = sysctl_intvec,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700174 .extra1 = &one,
175 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176 },
177 {
178 .ctl_name = NET_SCTP_PRESERVE_ENABLE,
179 .procname = "cookie_preserve_enable",
180 .data = &sctp_cookie_preserve_enable,
Vlad Yasevich8116ffa2006-01-17 11:55:17 -0800181 .maxlen = sizeof(int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800183 .proc_handler = proc_dointvec,
184 .strategy = sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 },
186 {
187 .ctl_name = NET_SCTP_RTO_ALPHA,
188 .procname = "rto_alpha_exp_divisor",
189 .data = &sctp_rto_alpha,
190 .maxlen = sizeof(int),
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700191 .mode = 0444,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800192 .proc_handler = proc_dointvec,
193 .strategy = sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194 },
195 {
196 .ctl_name = NET_SCTP_RTO_BETA,
197 .procname = "rto_beta_exp_divisor",
198 .data = &sctp_rto_beta,
199 .maxlen = sizeof(int),
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700200 .mode = 0444,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800201 .proc_handler = proc_dointvec,
202 .strategy = sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203 },
204 {
205 .ctl_name = NET_SCTP_ADDIP_ENABLE,
206 .procname = "addip_enable",
207 .data = &sctp_addip_enable,
208 .maxlen = sizeof(int),
209 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800210 .proc_handler = proc_dointvec,
211 .strategy = sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 },
213 {
214 .ctl_name = NET_SCTP_PRSCTP_ENABLE,
215 .procname = "prsctp_enable",
216 .data = &sctp_prsctp_enable,
217 .maxlen = sizeof(int),
218 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800219 .proc_handler = proc_dointvec,
220 .strategy = sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 },
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700222 {
223 .ctl_name = NET_SCTP_SACK_TIMEOUT,
224 .procname = "sack_timeout",
225 .data = &sctp_sack_timeout,
Jean-Mickael Guerind48e0742009-05-13 00:03:20 +0200226 .maxlen = sizeof(int),
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700227 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800228 .proc_handler = proc_dointvec_minmax,
229 .strategy = sysctl_intvec,
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700230 .extra1 = &sack_timer_min,
231 .extra2 = &sack_timer_max,
232 },
Neil Horman4d93df02007-08-15 16:07:44 -0700233 {
234 .ctl_name = CTL_UNNUMBERED,
235 .procname = "sctp_mem",
236 .data = &sysctl_sctp_mem,
237 .maxlen = sizeof(sysctl_sctp_mem),
238 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800239 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700240 },
241 {
242 .ctl_name = CTL_UNNUMBERED,
243 .procname = "sctp_rmem",
244 .data = &sysctl_sctp_rmem,
245 .maxlen = sizeof(sysctl_sctp_rmem),
246 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800247 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700248 },
249 {
250 .ctl_name = CTL_UNNUMBERED,
251 .procname = "sctp_wmem",
252 .data = &sysctl_sctp_wmem,
253 .maxlen = sizeof(sysctl_sctp_wmem),
254 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800255 .proc_handler = proc_dointvec,
Neil Horman4d93df02007-08-15 16:07:44 -0700256 },
Vlad Yasevicha29a5bd2007-09-16 19:31:35 -0700257 {
258 .ctl_name = CTL_UNNUMBERED,
259 .procname = "auth_enable",
260 .data = &sctp_auth_enable,
261 .maxlen = sizeof(int),
262 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800263 .proc_handler = proc_dointvec,
264 .strategy = sysctl_intvec
Vlad Yasevicha29a5bd2007-09-16 19:31:35 -0700265 },
Vlad Yasevich73d9c4f2007-10-24 17:24:26 -0400266 {
267 .ctl_name = CTL_UNNUMBERED,
268 .procname = "addip_noauth_enable",
269 .data = &sctp_addip_noauth,
270 .maxlen = sizeof(int),
271 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800272 .proc_handler = proc_dointvec,
273 .strategy = sysctl_intvec
Vlad Yasevich73d9c4f2007-10-24 17:24:26 -0400274 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 { .ctl_name = 0 }
276};
277
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800278static struct ctl_path sctp_path[] = {
279 { .procname = "net", .ctl_name = CTL_NET, },
280 { .procname = "sctp", .ctl_name = NET_SCTP, },
281 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282};
283
284static struct ctl_table_header * sctp_sysctl_header;
285
286/* Sysctl registration. */
287void sctp_sysctl_register(void)
288{
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800289 sctp_sysctl_header = register_sysctl_paths(sctp_path, sctp_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290}
291
292/* Sysctl deregistration. */
293void sctp_sysctl_unregister(void)
294{
295 unregister_sysctl_table(sctp_sysctl_header);
296}