blob: c9ed50382ea7bb067766173207bafbade894f984 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * Copyright (C) 1996 Mike Shaver (shaver@zeroknowledge.com)
8 */
9#include <linux/mm.h>
10#include <linux/sysctl.h>
11#include <linux/init.h>
12#include <net/ax25.h>
13#include <net/netrom.h>
14
15/*
16 * Values taken from NET/ROM documentation.
17 */
18static int min_quality[] = {0}, max_quality[] = {255};
19static int min_obs[] = {0}, max_obs[] = {255};
20static int min_ttl[] = {0}, max_ttl[] = {255};
21static int min_t1[] = {5 * HZ};
22static int max_t1[] = {600 * HZ};
23static int min_n2[] = {2}, max_n2[] = {127};
24static int min_t2[] = {1 * HZ};
25static int max_t2[] = {60 * HZ};
26static int min_t4[] = {1 * HZ};
27static int max_t4[] = {1000 * HZ};
28static int min_window[] = {1}, max_window[] = {127};
29static int min_idle[] = {0 * HZ};
30static int max_idle[] = {65535 * HZ};
31static int min_route[] = {0}, max_route[] = {1};
32static int min_fails[] = {1}, max_fails[] = {10};
33
34static struct ctl_table_header *nr_table_header;
35
36static ctl_table nr_table[] = {
37 {
38 .ctl_name = NET_NETROM_DEFAULT_PATH_QUALITY,
39 .procname = "default_path_quality",
40 .data = &sysctl_netrom_default_path_quality,
41 .maxlen = sizeof(int),
42 .mode = 0644,
43 .proc_handler = &proc_dointvec_minmax,
44 .strategy = &sysctl_intvec,
45 .extra1 = &min_quality,
46 .extra2 = &max_quality
47 },
48 {
49 .ctl_name = NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER,
50 .procname = "obsolescence_count_initialiser",
51 .data = &sysctl_netrom_obsolescence_count_initialiser,
52 .maxlen = sizeof(int),
53 .mode = 0644,
54 .proc_handler = &proc_dointvec_minmax,
55 .strategy = &sysctl_intvec,
56 .extra1 = &min_obs,
57 .extra2 = &max_obs
58 },
59 {
60 .ctl_name = NET_NETROM_NETWORK_TTL_INITIALISER,
61 .procname = "network_ttl_initialiser",
62 .data = &sysctl_netrom_network_ttl_initialiser,
63 .maxlen = sizeof(int),
64 .mode = 0644,
65 .proc_handler = &proc_dointvec_minmax,
66 .strategy = &sysctl_intvec,
67 .extra1 = &min_ttl,
68 .extra2 = &max_ttl
69 },
70 {
71 .ctl_name = NET_NETROM_TRANSPORT_TIMEOUT,
72 .procname = "transport_timeout",
73 .data = &sysctl_netrom_transport_timeout,
74 .maxlen = sizeof(int),
75 .mode = 0644,
76 .proc_handler = &proc_dointvec_minmax,
77 .strategy = &sysctl_intvec,
78 .extra1 = &min_t1,
79 .extra2 = &max_t1
80 },
81 {
82 .ctl_name = NET_NETROM_TRANSPORT_MAXIMUM_TRIES,
83 .procname = "transport_maximum_tries",
84 .data = &sysctl_netrom_transport_maximum_tries,
85 .maxlen = sizeof(int),
86 .mode = 0644,
87 .proc_handler = &proc_dointvec_minmax,
88 .strategy = &sysctl_intvec,
89 .extra1 = &min_n2,
90 .extra2 = &max_n2
91 },
92 {
93 .ctl_name = NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY,
94 .procname = "transport_acknowledge_delay",
95 .data = &sysctl_netrom_transport_acknowledge_delay,
96 .maxlen = sizeof(int),
97 .mode = 0644,
98 .proc_handler = &proc_dointvec_minmax,
99 .strategy = &sysctl_intvec,
100 .extra1 = &min_t2,
101 .extra2 = &max_t2
102 },
103 {
104 .ctl_name = NET_NETROM_TRANSPORT_BUSY_DELAY,
105 .procname = "transport_busy_delay",
106 .data = &sysctl_netrom_transport_busy_delay,
107 .maxlen = sizeof(int),
108 .mode = 0644,
109 .proc_handler = &proc_dointvec_minmax,
110 .strategy = &sysctl_intvec,
111 .extra1 = &min_t4,
112 .extra2 = &max_t4
113 },
114 {
115 .ctl_name = NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE,
116 .procname = "transport_requested_window_size",
117 .data = &sysctl_netrom_transport_requested_window_size,
118 .maxlen = sizeof(int),
119 .mode = 0644,
120 .proc_handler = &proc_dointvec_minmax,
121 .strategy = &sysctl_intvec,
122 .extra1 = &min_window,
123 .extra2 = &max_window
124 },
125 {
126 .ctl_name = NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT,
127 .procname = "transport_no_activity_timeout",
128 .data = &sysctl_netrom_transport_no_activity_timeout,
129 .maxlen = sizeof(int),
130 .mode = 0644,
131 .proc_handler = &proc_dointvec_minmax,
132 .strategy = &sysctl_intvec,
133 .extra1 = &min_idle,
134 .extra2 = &max_idle
135 },
136 {
137 .ctl_name = NET_NETROM_ROUTING_CONTROL,
138 .procname = "routing_control",
139 .data = &sysctl_netrom_routing_control,
140 .maxlen = sizeof(int),
141 .mode = 0644,
142 .proc_handler = &proc_dointvec_minmax,
143 .strategy = &sysctl_intvec,
144 .extra1 = &min_route,
145 .extra2 = &max_route
146 },
147 {
148 .ctl_name = NET_NETROM_LINK_FAILS_COUNT,
149 .procname = "link_fails_count",
150 .data = &sysctl_netrom_link_fails_count,
151 .maxlen = sizeof(int),
152 .mode = 0644,
153 .proc_handler = &proc_dointvec_minmax,
154 .strategy = &sysctl_intvec,
155 .extra1 = &min_fails,
156 .extra2 = &max_fails
157 },
158 { .ctl_name = 0 }
159};
160
161static ctl_table nr_dir_table[] = {
162 {
163 .ctl_name = NET_NETROM,
164 .procname = "netrom",
165 .mode = 0555,
166 .child = nr_table
167 },
168 { .ctl_name = 0 }
169};
170
171static ctl_table nr_root_table[] = {
172 {
173 .ctl_name = CTL_NET,
174 .procname = "net",
175 .mode = 0555,
176 .child = nr_dir_table
177 },
178 { .ctl_name = 0 }
179};
180
181void __init nr_register_sysctl(void)
182{
183 nr_table_header = register_sysctl_table(nr_root_table, 1);
184}
185
186void nr_unregister_sysctl(void)
187{
188 unregister_sysctl_table(nr_table_header);
189}