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