]>
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 <[email protected]> | |
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 <[email protected]> | |
35 | * Jon Grimm <[email protected]> | |
36 | * Ardelle Fan <[email protected]> | |
37 | * Ryan Layer <[email protected]> | |
38 | * Sridhar Samudrala <[email protected]> | |
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; |
1da177e4 | 56 | |
007e3936 VY |
57 | extern int sysctl_sctp_mem[3]; |
58 | extern int sysctl_sctp_rmem[3]; | |
59 | extern int sysctl_sctp_wmem[3]; | |
4d93df0a | 60 | |
1da177e4 LT |
61 | static ctl_table sctp_table[] = { |
62 | { | |
1da177e4 LT |
63 | .procname = "rto_initial", |
64 | .data = &sctp_rto_initial, | |
3fd091e7 | 65 | .maxlen = sizeof(unsigned int), |
1da177e4 | 66 | .mode = 0644, |
6d9f239a | 67 | .proc_handler = proc_dointvec_minmax, |
3fd091e7 VY |
68 | .extra1 = &one, |
69 | .extra2 = &timer_max | |
1da177e4 LT |
70 | }, |
71 | { | |
1da177e4 LT |
72 | .procname = "rto_min", |
73 | .data = &sctp_rto_min, | |
3fd091e7 | 74 | .maxlen = sizeof(unsigned int), |
1da177e4 | 75 | .mode = 0644, |
6d9f239a | 76 | .proc_handler = proc_dointvec_minmax, |
3fd091e7 VY |
77 | .extra1 = &one, |
78 | .extra2 = &timer_max | |
1da177e4 LT |
79 | }, |
80 | { | |
1da177e4 LT |
81 | .procname = "rto_max", |
82 | .data = &sctp_rto_max, | |
3fd091e7 | 83 | .maxlen = sizeof(unsigned int), |
1da177e4 | 84 | .mode = 0644, |
6d9f239a | 85 | .proc_handler = proc_dointvec_minmax, |
3fd091e7 VY |
86 | .extra1 = &one, |
87 | .extra2 = &timer_max | |
1da177e4 LT |
88 | }, |
89 | { | |
1da177e4 LT |
90 | .procname = "valid_cookie_life", |
91 | .data = &sctp_valid_cookie_life, | |
3fd091e7 | 92 | .maxlen = sizeof(unsigned int), |
1da177e4 | 93 | .mode = 0644, |
6d9f239a | 94 | .proc_handler = proc_dointvec_minmax, |
3fd091e7 VY |
95 | .extra1 = &one, |
96 | .extra2 = &timer_max | |
1da177e4 LT |
97 | }, |
98 | { | |
1da177e4 LT |
99 | .procname = "max_burst", |
100 | .data = &sctp_max_burst, | |
101 | .maxlen = sizeof(int), | |
102 | .mode = 0644, | |
6d9f239a | 103 | .proc_handler = proc_dointvec_minmax, |
3fd091e7 VY |
104 | .extra1 = &zero, |
105 | .extra2 = &int_max | |
1da177e4 LT |
106 | }, |
107 | { | |
1da177e4 LT |
108 | .procname = "association_max_retrans", |
109 | .data = &sctp_max_retrans_association, | |
110 | .maxlen = sizeof(int), | |
111 | .mode = 0644, | |
6d9f239a | 112 | .proc_handler = proc_dointvec_minmax, |
3fd091e7 VY |
113 | .extra1 = &one, |
114 | .extra2 = &int_max | |
1da177e4 | 115 | }, |
4eb701df | 116 | { |
4eb701df NH |
117 | .procname = "sndbuf_policy", |
118 | .data = &sctp_sndbuf_policy, | |
119 | .maxlen = sizeof(int), | |
120 | .mode = 0644, | |
6d9f239a | 121 | .proc_handler = proc_dointvec, |
4eb701df | 122 | }, |
049b3ff5 | 123 | { |
049b3ff5 NH |
124 | .procname = "rcvbuf_policy", |
125 | .data = &sctp_rcvbuf_policy, | |
126 | .maxlen = sizeof(int), | |
127 | .mode = 0644, | |
6d9f239a | 128 | .proc_handler = proc_dointvec, |
049b3ff5 | 129 | }, |
1da177e4 | 130 | { |
1da177e4 LT |
131 | .procname = "path_max_retrans", |
132 | .data = &sctp_max_retrans_path, | |
133 | .maxlen = sizeof(int), | |
134 | .mode = 0644, | |
6d9f239a | 135 | .proc_handler = proc_dointvec_minmax, |
3fd091e7 VY |
136 | .extra1 = &one, |
137 | .extra2 = &int_max | |
1da177e4 LT |
138 | }, |
139 | { | |
1da177e4 LT |
140 | .procname = "max_init_retransmits", |
141 | .data = &sctp_max_retrans_init, | |
142 | .maxlen = sizeof(int), | |
143 | .mode = 0644, | |
6d9f239a | 144 | .proc_handler = proc_dointvec_minmax, |
3fd091e7 VY |
145 | .extra1 = &one, |
146 | .extra2 = &int_max | |
1da177e4 LT |
147 | }, |
148 | { | |
1da177e4 LT |
149 | .procname = "hb_interval", |
150 | .data = &sctp_hb_interval, | |
3fd091e7 | 151 | .maxlen = sizeof(unsigned int), |
1da177e4 | 152 | .mode = 0644, |
6d9f239a | 153 | .proc_handler = proc_dointvec_minmax, |
3fd091e7 VY |
154 | .extra1 = &one, |
155 | .extra2 = &timer_max | |
1da177e4 LT |
156 | }, |
157 | { | |
1da177e4 LT |
158 | .procname = "cookie_preserve_enable", |
159 | .data = &sctp_cookie_preserve_enable, | |
8116ffad | 160 | .maxlen = sizeof(int), |
1da177e4 | 161 | .mode = 0644, |
6d9f239a | 162 | .proc_handler = proc_dointvec, |
1da177e4 LT |
163 | }, |
164 | { | |
1da177e4 LT |
165 | .procname = "rto_alpha_exp_divisor", |
166 | .data = &sctp_rto_alpha, | |
167 | .maxlen = sizeof(int), | |
3fd091e7 | 168 | .mode = 0444, |
6d9f239a | 169 | .proc_handler = proc_dointvec, |
1da177e4 LT |
170 | }, |
171 | { | |
1da177e4 LT |
172 | .procname = "rto_beta_exp_divisor", |
173 | .data = &sctp_rto_beta, | |
174 | .maxlen = sizeof(int), | |
3fd091e7 | 175 | .mode = 0444, |
6d9f239a | 176 | .proc_handler = proc_dointvec, |
1da177e4 LT |
177 | }, |
178 | { | |
1da177e4 LT |
179 | .procname = "addip_enable", |
180 | .data = &sctp_addip_enable, | |
181 | .maxlen = sizeof(int), | |
182 | .mode = 0644, | |
6d9f239a | 183 | .proc_handler = proc_dointvec, |
1da177e4 LT |
184 | }, |
185 | { | |
1da177e4 LT |
186 | .procname = "prsctp_enable", |
187 | .data = &sctp_prsctp_enable, | |
188 | .maxlen = sizeof(int), | |
189 | .mode = 0644, | |
6d9f239a | 190 | .proc_handler = proc_dointvec, |
1da177e4 | 191 | }, |
2f85a429 | 192 | { |
2f85a429 VY |
193 | .procname = "sack_timeout", |
194 | .data = &sctp_sack_timeout, | |
d48e074d | 195 | .maxlen = sizeof(int), |
2f85a429 | 196 | .mode = 0644, |
6d9f239a | 197 | .proc_handler = proc_dointvec_minmax, |
2f85a429 VY |
198 | .extra1 = &sack_timer_min, |
199 | .extra2 = &sack_timer_max, | |
200 | }, | |
4d93df0a | 201 | { |
4d93df0a NH |
202 | .procname = "sctp_mem", |
203 | .data = &sysctl_sctp_mem, | |
204 | .maxlen = sizeof(sysctl_sctp_mem), | |
205 | .mode = 0644, | |
6d9f239a | 206 | .proc_handler = proc_dointvec, |
4d93df0a NH |
207 | }, |
208 | { | |
4d93df0a NH |
209 | .procname = "sctp_rmem", |
210 | .data = &sysctl_sctp_rmem, | |
211 | .maxlen = sizeof(sysctl_sctp_rmem), | |
212 | .mode = 0644, | |
6d9f239a | 213 | .proc_handler = proc_dointvec, |
4d93df0a NH |
214 | }, |
215 | { | |
4d93df0a NH |
216 | .procname = "sctp_wmem", |
217 | .data = &sysctl_sctp_wmem, | |
218 | .maxlen = sizeof(sysctl_sctp_wmem), | |
219 | .mode = 0644, | |
6d9f239a | 220 | .proc_handler = proc_dointvec, |
4d93df0a | 221 | }, |
a29a5bd4 | 222 | { |
a29a5bd4 VY |
223 | .procname = "auth_enable", |
224 | .data = &sctp_auth_enable, | |
225 | .maxlen = sizeof(int), | |
226 | .mode = 0644, | |
6d9f239a | 227 | .proc_handler = proc_dointvec, |
a29a5bd4 | 228 | }, |
73d9c4fd | 229 | { |
73d9c4fd VY |
230 | .procname = "addip_noauth_enable", |
231 | .data = &sctp_addip_noauth, | |
232 | .maxlen = sizeof(int), | |
233 | .mode = 0644, | |
6d9f239a | 234 | .proc_handler = proc_dointvec, |
73d9c4fd | 235 | }, |
72388433 | 236 | { |
72388433 BD |
237 | .procname = "addr_scope_policy", |
238 | .data = &sctp_scope_policy, | |
239 | .maxlen = sizeof(int), | |
240 | .mode = 0644, | |
6d456111 | 241 | .proc_handler = proc_dointvec_minmax, |
72388433 BD |
242 | .extra1 = &zero, |
243 | .extra2 = &addr_scope_max, | |
244 | }, | |
90f2f531 | 245 | { |
90f2f531 VY |
246 | .procname = "rwnd_update_shift", |
247 | .data = &sctp_rwnd_upd_shift, | |
248 | .maxlen = sizeof(int), | |
249 | .mode = 0644, | |
250 | .proc_handler = &proc_dointvec_minmax, | |
90f2f531 VY |
251 | .extra1 = &one, |
252 | .extra2 = &rwnd_scale_max, | |
253 | }, | |
254 | ||
d7fc02c7 | 255 | { /* sentinel */ } |
1da177e4 LT |
256 | }; |
257 | ||
b5ccd792 | 258 | static struct ctl_path sctp_path[] = { |
f8572d8f EB |
259 | { .procname = "net", }, |
260 | { .procname = "sctp", }, | |
b5ccd792 | 261 | { } |
1da177e4 LT |
262 | }; |
263 | ||
264 | static struct ctl_table_header * sctp_sysctl_header; | |
265 | ||
266 | /* Sysctl registration. */ | |
267 | void sctp_sysctl_register(void) | |
268 | { | |
b5ccd792 | 269 | sctp_sysctl_header = register_sysctl_paths(sctp_path, sctp_table); |
1da177e4 LT |
270 | } |
271 | ||
272 | /* Sysctl deregistration. */ | |
273 | void sctp_sysctl_unregister(void) | |
274 | { | |
275 | unregister_sysctl_table(sctp_sysctl_header); | |
276 | } |