1 |
199 |
simons |
/* -*- linux-c -*-
|
2 |
|
|
* sysctl_net_ax25.c: sysctl interface to net AX.25 subsystem.
|
3 |
|
|
*
|
4 |
|
|
* Begun April 1, 1996, Mike Shaver.
|
5 |
|
|
* Added /proc/sys/net/ax25 directory entry (empty =) ). [MS]
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
#include <linux/mm.h>
|
9 |
|
|
#include <linux/sysctl.h>
|
10 |
|
|
#include <net/ax25.h>
|
11 |
|
|
|
12 |
|
|
static int min_ipdefmode[] = {0}, max_ipdefmode[] = {1};
|
13 |
|
|
static int min_axdefmode[] = {0}, max_axdefmode[] = {1};
|
14 |
|
|
static int min_backoff[] = {0}, max_backoff[] = {2};
|
15 |
|
|
static int min_conmode[] = {0}, max_conmode[] = {2};
|
16 |
|
|
static int min_window[] = {1}, max_window[] = {7};
|
17 |
|
|
static int min_ewindow[] = {1}, max_ewindow[] = {63};
|
18 |
|
|
static int min_t1[] = {1}, max_t1[] = {30 * AX25_SLOWHZ};
|
19 |
|
|
static int min_t2[] = {1}, max_t2[] = {20 * AX25_SLOWHZ};
|
20 |
|
|
static int min_t3[] = {0}, max_t3[] = {3600 * AX25_SLOWHZ};
|
21 |
|
|
static int min_idle[] = {0}, max_idle[] = {65535 * AX25_SLOWHZ};
|
22 |
|
|
static int min_n2[] = {1}, max_n2[] = {31};
|
23 |
|
|
static int min_paclen[] = {1}, max_paclen[] = {512};
|
24 |
|
|
|
25 |
|
|
static struct ctl_table_header *ax25_table_header;
|
26 |
|
|
|
27 |
|
|
static ctl_table ax25_table[AX25_MAX_DEVICES + 1];
|
28 |
|
|
|
29 |
|
|
static ctl_table ax25_dir_table[] = {
|
30 |
|
|
{NET_AX25, "ax25", NULL, 0, 0555, ax25_table},
|
31 |
|
|
{0}
|
32 |
|
|
};
|
33 |
|
|
|
34 |
|
|
static ctl_table ax25_root_table[] = {
|
35 |
|
|
{CTL_NET, "net", NULL, 0, 0555, ax25_dir_table},
|
36 |
|
|
{0}
|
37 |
|
|
};
|
38 |
|
|
|
39 |
|
|
static const ctl_table ax25_param_table[] = {
|
40 |
|
|
{NET_AX25_IP_DEFAULT_MODE, "ip_default_mode",
|
41 |
|
|
NULL, sizeof(int), 0644, NULL,
|
42 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
43 |
|
|
&min_ipdefmode, &max_ipdefmode},
|
44 |
|
|
{NET_AX25_DEFAULT_MODE, "ax25_default_mode",
|
45 |
|
|
NULL, sizeof(int), 0644, NULL,
|
46 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
47 |
|
|
&min_axdefmode, &max_axdefmode},
|
48 |
|
|
{NET_AX25_BACKOFF_TYPE, "backoff_type",
|
49 |
|
|
NULL, sizeof(int), 0644, NULL,
|
50 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
51 |
|
|
&min_backoff, &max_backoff},
|
52 |
|
|
{NET_AX25_CONNECT_MODE, "connect_mode",
|
53 |
|
|
NULL, sizeof(int), 0644, NULL,
|
54 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
55 |
|
|
&min_conmode, &max_conmode},
|
56 |
|
|
{NET_AX25_STANDARD_WINDOW, "standard_window_size",
|
57 |
|
|
NULL, sizeof(int), 0644, NULL,
|
58 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
59 |
|
|
&min_window, &max_window},
|
60 |
|
|
{NET_AX25_EXTENDED_WINDOW, "extended_window_size",
|
61 |
|
|
NULL, sizeof(int), 0644, NULL,
|
62 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
63 |
|
|
&min_ewindow, &max_ewindow},
|
64 |
|
|
{NET_AX25_T1_TIMEOUT, "t1_timeout",
|
65 |
|
|
NULL, sizeof(int), 0644, NULL,
|
66 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
67 |
|
|
&min_t1, &max_t1},
|
68 |
|
|
{NET_AX25_T2_TIMEOUT, "t2_timeout",
|
69 |
|
|
NULL, sizeof(int), 0644, NULL,
|
70 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
71 |
|
|
&min_t2, &max_t2},
|
72 |
|
|
{NET_AX25_T3_TIMEOUT, "t3_timeout",
|
73 |
|
|
NULL, sizeof(int), 0644, NULL,
|
74 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
75 |
|
|
&min_t3, &max_t3},
|
76 |
|
|
{NET_AX25_IDLE_TIMEOUT, "idle_timeout",
|
77 |
|
|
NULL, sizeof(int), 0644, NULL,
|
78 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
79 |
|
|
&min_idle, &max_idle},
|
80 |
|
|
{NET_AX25_N2, "maximum_retry_count",
|
81 |
|
|
NULL, sizeof(int), 0644, NULL,
|
82 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
83 |
|
|
&min_n2, &max_n2},
|
84 |
|
|
{NET_AX25_PACLEN, "maximum_packet_length",
|
85 |
|
|
NULL, sizeof(int), 0644, NULL,
|
86 |
|
|
&proc_dointvec_minmax, &sysctl_intvec, NULL,
|
87 |
|
|
&min_paclen, &max_paclen},
|
88 |
|
|
{0} /* that's all, folks! */
|
89 |
|
|
};
|
90 |
|
|
|
91 |
|
|
void ax25_register_sysctl(void)
|
92 |
|
|
{
|
93 |
|
|
int i, n, k;
|
94 |
|
|
|
95 |
|
|
memset(ax25_table, 0x00, (AX25_MAX_DEVICES + 1) * sizeof(ctl_table));
|
96 |
|
|
|
97 |
|
|
for (n = 0, i = 0; i < AX25_MAX_DEVICES; i++) {
|
98 |
|
|
if (ax25_device[i].dev != NULL) {
|
99 |
|
|
ax25_table[n].ctl_name = n + 1;
|
100 |
|
|
ax25_table[n].procname = ax25_device[i].name;
|
101 |
|
|
ax25_table[n].data = NULL;
|
102 |
|
|
ax25_table[n].maxlen = 0;
|
103 |
|
|
ax25_table[n].mode = 0555;
|
104 |
|
|
ax25_table[n].child = ax25_device[i].systable;
|
105 |
|
|
ax25_table[n].proc_handler = NULL;
|
106 |
|
|
|
107 |
|
|
memcpy(ax25_device[i].systable, ax25_param_table, sizeof(ax25_device[i].systable));
|
108 |
|
|
|
109 |
|
|
ax25_device[i].systable[AX25_MAX_VALUES].ctl_name = 0; /* just in case... */
|
110 |
|
|
|
111 |
|
|
for (k = 0; k < AX25_MAX_VALUES; k++)
|
112 |
|
|
ax25_device[i].systable[k].data = &ax25_device[i].values[k];
|
113 |
|
|
|
114 |
|
|
n++;
|
115 |
|
|
}
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
ax25_table_header = register_sysctl_table(ax25_root_table, 1);
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
void ax25_unregister_sysctl(void)
|
122 |
|
|
{
|
123 |
|
|
unregister_sysctl_table(ax25_table_header);
|
124 |
|
|
}
|