Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* -*- linux-c -*- |
| 2 | * sysctl_net_x25.c: sysctl interface to net X.25 subsystem. |
| 3 | * |
| 4 | * Begun April 1, 1996, Mike Shaver. |
| 5 | * Added /proc/sys/net/x25 directory entry (empty =) ). [MS] |
| 6 | */ |
| 7 | |
| 8 | #include <linux/sysctl.h> |
| 9 | #include <linux/skbuff.h> |
| 10 | #include <linux/socket.h> |
| 11 | #include <linux/netdevice.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <net/x25.h> |
| 14 | |
| 15 | static int min_timer[] = { 1 * HZ }; |
| 16 | static int max_timer[] = { 300 * HZ }; |
| 17 | |
| 18 | static struct ctl_table_header *x25_table_header; |
| 19 | |
| 20 | static struct ctl_table x25_table[] = { |
YOSHIFUJI Hideaki | f8e1d201 | 2007-02-09 23:25:27 +0900 | [diff] [blame] | 21 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | .procname = "restart_request_timeout", |
| 23 | .data = &sysctl_x25_restart_request_timeout, |
| 24 | .maxlen = sizeof(int), |
| 25 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 26 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | .extra1 = &min_timer, |
| 28 | .extra2 = &max_timer, |
| 29 | }, |
YOSHIFUJI Hideaki | f8e1d201 | 2007-02-09 23:25:27 +0900 | [diff] [blame] | 30 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | .procname = "call_request_timeout", |
| 32 | .data = &sysctl_x25_call_request_timeout, |
| 33 | .maxlen = sizeof(int), |
| 34 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 35 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | .extra1 = &min_timer, |
| 37 | .extra2 = &max_timer, |
| 38 | }, |
YOSHIFUJI Hideaki | f8e1d201 | 2007-02-09 23:25:27 +0900 | [diff] [blame] | 39 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | .procname = "reset_request_timeout", |
| 41 | .data = &sysctl_x25_reset_request_timeout, |
| 42 | .maxlen = sizeof(int), |
| 43 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 44 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | .extra1 = &min_timer, |
| 46 | .extra2 = &max_timer, |
| 47 | }, |
YOSHIFUJI Hideaki | f8e1d201 | 2007-02-09 23:25:27 +0900 | [diff] [blame] | 48 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | .procname = "clear_request_timeout", |
| 50 | .data = &sysctl_x25_clear_request_timeout, |
| 51 | .maxlen = sizeof(int), |
| 52 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 53 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | .extra1 = &min_timer, |
| 55 | .extra2 = &max_timer, |
| 56 | }, |
YOSHIFUJI Hideaki | f8e1d201 | 2007-02-09 23:25:27 +0900 | [diff] [blame] | 57 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | .procname = "acknowledgement_hold_back_timeout", |
| 59 | .data = &sysctl_x25_ack_holdback_timeout, |
| 60 | .maxlen = sizeof(int), |
| 61 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 62 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | .extra1 = &min_timer, |
| 64 | .extra2 = &max_timer, |
| 65 | }, |
Andrew Hendry | 39e21c0 | 2007-02-08 13:34:36 -0800 | [diff] [blame] | 66 | { |
Andrew Hendry | 39e21c0 | 2007-02-08 13:34:36 -0800 | [diff] [blame] | 67 | .procname = "x25_forward", |
| 68 | .data = &sysctl_x25_forward, |
| 69 | .maxlen = sizeof(int), |
| 70 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 71 | .proc_handler = proc_dointvec, |
Andrew Hendry | 39e21c0 | 2007-02-08 13:34:36 -0800 | [diff] [blame] | 72 | }, |
Kees Cook | e999cb4 | 2016-12-16 17:03:39 -0800 | [diff] [blame] | 73 | { }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | }; |
| 75 | |
linzhang | 64df6d5 | 2017-05-17 12:05:07 +0800 | [diff] [blame] | 76 | int __init x25_register_sysctl(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | { |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 78 | x25_table_header = register_net_sysctl(&init_net, "net/x25", x25_table); |
linzhang | 64df6d5 | 2017-05-17 12:05:07 +0800 | [diff] [blame] | 79 | if (!x25_table_header) |
| 80 | return -ENOMEM; |
| 81 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | void x25_unregister_sysctl(void) |
| 85 | { |
Eric W. Biederman | 5dd3df1 | 2012-04-19 13:24:33 +0000 | [diff] [blame] | 86 | unregister_net_sysctl_table(x25_table_header); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | } |