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