blob: e2c679baf912ad35662837d4a6447057053218be [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* SCTP kernel reference Implementation
2 * (C) Copyright IBM Corp. 2002, 2004
3 * Copyright (c) 2002 Intel Corp.
4 *
5 * This file is part of the SCTP kernel reference Implementation
6 *
7 * Sysctl related interfaces for SCTP.
8 *
9 * The SCTP reference implementation is free software;
10 * 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 *
15 * The SCTP reference implementation is distributed in the hope that it
16 * 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;
Vlad Yasevich2f85a422005-06-28 13:24:23 -070052static long sack_timer_min = 1;
53static long sack_timer_max = 500;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55static ctl_table sctp_table[] = {
56 {
57 .ctl_name = NET_SCTP_RTO_INITIAL,
58 .procname = "rto_initial",
59 .data = &sctp_rto_initial,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070060 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070062 .proc_handler = &proc_dointvec_minmax,
63 .strategy = &sysctl_intvec,
64 .extra1 = &one,
65 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 },
67 {
68 .ctl_name = NET_SCTP_RTO_MIN,
69 .procname = "rto_min",
70 .data = &sctp_rto_min,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070071 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070073 .proc_handler = &proc_dointvec_minmax,
74 .strategy = &sysctl_intvec,
75 .extra1 = &one,
76 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 },
78 {
79 .ctl_name = NET_SCTP_RTO_MAX,
80 .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,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070084 .proc_handler = &proc_dointvec_minmax,
85 .strategy = &sysctl_intvec,
86 .extra1 = &one,
87 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 },
89 {
90 .ctl_name = NET_SCTP_VALID_COOKIE_LIFE,
91 .procname = "valid_cookie_life",
92 .data = &sctp_valid_cookie_life,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070093 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -070095 .proc_handler = &proc_dointvec_minmax,
96 .strategy = &sysctl_intvec,
97 .extra1 = &one,
98 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 },
100 {
101 .ctl_name = NET_SCTP_MAX_BURST,
102 .procname = "max_burst",
103 .data = &sctp_max_burst,
104 .maxlen = sizeof(int),
105 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700106 .proc_handler = &proc_dointvec_minmax,
107 .strategy = &sysctl_intvec,
108 .extra1 = &zero,
109 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 },
111 {
112 .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS,
113 .procname = "association_max_retrans",
114 .data = &sctp_max_retrans_association,
115 .maxlen = sizeof(int),
116 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700117 .proc_handler = &proc_dointvec_minmax,
118 .strategy = &sysctl_intvec,
119 .extra1 = &one,
120 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 },
122 {
Neil Horman4eb701d2005-04-28 12:02:04 -0700123 .ctl_name = NET_SCTP_SNDBUF_POLICY,
124 .procname = "sndbuf_policy",
125 .data = &sctp_sndbuf_policy,
126 .maxlen = sizeof(int),
127 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700128 .proc_handler = &proc_dointvec,
129 .strategy = &sysctl_intvec
Neil Horman4eb701d2005-04-28 12:02:04 -0700130 },
131 {
Neil Horman049b3ff2005-11-11 16:08:24 -0800132 .ctl_name = NET_SCTP_RCVBUF_POLICY,
133 .procname = "rcvbuf_policy",
134 .data = &sctp_rcvbuf_policy,
135 .maxlen = sizeof(int),
136 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700137 .proc_handler = &proc_dointvec,
138 .strategy = &sysctl_intvec
Neil Horman049b3ff2005-11-11 16:08:24 -0800139 },
140 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 .ctl_name = NET_SCTP_PATH_MAX_RETRANS,
142 .procname = "path_max_retrans",
143 .data = &sctp_max_retrans_path,
144 .maxlen = sizeof(int),
145 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700146 .proc_handler = &proc_dointvec_minmax,
147 .strategy = &sysctl_intvec,
148 .extra1 = &one,
149 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 },
151 {
152 .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS,
153 .procname = "max_init_retransmits",
154 .data = &sctp_max_retrans_init,
155 .maxlen = sizeof(int),
156 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700157 .proc_handler = &proc_dointvec_minmax,
158 .strategy = &sysctl_intvec,
159 .extra1 = &one,
160 .extra2 = &int_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161 },
162 {
163 .ctl_name = NET_SCTP_HB_INTERVAL,
164 .procname = "hb_interval",
165 .data = &sctp_hb_interval,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700166 .maxlen = sizeof(unsigned int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700168 .proc_handler = &proc_dointvec_minmax,
169 .strategy = &sysctl_intvec,
170 .extra1 = &one,
171 .extra2 = &timer_max
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 },
173 {
174 .ctl_name = NET_SCTP_PRESERVE_ENABLE,
175 .procname = "cookie_preserve_enable",
176 .data = &sctp_cookie_preserve_enable,
Vlad Yasevich8116ffa2006-01-17 11:55:17 -0800177 .maxlen = sizeof(int),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700179 .proc_handler = &proc_dointvec,
180 .strategy = &sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 },
182 {
183 .ctl_name = NET_SCTP_RTO_ALPHA,
184 .procname = "rto_alpha_exp_divisor",
185 .data = &sctp_rto_alpha,
186 .maxlen = sizeof(int),
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700187 .mode = 0444,
188 .proc_handler = &proc_dointvec,
189 .strategy = &sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190 },
191 {
192 .ctl_name = NET_SCTP_RTO_BETA,
193 .procname = "rto_beta_exp_divisor",
194 .data = &sctp_rto_beta,
195 .maxlen = sizeof(int),
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700196 .mode = 0444,
197 .proc_handler = &proc_dointvec,
198 .strategy = &sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199 },
200 {
201 .ctl_name = NET_SCTP_ADDIP_ENABLE,
202 .procname = "addip_enable",
203 .data = &sctp_addip_enable,
204 .maxlen = sizeof(int),
205 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700206 .proc_handler = &proc_dointvec,
207 .strategy = &sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 },
209 {
210 .ctl_name = NET_SCTP_PRSCTP_ENABLE,
211 .procname = "prsctp_enable",
212 .data = &sctp_prsctp_enable,
213 .maxlen = sizeof(int),
214 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700215 .proc_handler = &proc_dointvec,
216 .strategy = &sysctl_intvec
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 },
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700218 {
219 .ctl_name = NET_SCTP_SACK_TIMEOUT,
220 .procname = "sack_timeout",
221 .data = &sctp_sack_timeout,
222 .maxlen = sizeof(long),
223 .mode = 0644,
Vladislav Yasevich3fd091e2006-08-22 13:29:17 -0700224 .proc_handler = &proc_dointvec_minmax,
225 .strategy = &sysctl_intvec,
Vlad Yasevich2f85a422005-06-28 13:24:23 -0700226 .extra1 = &sack_timer_min,
227 .extra2 = &sack_timer_max,
228 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 { .ctl_name = 0 }
230};
231
232static ctl_table sctp_net_table[] = {
233 {
234 .ctl_name = NET_SCTP,
235 .procname = "sctp",
236 .mode = 0555,
237 .child = sctp_table
238 },
239 { .ctl_name = 0 }
240};
241
242static ctl_table sctp_root_table[] = {
243 {
244 .ctl_name = CTL_NET,
245 .procname = "net",
246 .mode = 0555,
247 .child = sctp_net_table
248 },
249 { .ctl_name = 0 }
250};
251
252static struct ctl_table_header * sctp_sysctl_header;
253
254/* Sysctl registration. */
255void sctp_sysctl_register(void)
256{
Eric W. Biederman0b4d4142007-02-14 00:34:09 -0800257 sctp_sysctl_header = register_sysctl_table(sctp_root_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258}
259
260/* Sysctl deregistration. */
261void sctp_sysctl_unregister(void)
262{
263 unregister_sysctl_table(sctp_sysctl_header);
264}