1 /* -*- linux-c -*-
2  * sysctl_net_netrom.c: sysctl interface to net NET/ROM subsystem.
3  *
4  * Begun April 1, 1996, Mike Shaver.
5  * Added /proc/sys/net/netrom directory entry (empty =) ). [MS]
6  */
7 
8 #include <linux/mm.h>
9 #include <linux/sysctl.h>
10 #include <linux/init.h>
11 #include <net/ax25.h>
12 #include <net/netrom.h>
13 
14 /*
15  *	Values taken from NET/ROM documentation.
16  */
17 static int min_quality[] = {0}, max_quality[] = {255};
18 static int min_obs[]     = {0}, max_obs[]     = {255};
19 static int min_ttl[]     = {0}, max_ttl[]     = {255};
20 static int min_t1[]      = {5 * HZ};
21 static int max_t1[]      = {600 * HZ};
22 static int min_n2[]      = {2}, max_n2[]      = {127};
23 static int min_t2[]      = {1 * HZ};
24 static int max_t2[]      = {60 * HZ};
25 static int min_t4[]      = {1 * HZ};
26 static int max_t4[]      = {1000 * HZ};
27 static int min_window[]  = {1}, max_window[]  = {127};
28 static int min_idle[]    = {0 * HZ};
29 static int max_idle[]    = {65535 * HZ};
30 static int min_route[]   = {0}, max_route[]   = {1};
31 static int min_fails[]   = {1}, max_fails[]   = {10};
32 
33 static struct ctl_table_header *nr_table_header;
34 
35 static ctl_table nr_table[] = {
36         {NET_NETROM_DEFAULT_PATH_QUALITY, "default_path_quality",
37          &sysctl_netrom_default_path_quality, sizeof(int), 0644, NULL,
38          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_quality, &max_quality},
39         {NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER, "obsolescence_count_initialiser",
40          &sysctl_netrom_obsolescence_count_initialiser, sizeof(int), 0644, NULL,
41          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_obs, &max_obs},
42         {NET_NETROM_NETWORK_TTL_INITIALISER, "network_ttl_initialiser",
43          &sysctl_netrom_network_ttl_initialiser, sizeof(int), 0644, NULL,
44          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_ttl, &max_ttl},
45         {NET_NETROM_TRANSPORT_TIMEOUT, "transport_timeout",
46          &sysctl_netrom_transport_timeout, sizeof(int), 0644, NULL,
47          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_t1, &max_t1},
48         {NET_NETROM_TRANSPORT_MAXIMUM_TRIES, "transport_maximum_tries",
49          &sysctl_netrom_transport_maximum_tries, sizeof(int), 0644, NULL,
50          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_n2, &max_n2},
51         {NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY, "transport_acknowledge_delay",
52          &sysctl_netrom_transport_acknowledge_delay, sizeof(int), 0644, NULL,
53          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_t2, &max_t2},
54         {NET_NETROM_TRANSPORT_BUSY_DELAY, "transport_busy_delay",
55          &sysctl_netrom_transport_busy_delay, sizeof(int), 0644, NULL,
56          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_t4, &max_t4},
57         {NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE, "transport_requested_window_size",
58          &sysctl_netrom_transport_requested_window_size, sizeof(int), 0644, NULL,
59          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_window, &max_window},
60         {NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT, "transport_no_activity_timeout",
61          &sysctl_netrom_transport_no_activity_timeout, sizeof(int), 0644, NULL,
62          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_idle, &max_idle},
63         {NET_NETROM_ROUTING_CONTROL, "routing_control",
64          &sysctl_netrom_routing_control, sizeof(int), 0644, NULL,
65          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_route, &max_route},
66         {NET_NETROM_LINK_FAILS_COUNT, "link_fails_count",
67          &sysctl_netrom_link_fails_count, sizeof(int), 0644, NULL,
68          &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_fails, &max_fails},
69 	{0}
70 };
71 
72 static ctl_table nr_dir_table[] = {
73 	{NET_NETROM, "netrom", NULL, 0, 0555, nr_table},
74 	{0}
75 };
76 
77 static ctl_table nr_root_table[] = {
78 	{CTL_NET, "net", NULL, 0, 0555, nr_dir_table},
79 	{0}
80 };
81 
nr_register_sysctl(void)82 void __init nr_register_sysctl(void)
83 {
84 	nr_table_header = register_sysctl_table(nr_root_table, 1);
85 }
86 
nr_unregister_sysctl(void)87 void nr_unregister_sysctl(void)
88 {
89 	unregister_sysctl_table(nr_table_header);
90 }
91