Merge branch 'kill_rtcache'
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / sctp / sysctl.c
1 /* SCTP kernel implementation
2 * (C) Copyright IBM Corp. 2002, 2004
3 * Copyright (c) 2002 Intel Corp.
4 *
5 * This file is part of the SCTP kernel implementation
6 *
7 * Sysctl related interfaces for SCTP.
8 *
9 * This SCTP 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 * This SCTP 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>
45 #include <net/sctp/sctp.h>
46 #include <linux/sysctl.h>
47
48 static int zero = 0;
49 static int one = 1;
50 static int timer_max = 86400000; /* ms in one day */
51 static int int_max = INT_MAX;
52 static int sack_timer_min = 1;
53 static int sack_timer_max = 500;
54 static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
55 static int rwnd_scale_max = 16;
56 static unsigned long max_autoclose_min = 0;
57 static unsigned long max_autoclose_max =
58 (MAX_SCHEDULE_TIMEOUT / HZ > UINT_MAX)
59 ? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ;
60
61 extern long sysctl_sctp_mem[3];
62 extern int sysctl_sctp_rmem[3];
63 extern int sysctl_sctp_wmem[3];
64
65 static ctl_table sctp_table[] = {
66 {
67 .procname = "rto_initial",
68 .data = &sctp_rto_initial,
69 .maxlen = sizeof(unsigned int),
70 .mode = 0644,
71 .proc_handler = proc_dointvec_minmax,
72 .extra1 = &one,
73 .extra2 = &timer_max
74 },
75 {
76 .procname = "rto_min",
77 .data = &sctp_rto_min,
78 .maxlen = sizeof(unsigned int),
79 .mode = 0644,
80 .proc_handler = proc_dointvec_minmax,
81 .extra1 = &one,
82 .extra2 = &timer_max
83 },
84 {
85 .procname = "rto_max",
86 .data = &sctp_rto_max,
87 .maxlen = sizeof(unsigned int),
88 .mode = 0644,
89 .proc_handler = proc_dointvec_minmax,
90 .extra1 = &one,
91 .extra2 = &timer_max
92 },
93 {
94 .procname = "valid_cookie_life",
95 .data = &sctp_valid_cookie_life,
96 .maxlen = sizeof(unsigned int),
97 .mode = 0644,
98 .proc_handler = proc_dointvec_minmax,
99 .extra1 = &one,
100 .extra2 = &timer_max
101 },
102 {
103 .procname = "max_burst",
104 .data = &sctp_max_burst,
105 .maxlen = sizeof(int),
106 .mode = 0644,
107 .proc_handler = proc_dointvec_minmax,
108 .extra1 = &zero,
109 .extra2 = &int_max
110 },
111 {
112 .procname = "association_max_retrans",
113 .data = &sctp_max_retrans_association,
114 .maxlen = sizeof(int),
115 .mode = 0644,
116 .proc_handler = proc_dointvec_minmax,
117 .extra1 = &one,
118 .extra2 = &int_max
119 },
120 {
121 .procname = "sndbuf_policy",
122 .data = &sctp_sndbuf_policy,
123 .maxlen = sizeof(int),
124 .mode = 0644,
125 .proc_handler = proc_dointvec,
126 },
127 {
128 .procname = "rcvbuf_policy",
129 .data = &sctp_rcvbuf_policy,
130 .maxlen = sizeof(int),
131 .mode = 0644,
132 .proc_handler = proc_dointvec,
133 },
134 {
135 .procname = "path_max_retrans",
136 .data = &sctp_max_retrans_path,
137 .maxlen = sizeof(int),
138 .mode = 0644,
139 .proc_handler = proc_dointvec_minmax,
140 .extra1 = &one,
141 .extra2 = &int_max
142 },
143 {
144 .procname = "pf_retrans",
145 .data = &sctp_pf_retrans,
146 .maxlen = sizeof(int),
147 .mode = 0644,
148 .proc_handler = proc_dointvec_minmax,
149 .extra1 = &zero,
150 .extra2 = &int_max
151 },
152 {
153 .procname = "max_init_retransmits",
154 .data = &sctp_max_retrans_init,
155 .maxlen = sizeof(int),
156 .mode = 0644,
157 .proc_handler = proc_dointvec_minmax,
158 .extra1 = &one,
159 .extra2 = &int_max
160 },
161 {
162 .procname = "hb_interval",
163 .data = &sctp_hb_interval,
164 .maxlen = sizeof(unsigned int),
165 .mode = 0644,
166 .proc_handler = proc_dointvec_minmax,
167 .extra1 = &one,
168 .extra2 = &timer_max
169 },
170 {
171 .procname = "cookie_preserve_enable",
172 .data = &sctp_cookie_preserve_enable,
173 .maxlen = sizeof(int),
174 .mode = 0644,
175 .proc_handler = proc_dointvec,
176 },
177 {
178 .procname = "rto_alpha_exp_divisor",
179 .data = &sctp_rto_alpha,
180 .maxlen = sizeof(int),
181 .mode = 0444,
182 .proc_handler = proc_dointvec,
183 },
184 {
185 .procname = "rto_beta_exp_divisor",
186 .data = &sctp_rto_beta,
187 .maxlen = sizeof(int),
188 .mode = 0444,
189 .proc_handler = proc_dointvec,
190 },
191 {
192 .procname = "addip_enable",
193 .data = &sctp_addip_enable,
194 .maxlen = sizeof(int),
195 .mode = 0644,
196 .proc_handler = proc_dointvec,
197 },
198 {
199 .procname = "default_auto_asconf",
200 .data = &sctp_default_auto_asconf,
201 .maxlen = sizeof(int),
202 .mode = 0644,
203 .proc_handler = proc_dointvec,
204 },
205 {
206 .procname = "prsctp_enable",
207 .data = &sctp_prsctp_enable,
208 .maxlen = sizeof(int),
209 .mode = 0644,
210 .proc_handler = proc_dointvec,
211 },
212 {
213 .procname = "sack_timeout",
214 .data = &sctp_sack_timeout,
215 .maxlen = sizeof(int),
216 .mode = 0644,
217 .proc_handler = proc_dointvec_minmax,
218 .extra1 = &sack_timer_min,
219 .extra2 = &sack_timer_max,
220 },
221 {
222 .procname = "sctp_mem",
223 .data = &sysctl_sctp_mem,
224 .maxlen = sizeof(sysctl_sctp_mem),
225 .mode = 0644,
226 .proc_handler = proc_doulongvec_minmax
227 },
228 {
229 .procname = "sctp_rmem",
230 .data = &sysctl_sctp_rmem,
231 .maxlen = sizeof(sysctl_sctp_rmem),
232 .mode = 0644,
233 .proc_handler = proc_dointvec,
234 },
235 {
236 .procname = "sctp_wmem",
237 .data = &sysctl_sctp_wmem,
238 .maxlen = sizeof(sysctl_sctp_wmem),
239 .mode = 0644,
240 .proc_handler = proc_dointvec,
241 },
242 {
243 .procname = "auth_enable",
244 .data = &sctp_auth_enable,
245 .maxlen = sizeof(int),
246 .mode = 0644,
247 .proc_handler = proc_dointvec,
248 },
249 {
250 .procname = "addip_noauth_enable",
251 .data = &sctp_addip_noauth,
252 .maxlen = sizeof(int),
253 .mode = 0644,
254 .proc_handler = proc_dointvec,
255 },
256 {
257 .procname = "addr_scope_policy",
258 .data = &sctp_scope_policy,
259 .maxlen = sizeof(int),
260 .mode = 0644,
261 .proc_handler = proc_dointvec_minmax,
262 .extra1 = &zero,
263 .extra2 = &addr_scope_max,
264 },
265 {
266 .procname = "rwnd_update_shift",
267 .data = &sctp_rwnd_upd_shift,
268 .maxlen = sizeof(int),
269 .mode = 0644,
270 .proc_handler = &proc_dointvec_minmax,
271 .extra1 = &one,
272 .extra2 = &rwnd_scale_max,
273 },
274 {
275 .procname = "max_autoclose",
276 .data = &sctp_max_autoclose,
277 .maxlen = sizeof(unsigned long),
278 .mode = 0644,
279 .proc_handler = &proc_doulongvec_minmax,
280 .extra1 = &max_autoclose_min,
281 .extra2 = &max_autoclose_max,
282 },
283
284 { /* sentinel */ }
285 };
286
287 static struct ctl_table_header * sctp_sysctl_header;
288
289 /* Sysctl registration. */
290 void sctp_sysctl_register(void)
291 {
292 sctp_sysctl_header = register_net_sysctl(&init_net, "net/sctp", sctp_table);
293 }
294
295 /* Sysctl deregistration. */
296 void sctp_sysctl_unregister(void)
297 {
298 unregister_net_sysctl_table(sctp_sysctl_header);
299 }