diff options
Diffstat (limited to 'net/decnet/sysctl_net_decnet.c')
-rw-r--r-- | net/decnet/sysctl_net_decnet.c | 124 |
1 files changed, 3 insertions, 121 deletions
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index 26b0ab1e9f56..be3eb8e23288 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c | |||
@@ -131,39 +131,6 @@ static int parse_addr(__le16 *addr, char *str) | |||
131 | return 0; | 131 | return 0; |
132 | } | 132 | } |
133 | 133 | ||
134 | |||
135 | static int dn_node_address_strategy(ctl_table *table, | ||
136 | void __user *oldval, size_t __user *oldlenp, | ||
137 | void __user *newval, size_t newlen) | ||
138 | { | ||
139 | size_t len; | ||
140 | __le16 addr; | ||
141 | |||
142 | if (oldval && oldlenp) { | ||
143 | if (get_user(len, oldlenp)) | ||
144 | return -EFAULT; | ||
145 | if (len) { | ||
146 | if (len != sizeof(unsigned short)) | ||
147 | return -EINVAL; | ||
148 | if (put_user(decnet_address, (__le16 __user *)oldval)) | ||
149 | return -EFAULT; | ||
150 | } | ||
151 | } | ||
152 | if (newval && newlen) { | ||
153 | if (newlen != sizeof(unsigned short)) | ||
154 | return -EINVAL; | ||
155 | if (get_user(addr, (__le16 __user *)newval)) | ||
156 | return -EFAULT; | ||
157 | |||
158 | dn_dev_devices_off(); | ||
159 | |||
160 | decnet_address = addr; | ||
161 | |||
162 | dn_dev_devices_on(); | ||
163 | } | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | static int dn_node_address_handler(ctl_table *table, int write, | 134 | static int dn_node_address_handler(ctl_table *table, int write, |
168 | void __user *buffer, | 135 | void __user *buffer, |
169 | size_t *lenp, loff_t *ppos) | 136 | size_t *lenp, loff_t *ppos) |
@@ -215,65 +182,6 @@ static int dn_node_address_handler(ctl_table *table, int write, | |||
215 | return 0; | 182 | return 0; |
216 | } | 183 | } |
217 | 184 | ||
218 | |||
219 | static int dn_def_dev_strategy(ctl_table *table, | ||
220 | void __user *oldval, size_t __user *oldlenp, | ||
221 | void __user *newval, size_t newlen) | ||
222 | { | ||
223 | size_t len; | ||
224 | struct net_device *dev; | ||
225 | char devname[17]; | ||
226 | size_t namel; | ||
227 | int rv = 0; | ||
228 | |||
229 | devname[0] = 0; | ||
230 | |||
231 | if (oldval && oldlenp) { | ||
232 | if (get_user(len, oldlenp)) | ||
233 | return -EFAULT; | ||
234 | if (len) { | ||
235 | dev = dn_dev_get_default(); | ||
236 | if (dev) { | ||
237 | strcpy(devname, dev->name); | ||
238 | dev_put(dev); | ||
239 | } | ||
240 | |||
241 | namel = strlen(devname) + 1; | ||
242 | if (len > namel) len = namel; | ||
243 | |||
244 | if (copy_to_user(oldval, devname, len)) | ||
245 | return -EFAULT; | ||
246 | |||
247 | if (put_user(len, oldlenp)) | ||
248 | return -EFAULT; | ||
249 | } | ||
250 | } | ||
251 | |||
252 | if (newval && newlen) { | ||
253 | if (newlen > 16) | ||
254 | return -E2BIG; | ||
255 | |||
256 | if (copy_from_user(devname, newval, newlen)) | ||
257 | return -EFAULT; | ||
258 | |||
259 | devname[newlen] = 0; | ||
260 | |||
261 | dev = dev_get_by_name(&init_net, devname); | ||
262 | if (dev == NULL) | ||
263 | return -ENODEV; | ||
264 | |||
265 | rv = -ENODEV; | ||
266 | if (dev->dn_ptr != NULL) { | ||
267 | rv = dn_dev_set_default(dev, 1); | ||
268 | if (rv) | ||
269 | dev_put(dev); | ||
270 | } | ||
271 | } | ||
272 | |||
273 | return rv; | ||
274 | } | ||
275 | |||
276 | |||
277 | static int dn_def_dev_handler(ctl_table *table, int write, | 185 | static int dn_def_dev_handler(ctl_table *table, int write, |
278 | void __user *buffer, | 186 | void __user *buffer, |
279 | size_t *lenp, loff_t *ppos) | 187 | size_t *lenp, loff_t *ppos) |
@@ -339,138 +247,112 @@ static int dn_def_dev_handler(ctl_table *table, int write, | |||
339 | 247 | ||
340 | static ctl_table dn_table[] = { | 248 | static ctl_table dn_table[] = { |
341 | { | 249 | { |
342 | .ctl_name = NET_DECNET_NODE_ADDRESS, | ||
343 | .procname = "node_address", | 250 | .procname = "node_address", |
344 | .maxlen = 7, | 251 | .maxlen = 7, |
345 | .mode = 0644, | 252 | .mode = 0644, |
346 | .proc_handler = dn_node_address_handler, | 253 | .proc_handler = dn_node_address_handler, |
347 | .strategy = dn_node_address_strategy, | ||
348 | }, | 254 | }, |
349 | { | 255 | { |
350 | .ctl_name = NET_DECNET_NODE_NAME, | ||
351 | .procname = "node_name", | 256 | .procname = "node_name", |
352 | .data = node_name, | 257 | .data = node_name, |
353 | .maxlen = 7, | 258 | .maxlen = 7, |
354 | .mode = 0644, | 259 | .mode = 0644, |
355 | .proc_handler = proc_dostring, | 260 | .proc_handler = proc_dostring, |
356 | .strategy = sysctl_string, | ||
357 | }, | 261 | }, |
358 | { | 262 | { |
359 | .ctl_name = NET_DECNET_DEFAULT_DEVICE, | ||
360 | .procname = "default_device", | 263 | .procname = "default_device", |
361 | .maxlen = 16, | 264 | .maxlen = 16, |
362 | .mode = 0644, | 265 | .mode = 0644, |
363 | .proc_handler = dn_def_dev_handler, | 266 | .proc_handler = dn_def_dev_handler, |
364 | .strategy = dn_def_dev_strategy, | ||
365 | }, | 267 | }, |
366 | { | 268 | { |
367 | .ctl_name = NET_DECNET_TIME_WAIT, | ||
368 | .procname = "time_wait", | 269 | .procname = "time_wait", |
369 | .data = &decnet_time_wait, | 270 | .data = &decnet_time_wait, |
370 | .maxlen = sizeof(int), | 271 | .maxlen = sizeof(int), |
371 | .mode = 0644, | 272 | .mode = 0644, |
372 | .proc_handler = proc_dointvec_minmax, | 273 | .proc_handler = proc_dointvec_minmax, |
373 | .strategy = sysctl_intvec, | ||
374 | .extra1 = &min_decnet_time_wait, | 274 | .extra1 = &min_decnet_time_wait, |
375 | .extra2 = &max_decnet_time_wait | 275 | .extra2 = &max_decnet_time_wait |
376 | }, | 276 | }, |
377 | { | 277 | { |
378 | .ctl_name = NET_DECNET_DN_COUNT, | ||
379 | .procname = "dn_count", | 278 | .procname = "dn_count", |
380 | .data = &decnet_dn_count, | 279 | .data = &decnet_dn_count, |
381 | .maxlen = sizeof(int), | 280 | .maxlen = sizeof(int), |
382 | .mode = 0644, | 281 | .mode = 0644, |
383 | .proc_handler = proc_dointvec_minmax, | 282 | .proc_handler = proc_dointvec_minmax, |
384 | .strategy = sysctl_intvec, | ||
385 | .extra1 = &min_state_count, | 283 | .extra1 = &min_state_count, |
386 | .extra2 = &max_state_count | 284 | .extra2 = &max_state_count |
387 | }, | 285 | }, |
388 | { | 286 | { |
389 | .ctl_name = NET_DECNET_DI_COUNT, | ||
390 | .procname = "di_count", | 287 | .procname = "di_count", |
391 | .data = &decnet_di_count, | 288 | .data = &decnet_di_count, |
392 | .maxlen = sizeof(int), | 289 | .maxlen = sizeof(int), |
393 | .mode = 0644, | 290 | .mode = 0644, |
394 | .proc_handler = proc_dointvec_minmax, | 291 | .proc_handler = proc_dointvec_minmax, |
395 | .strategy = sysctl_intvec, | ||
396 | .extra1 = &min_state_count, | 292 | .extra1 = &min_state_count, |
397 | .extra2 = &max_state_count | 293 | .extra2 = &max_state_count |
398 | }, | 294 | }, |
399 | { | 295 | { |
400 | .ctl_name = NET_DECNET_DR_COUNT, | ||
401 | .procname = "dr_count", | 296 | .procname = "dr_count", |
402 | .data = &decnet_dr_count, | 297 | .data = &decnet_dr_count, |
403 | .maxlen = sizeof(int), | 298 | .maxlen = sizeof(int), |
404 | .mode = 0644, | 299 | .mode = 0644, |
405 | .proc_handler = proc_dointvec_minmax, | 300 | .proc_handler = proc_dointvec_minmax, |
406 | .strategy = sysctl_intvec, | ||
407 | .extra1 = &min_state_count, | 301 | .extra1 = &min_state_count, |
408 | .extra2 = &max_state_count | 302 | .extra2 = &max_state_count |
409 | }, | 303 | }, |
410 | { | 304 | { |
411 | .ctl_name = NET_DECNET_DST_GC_INTERVAL, | ||
412 | .procname = "dst_gc_interval", | 305 | .procname = "dst_gc_interval", |
413 | .data = &decnet_dst_gc_interval, | 306 | .data = &decnet_dst_gc_interval, |
414 | .maxlen = sizeof(int), | 307 | .maxlen = sizeof(int), |
415 | .mode = 0644, | 308 | .mode = 0644, |
416 | .proc_handler = proc_dointvec_minmax, | 309 | .proc_handler = proc_dointvec_minmax, |
417 | .strategy = sysctl_intvec, | ||
418 | .extra1 = &min_decnet_dst_gc_interval, | 310 | .extra1 = &min_decnet_dst_gc_interval, |
419 | .extra2 = &max_decnet_dst_gc_interval | 311 | .extra2 = &max_decnet_dst_gc_interval |
420 | }, | 312 | }, |
421 | { | 313 | { |
422 | .ctl_name = NET_DECNET_NO_FC_MAX_CWND, | ||
423 | .procname = "no_fc_max_cwnd", | 314 | .procname = "no_fc_max_cwnd", |
424 | .data = &decnet_no_fc_max_cwnd, | 315 | .data = &decnet_no_fc_max_cwnd, |
425 | .maxlen = sizeof(int), | 316 | .maxlen = sizeof(int), |
426 | .mode = 0644, | 317 | .mode = 0644, |
427 | .proc_handler = proc_dointvec_minmax, | 318 | .proc_handler = proc_dointvec_minmax, |
428 | .strategy = sysctl_intvec, | ||
429 | .extra1 = &min_decnet_no_fc_max_cwnd, | 319 | .extra1 = &min_decnet_no_fc_max_cwnd, |
430 | .extra2 = &max_decnet_no_fc_max_cwnd | 320 | .extra2 = &max_decnet_no_fc_max_cwnd |
431 | }, | 321 | }, |
432 | { | 322 | { |
433 | .ctl_name = NET_DECNET_MEM, | ||
434 | .procname = "decnet_mem", | 323 | .procname = "decnet_mem", |
435 | .data = &sysctl_decnet_mem, | 324 | .data = &sysctl_decnet_mem, |
436 | .maxlen = sizeof(sysctl_decnet_mem), | 325 | .maxlen = sizeof(sysctl_decnet_mem), |
437 | .mode = 0644, | 326 | .mode = 0644, |
438 | .proc_handler = proc_dointvec, | 327 | .proc_handler = proc_dointvec, |
439 | .strategy = sysctl_intvec, | ||
440 | }, | 328 | }, |
441 | { | 329 | { |
442 | .ctl_name = NET_DECNET_RMEM, | ||
443 | .procname = "decnet_rmem", | 330 | .procname = "decnet_rmem", |
444 | .data = &sysctl_decnet_rmem, | 331 | .data = &sysctl_decnet_rmem, |
445 | .maxlen = sizeof(sysctl_decnet_rmem), | 332 | .maxlen = sizeof(sysctl_decnet_rmem), |
446 | .mode = 0644, | 333 | .mode = 0644, |
447 | .proc_handler = proc_dointvec, | 334 | .proc_handler = proc_dointvec, |
448 | .strategy = sysctl_intvec, | ||
449 | }, | 335 | }, |
450 | { | 336 | { |
451 | .ctl_name = NET_DECNET_WMEM, | ||
452 | .procname = "decnet_wmem", | 337 | .procname = "decnet_wmem", |
453 | .data = &sysctl_decnet_wmem, | 338 | .data = &sysctl_decnet_wmem, |
454 | .maxlen = sizeof(sysctl_decnet_wmem), | 339 | .maxlen = sizeof(sysctl_decnet_wmem), |
455 | .mode = 0644, | 340 | .mode = 0644, |
456 | .proc_handler = proc_dointvec, | 341 | .proc_handler = proc_dointvec, |
457 | .strategy = sysctl_intvec, | ||
458 | }, | 342 | }, |
459 | { | 343 | { |
460 | .ctl_name = NET_DECNET_DEBUG_LEVEL, | ||
461 | .procname = "debug", | 344 | .procname = "debug", |
462 | .data = &decnet_debug_level, | 345 | .data = &decnet_debug_level, |
463 | .maxlen = sizeof(int), | 346 | .maxlen = sizeof(int), |
464 | .mode = 0644, | 347 | .mode = 0644, |
465 | .proc_handler = proc_dointvec, | 348 | .proc_handler = proc_dointvec, |
466 | .strategy = sysctl_intvec, | ||
467 | }, | 349 | }, |
468 | {0} | 350 | { } |
469 | }; | 351 | }; |
470 | 352 | ||
471 | static struct ctl_path dn_path[] = { | 353 | static struct ctl_path dn_path[] = { |
472 | { .procname = "net", .ctl_name = CTL_NET, }, | 354 | { .procname = "net", }, |
473 | { .procname = "decnet", .ctl_name = NET_DECNET, }, | 355 | { .procname = "decnet", }, |
474 | { } | 356 | { } |
475 | }; | 357 | }; |
476 | 358 | ||