blob: ba078c85f0a1533ffbbadef1ab5789399dd1528a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* -*- 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
15static int min_timer[] = { 1 * HZ };
16static int max_timer[] = { 300 * HZ };
17
18static struct ctl_table_header *x25_table_header;
19
20static struct ctl_table x25_table[] = {
YOSHIFUJI Hideakif8e1d2012007-02-09 23:25:27 +090021 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 .procname = "restart_request_timeout",
23 .data = &sysctl_x25_restart_request_timeout,
24 .maxlen = sizeof(int),
25 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080026 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 .extra1 = &min_timer,
28 .extra2 = &max_timer,
29 },
YOSHIFUJI Hideakif8e1d2012007-02-09 23:25:27 +090030 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 .procname = "call_request_timeout",
32 .data = &sysctl_x25_call_request_timeout,
33 .maxlen = sizeof(int),
34 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080035 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 .extra1 = &min_timer,
37 .extra2 = &max_timer,
38 },
YOSHIFUJI Hideakif8e1d2012007-02-09 23:25:27 +090039 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 .procname = "reset_request_timeout",
41 .data = &sysctl_x25_reset_request_timeout,
42 .maxlen = sizeof(int),
43 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080044 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 .extra1 = &min_timer,
46 .extra2 = &max_timer,
47 },
YOSHIFUJI Hideakif8e1d2012007-02-09 23:25:27 +090048 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 .procname = "clear_request_timeout",
50 .data = &sysctl_x25_clear_request_timeout,
51 .maxlen = sizeof(int),
52 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080053 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 .extra1 = &min_timer,
55 .extra2 = &max_timer,
56 },
YOSHIFUJI Hideakif8e1d2012007-02-09 23:25:27 +090057 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 .procname = "acknowledgement_hold_back_timeout",
59 .data = &sysctl_x25_ack_holdback_timeout,
60 .maxlen = sizeof(int),
61 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080062 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 .extra1 = &min_timer,
64 .extra2 = &max_timer,
65 },
Andrew Hendry39e21c02007-02-08 13:34:36 -080066 {
Andrew Hendry39e21c02007-02-08 13:34:36 -080067 .procname = "x25_forward",
68 .data = &sysctl_x25_forward,
69 .maxlen = sizeof(int),
70 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080071 .proc_handler = proc_dointvec,
Andrew Hendry39e21c02007-02-08 13:34:36 -080072 },
Kees Cooke999cb42016-12-16 17:03:39 -080073 { },
Linus Torvalds1da177e2005-04-16 15:20:36 -070074};
75
linzhang64df6d52017-05-17 12:05:07 +080076int __init x25_register_sysctl(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070077{
Eric W. Biedermanec8f23c2012-04-19 13:44:49 +000078 x25_table_header = register_net_sysctl(&init_net, "net/x25", x25_table);
linzhang64df6d52017-05-17 12:05:07 +080079 if (!x25_table_header)
80 return -ENOMEM;
81 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070082}
83
84void x25_unregister_sysctl(void)
85{
Eric W. Biederman5dd3df12012-04-19 13:24:33 +000086 unregister_net_sysctl_table(x25_table_header);
Linus Torvalds1da177e2005-04-16 15:20:36 -070087}