Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/net/netrom/sysctl_net_netrom.c
26278 views
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
/*
3
*
4
* Copyright (C) 1996 Mike Shaver ([email protected])
5
*/
6
#include <linux/mm.h>
7
#include <linux/sysctl.h>
8
#include <linux/init.h>
9
#include <net/ax25.h>
10
#include <net/netrom.h>
11
12
/*
13
* Values taken from NET/ROM documentation.
14
*/
15
static int min_quality[] = {0}, max_quality[] = {255};
16
static int min_obs[] = {0}, max_obs[] = {255};
17
static int min_ttl[] = {0}, max_ttl[] = {255};
18
static int min_t1[] = {5 * HZ};
19
static int max_t1[] = {600 * HZ};
20
static int min_n2[] = {2}, max_n2[] = {127};
21
static int min_t2[] = {1 * HZ};
22
static int max_t2[] = {60 * HZ};
23
static int min_t4[] = {1 * HZ};
24
static int max_t4[] = {1000 * HZ};
25
static int min_window[] = {1}, max_window[] = {127};
26
static int min_idle[] = {0 * HZ};
27
static int max_idle[] = {65535 * HZ};
28
static int min_route[] = {0}, max_route[] = {1};
29
static int min_fails[] = {1}, max_fails[] = {10};
30
static int min_reset[] = {0}, max_reset[] = {1};
31
32
static struct ctl_table_header *nr_table_header;
33
34
static struct ctl_table nr_table[] = {
35
{
36
.procname = "default_path_quality",
37
.data = &sysctl_netrom_default_path_quality,
38
.maxlen = sizeof(int),
39
.mode = 0644,
40
.proc_handler = proc_dointvec_minmax,
41
.extra1 = &min_quality,
42
.extra2 = &max_quality
43
},
44
{
45
.procname = "obsolescence_count_initialiser",
46
.data = &sysctl_netrom_obsolescence_count_initialiser,
47
.maxlen = sizeof(int),
48
.mode = 0644,
49
.proc_handler = proc_dointvec_minmax,
50
.extra1 = &min_obs,
51
.extra2 = &max_obs
52
},
53
{
54
.procname = "network_ttl_initialiser",
55
.data = &sysctl_netrom_network_ttl_initialiser,
56
.maxlen = sizeof(int),
57
.mode = 0644,
58
.proc_handler = proc_dointvec_minmax,
59
.extra1 = &min_ttl,
60
.extra2 = &max_ttl
61
},
62
{
63
.procname = "transport_timeout",
64
.data = &sysctl_netrom_transport_timeout,
65
.maxlen = sizeof(int),
66
.mode = 0644,
67
.proc_handler = proc_dointvec_minmax,
68
.extra1 = &min_t1,
69
.extra2 = &max_t1
70
},
71
{
72
.procname = "transport_maximum_tries",
73
.data = &sysctl_netrom_transport_maximum_tries,
74
.maxlen = sizeof(int),
75
.mode = 0644,
76
.proc_handler = proc_dointvec_minmax,
77
.extra1 = &min_n2,
78
.extra2 = &max_n2
79
},
80
{
81
.procname = "transport_acknowledge_delay",
82
.data = &sysctl_netrom_transport_acknowledge_delay,
83
.maxlen = sizeof(int),
84
.mode = 0644,
85
.proc_handler = proc_dointvec_minmax,
86
.extra1 = &min_t2,
87
.extra2 = &max_t2
88
},
89
{
90
.procname = "transport_busy_delay",
91
.data = &sysctl_netrom_transport_busy_delay,
92
.maxlen = sizeof(int),
93
.mode = 0644,
94
.proc_handler = proc_dointvec_minmax,
95
.extra1 = &min_t4,
96
.extra2 = &max_t4
97
},
98
{
99
.procname = "transport_requested_window_size",
100
.data = &sysctl_netrom_transport_requested_window_size,
101
.maxlen = sizeof(int),
102
.mode = 0644,
103
.proc_handler = proc_dointvec_minmax,
104
.extra1 = &min_window,
105
.extra2 = &max_window
106
},
107
{
108
.procname = "transport_no_activity_timeout",
109
.data = &sysctl_netrom_transport_no_activity_timeout,
110
.maxlen = sizeof(int),
111
.mode = 0644,
112
.proc_handler = proc_dointvec_minmax,
113
.extra1 = &min_idle,
114
.extra2 = &max_idle
115
},
116
{
117
.procname = "routing_control",
118
.data = &sysctl_netrom_routing_control,
119
.maxlen = sizeof(int),
120
.mode = 0644,
121
.proc_handler = proc_dointvec_minmax,
122
.extra1 = &min_route,
123
.extra2 = &max_route
124
},
125
{
126
.procname = "link_fails_count",
127
.data = &sysctl_netrom_link_fails_count,
128
.maxlen = sizeof(int),
129
.mode = 0644,
130
.proc_handler = proc_dointvec_minmax,
131
.extra1 = &min_fails,
132
.extra2 = &max_fails
133
},
134
{
135
.procname = "reset",
136
.data = &sysctl_netrom_reset_circuit,
137
.maxlen = sizeof(int),
138
.mode = 0644,
139
.proc_handler = proc_dointvec_minmax,
140
.extra1 = &min_reset,
141
.extra2 = &max_reset
142
},
143
};
144
145
int __init nr_register_sysctl(void)
146
{
147
nr_table_header = register_net_sysctl(&init_net, "net/netrom", nr_table);
148
if (!nr_table_header)
149
return -ENOMEM;
150
return 0;
151
}
152
153
void nr_unregister_sysctl(void)
154
{
155
unregister_net_sysctl_table(nr_table_header);
156
}
157
158