diff options
Diffstat (limited to 'net/sctp/sysctl.c')
-rw-r--r-- | net/sctp/sysctl.c | 198 |
1 files changed, 112 insertions, 86 deletions
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 2b2bfe933ff1..70e3ba5cb50b 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
@@ -64,8 +64,34 @@ extern int sysctl_sctp_wmem[3]; | |||
64 | 64 | ||
65 | static ctl_table sctp_table[] = { | 65 | static ctl_table sctp_table[] = { |
66 | { | 66 | { |
67 | .procname = "sctp_mem", | ||
68 | .data = &sysctl_sctp_mem, | ||
69 | .maxlen = sizeof(sysctl_sctp_mem), | ||
70 | .mode = 0644, | ||
71 | .proc_handler = proc_doulongvec_minmax | ||
72 | }, | ||
73 | { | ||
74 | .procname = "sctp_rmem", | ||
75 | .data = &sysctl_sctp_rmem, | ||
76 | .maxlen = sizeof(sysctl_sctp_rmem), | ||
77 | .mode = 0644, | ||
78 | .proc_handler = proc_dointvec, | ||
79 | }, | ||
80 | { | ||
81 | .procname = "sctp_wmem", | ||
82 | .data = &sysctl_sctp_wmem, | ||
83 | .maxlen = sizeof(sysctl_sctp_wmem), | ||
84 | .mode = 0644, | ||
85 | .proc_handler = proc_dointvec, | ||
86 | }, | ||
87 | |||
88 | { /* sentinel */ } | ||
89 | }; | ||
90 | |||
91 | static ctl_table sctp_net_table[] = { | ||
92 | { | ||
67 | .procname = "rto_initial", | 93 | .procname = "rto_initial", |
68 | .data = &sctp_rto_initial, | 94 | .data = &init_net.sctp.rto_initial, |
69 | .maxlen = sizeof(unsigned int), | 95 | .maxlen = sizeof(unsigned int), |
70 | .mode = 0644, | 96 | .mode = 0644, |
71 | .proc_handler = proc_dointvec_minmax, | 97 | .proc_handler = proc_dointvec_minmax, |
@@ -74,7 +100,7 @@ static ctl_table sctp_table[] = { | |||
74 | }, | 100 | }, |
75 | { | 101 | { |
76 | .procname = "rto_min", | 102 | .procname = "rto_min", |
77 | .data = &sctp_rto_min, | 103 | .data = &init_net.sctp.rto_min, |
78 | .maxlen = sizeof(unsigned int), | 104 | .maxlen = sizeof(unsigned int), |
79 | .mode = 0644, | 105 | .mode = 0644, |
80 | .proc_handler = proc_dointvec_minmax, | 106 | .proc_handler = proc_dointvec_minmax, |
@@ -83,7 +109,7 @@ static ctl_table sctp_table[] = { | |||
83 | }, | 109 | }, |
84 | { | 110 | { |
85 | .procname = "rto_max", | 111 | .procname = "rto_max", |
86 | .data = &sctp_rto_max, | 112 | .data = &init_net.sctp.rto_max, |
87 | .maxlen = sizeof(unsigned int), | 113 | .maxlen = sizeof(unsigned int), |
88 | .mode = 0644, | 114 | .mode = 0644, |
89 | .proc_handler = proc_dointvec_minmax, | 115 | .proc_handler = proc_dointvec_minmax, |
@@ -91,17 +117,22 @@ static ctl_table sctp_table[] = { | |||
91 | .extra2 = &timer_max | 117 | .extra2 = &timer_max |
92 | }, | 118 | }, |
93 | { | 119 | { |
94 | .procname = "valid_cookie_life", | 120 | .procname = "rto_alpha_exp_divisor", |
95 | .data = &sctp_valid_cookie_life, | 121 | .data = &init_net.sctp.rto_alpha, |
96 | .maxlen = sizeof(unsigned int), | 122 | .maxlen = sizeof(int), |
97 | .mode = 0644, | 123 | .mode = 0444, |
98 | .proc_handler = proc_dointvec_minmax, | 124 | .proc_handler = proc_dointvec, |
99 | .extra1 = &one, | 125 | }, |
100 | .extra2 = &timer_max | 126 | { |
127 | .procname = "rto_beta_exp_divisor", | ||
128 | .data = &init_net.sctp.rto_beta, | ||
129 | .maxlen = sizeof(int), | ||
130 | .mode = 0444, | ||
131 | .proc_handler = proc_dointvec, | ||
101 | }, | 132 | }, |
102 | { | 133 | { |
103 | .procname = "max_burst", | 134 | .procname = "max_burst", |
104 | .data = &sctp_max_burst, | 135 | .data = &init_net.sctp.max_burst, |
105 | .maxlen = sizeof(int), | 136 | .maxlen = sizeof(int), |
106 | .mode = 0644, | 137 | .mode = 0644, |
107 | .proc_handler = proc_dointvec_minmax, | 138 | .proc_handler = proc_dointvec_minmax, |
@@ -109,31 +140,42 @@ static ctl_table sctp_table[] = { | |||
109 | .extra2 = &int_max | 140 | .extra2 = &int_max |
110 | }, | 141 | }, |
111 | { | 142 | { |
112 | .procname = "association_max_retrans", | 143 | .procname = "cookie_preserve_enable", |
113 | .data = &sctp_max_retrans_association, | 144 | .data = &init_net.sctp.cookie_preserve_enable, |
114 | .maxlen = sizeof(int), | 145 | .maxlen = sizeof(int), |
115 | .mode = 0644, | 146 | .mode = 0644, |
147 | .proc_handler = proc_dointvec, | ||
148 | }, | ||
149 | { | ||
150 | .procname = "valid_cookie_life", | ||
151 | .data = &init_net.sctp.valid_cookie_life, | ||
152 | .maxlen = sizeof(unsigned int), | ||
153 | .mode = 0644, | ||
116 | .proc_handler = proc_dointvec_minmax, | 154 | .proc_handler = proc_dointvec_minmax, |
117 | .extra1 = &one, | 155 | .extra1 = &one, |
118 | .extra2 = &int_max | 156 | .extra2 = &timer_max |
119 | }, | 157 | }, |
120 | { | 158 | { |
121 | .procname = "sndbuf_policy", | 159 | .procname = "sack_timeout", |
122 | .data = &sctp_sndbuf_policy, | 160 | .data = &init_net.sctp.sack_timeout, |
123 | .maxlen = sizeof(int), | 161 | .maxlen = sizeof(int), |
124 | .mode = 0644, | 162 | .mode = 0644, |
125 | .proc_handler = proc_dointvec, | 163 | .proc_handler = proc_dointvec_minmax, |
164 | .extra1 = &sack_timer_min, | ||
165 | .extra2 = &sack_timer_max, | ||
126 | }, | 166 | }, |
127 | { | 167 | { |
128 | .procname = "rcvbuf_policy", | 168 | .procname = "hb_interval", |
129 | .data = &sctp_rcvbuf_policy, | 169 | .data = &init_net.sctp.hb_interval, |
130 | .maxlen = sizeof(int), | 170 | .maxlen = sizeof(unsigned int), |
131 | .mode = 0644, | 171 | .mode = 0644, |
132 | .proc_handler = proc_dointvec, | 172 | .proc_handler = proc_dointvec_minmax, |
173 | .extra1 = &one, | ||
174 | .extra2 = &timer_max | ||
133 | }, | 175 | }, |
134 | { | 176 | { |
135 | .procname = "path_max_retrans", | 177 | .procname = "association_max_retrans", |
136 | .data = &sctp_max_retrans_path, | 178 | .data = &init_net.sctp.max_retrans_association, |
137 | .maxlen = sizeof(int), | 179 | .maxlen = sizeof(int), |
138 | .mode = 0644, | 180 | .mode = 0644, |
139 | .proc_handler = proc_dointvec_minmax, | 181 | .proc_handler = proc_dointvec_minmax, |
@@ -141,17 +183,17 @@ static ctl_table sctp_table[] = { | |||
141 | .extra2 = &int_max | 183 | .extra2 = &int_max |
142 | }, | 184 | }, |
143 | { | 185 | { |
144 | .procname = "pf_retrans", | 186 | .procname = "path_max_retrans", |
145 | .data = &sctp_pf_retrans, | 187 | .data = &init_net.sctp.max_retrans_path, |
146 | .maxlen = sizeof(int), | 188 | .maxlen = sizeof(int), |
147 | .mode = 0644, | 189 | .mode = 0644, |
148 | .proc_handler = proc_dointvec_minmax, | 190 | .proc_handler = proc_dointvec_minmax, |
149 | .extra1 = &zero, | 191 | .extra1 = &one, |
150 | .extra2 = &int_max | 192 | .extra2 = &int_max |
151 | }, | 193 | }, |
152 | { | 194 | { |
153 | .procname = "max_init_retransmits", | 195 | .procname = "max_init_retransmits", |
154 | .data = &sctp_max_retrans_init, | 196 | .data = &init_net.sctp.max_retrans_init, |
155 | .maxlen = sizeof(int), | 197 | .maxlen = sizeof(int), |
156 | .mode = 0644, | 198 | .mode = 0644, |
157 | .proc_handler = proc_dointvec_minmax, | 199 | .proc_handler = proc_dointvec_minmax, |
@@ -159,103 +201,66 @@ static ctl_table sctp_table[] = { | |||
159 | .extra2 = &int_max | 201 | .extra2 = &int_max |
160 | }, | 202 | }, |
161 | { | 203 | { |
162 | .procname = "hb_interval", | 204 | .procname = "pf_retrans", |
163 | .data = &sctp_hb_interval, | 205 | .data = &init_net.sctp.pf_retrans, |
164 | .maxlen = sizeof(unsigned int), | 206 | .maxlen = sizeof(int), |
165 | .mode = 0644, | 207 | .mode = 0644, |
166 | .proc_handler = proc_dointvec_minmax, | 208 | .proc_handler = proc_dointvec_minmax, |
167 | .extra1 = &one, | 209 | .extra1 = &zero, |
168 | .extra2 = &timer_max | 210 | .extra2 = &int_max |
169 | }, | 211 | }, |
170 | { | 212 | { |
171 | .procname = "cookie_preserve_enable", | 213 | .procname = "sndbuf_policy", |
172 | .data = &sctp_cookie_preserve_enable, | 214 | .data = &init_net.sctp.sndbuf_policy, |
173 | .maxlen = sizeof(int), | 215 | .maxlen = sizeof(int), |
174 | .mode = 0644, | 216 | .mode = 0644, |
175 | .proc_handler = proc_dointvec, | 217 | .proc_handler = proc_dointvec, |
176 | }, | 218 | }, |
177 | { | 219 | { |
178 | .procname = "rto_alpha_exp_divisor", | 220 | .procname = "rcvbuf_policy", |
179 | .data = &sctp_rto_alpha, | 221 | .data = &init_net.sctp.rcvbuf_policy, |
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), | 222 | .maxlen = sizeof(int), |
195 | .mode = 0644, | 223 | .mode = 0644, |
196 | .proc_handler = proc_dointvec, | 224 | .proc_handler = proc_dointvec, |
197 | }, | 225 | }, |
198 | { | 226 | { |
199 | .procname = "default_auto_asconf", | 227 | .procname = "default_auto_asconf", |
200 | .data = &sctp_default_auto_asconf, | 228 | .data = &init_net.sctp.default_auto_asconf, |
201 | .maxlen = sizeof(int), | 229 | .maxlen = sizeof(int), |
202 | .mode = 0644, | 230 | .mode = 0644, |
203 | .proc_handler = proc_dointvec, | 231 | .proc_handler = proc_dointvec, |
204 | }, | 232 | }, |
205 | { | 233 | { |
206 | .procname = "prsctp_enable", | 234 | .procname = "addip_enable", |
207 | .data = &sctp_prsctp_enable, | 235 | .data = &init_net.sctp.addip_enable, |
208 | .maxlen = sizeof(int), | 236 | .maxlen = sizeof(int), |
209 | .mode = 0644, | 237 | .mode = 0644, |
210 | .proc_handler = proc_dointvec, | 238 | .proc_handler = proc_dointvec, |
211 | }, | 239 | }, |
212 | { | 240 | { |
213 | .procname = "sack_timeout", | 241 | .procname = "addip_noauth_enable", |
214 | .data = &sctp_sack_timeout, | 242 | .data = &init_net.sctp.addip_noauth, |
215 | .maxlen = sizeof(int), | 243 | .maxlen = sizeof(int), |
216 | .mode = 0644, | 244 | .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, | 245 | .proc_handler = proc_dointvec, |
241 | }, | 246 | }, |
242 | { | 247 | { |
243 | .procname = "auth_enable", | 248 | .procname = "prsctp_enable", |
244 | .data = &sctp_auth_enable, | 249 | .data = &init_net.sctp.prsctp_enable, |
245 | .maxlen = sizeof(int), | 250 | .maxlen = sizeof(int), |
246 | .mode = 0644, | 251 | .mode = 0644, |
247 | .proc_handler = proc_dointvec, | 252 | .proc_handler = proc_dointvec, |
248 | }, | 253 | }, |
249 | { | 254 | { |
250 | .procname = "addip_noauth_enable", | 255 | .procname = "auth_enable", |
251 | .data = &sctp_addip_noauth, | 256 | .data = &init_net.sctp.auth_enable, |
252 | .maxlen = sizeof(int), | 257 | .maxlen = sizeof(int), |
253 | .mode = 0644, | 258 | .mode = 0644, |
254 | .proc_handler = proc_dointvec, | 259 | .proc_handler = proc_dointvec, |
255 | }, | 260 | }, |
256 | { | 261 | { |
257 | .procname = "addr_scope_policy", | 262 | .procname = "addr_scope_policy", |
258 | .data = &sctp_scope_policy, | 263 | .data = &init_net.sctp.scope_policy, |
259 | .maxlen = sizeof(int), | 264 | .maxlen = sizeof(int), |
260 | .mode = 0644, | 265 | .mode = 0644, |
261 | .proc_handler = proc_dointvec_minmax, | 266 | .proc_handler = proc_dointvec_minmax, |
@@ -264,7 +269,7 @@ static ctl_table sctp_table[] = { | |||
264 | }, | 269 | }, |
265 | { | 270 | { |
266 | .procname = "rwnd_update_shift", | 271 | .procname = "rwnd_update_shift", |
267 | .data = &sctp_rwnd_upd_shift, | 272 | .data = &init_net.sctp.rwnd_upd_shift, |
268 | .maxlen = sizeof(int), | 273 | .maxlen = sizeof(int), |
269 | .mode = 0644, | 274 | .mode = 0644, |
270 | .proc_handler = &proc_dointvec_minmax, | 275 | .proc_handler = &proc_dointvec_minmax, |
@@ -273,7 +278,7 @@ static ctl_table sctp_table[] = { | |||
273 | }, | 278 | }, |
274 | { | 279 | { |
275 | .procname = "max_autoclose", | 280 | .procname = "max_autoclose", |
276 | .data = &sctp_max_autoclose, | 281 | .data = &init_net.sctp.max_autoclose, |
277 | .maxlen = sizeof(unsigned long), | 282 | .maxlen = sizeof(unsigned long), |
278 | .mode = 0644, | 283 | .mode = 0644, |
279 | .proc_handler = &proc_doulongvec_minmax, | 284 | .proc_handler = &proc_doulongvec_minmax, |
@@ -284,6 +289,27 @@ static ctl_table sctp_table[] = { | |||
284 | { /* sentinel */ } | 289 | { /* sentinel */ } |
285 | }; | 290 | }; |
286 | 291 | ||
292 | int sctp_sysctl_net_register(struct net *net) | ||
293 | { | ||
294 | struct ctl_table *table; | ||
295 | int i; | ||
296 | |||
297 | table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL); | ||
298 | if (!table) | ||
299 | return -ENOMEM; | ||
300 | |||
301 | for (i = 0; table[i].data; i++) | ||
302 | table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp; | ||
303 | |||
304 | net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table); | ||
305 | return 0; | ||
306 | } | ||
307 | |||
308 | void sctp_sysctl_net_unregister(struct net *net) | ||
309 | { | ||
310 | unregister_net_sysctl_table(net->sctp.sysctl_header); | ||
311 | } | ||
312 | |||
287 | static struct ctl_table_header * sctp_sysctl_header; | 313 | static struct ctl_table_header * sctp_sysctl_header; |
288 | 314 | ||
289 | /* Sysctl registration. */ | 315 | /* Sysctl registration. */ |