sysctl_net_netrom.c 5.4 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Copyright (C) 1996 Mike Shaver (shaver@zeroknowledge.com)
 */
#include <linux/mm.h>
#include <linux/sysctl.h>
#include <linux/init.h>
#include <net/ax25.h>
#include <net/netrom.h>

/*
 *	Values taken from NET/ROM documentation.
 */
static int min_quality[] = {0}, max_quality[] = {255};
static int min_obs[]     = {0}, max_obs[]     = {255};
static int min_ttl[]     = {0}, max_ttl[]     = {255};
static int min_t1[]      = {5 * HZ};
static int max_t1[]      = {600 * HZ};
static int min_n2[]      = {2}, max_n2[]      = {127};
static int min_t2[]      = {1 * HZ};
static int max_t2[]      = {60 * HZ};
static int min_t4[]      = {1 * HZ};
static int max_t4[]      = {1000 * HZ};
static int min_window[]  = {1}, max_window[]  = {127};
static int min_idle[]    = {0 * HZ};
static int max_idle[]    = {65535 * HZ};
static int min_route[]   = {0}, max_route[]   = {1};
static int min_fails[]   = {1}, max_fails[]   = {10};
33
static int min_reset[]   = {0}, max_reset[]   = {1};
L
Linus Torvalds 已提交
34 35 36 37

static struct ctl_table_header *nr_table_header;

static ctl_table nr_table[] = {
38
	{
L
Linus Torvalds 已提交
39 40 41 42 43 44 45 46 47 48
		.ctl_name	= NET_NETROM_DEFAULT_PATH_QUALITY,
		.procname	= "default_path_quality",
		.data		= &sysctl_netrom_default_path_quality,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_quality,
		.extra2		= &max_quality
	},
49
	{
L
Linus Torvalds 已提交
50 51 52 53 54
		.ctl_name	= NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER,
		.procname	= "obsolescence_count_initialiser",
		.data		= &sysctl_netrom_obsolescence_count_initialiser,
		.maxlen		= sizeof(int),
		.mode		= 0644,
55
		.proc_handler	= &proc_dointvec_minmax,
L
Linus Torvalds 已提交
56 57 58 59
		.strategy	= &sysctl_intvec,
		.extra1		= &min_obs,
		.extra2		= &max_obs
	},
60
	{
L
Linus Torvalds 已提交
61 62 63 64 65 66 67 68 69 70
		.ctl_name	= NET_NETROM_NETWORK_TTL_INITIALISER,
		.procname	= "network_ttl_initialiser",
		.data		= &sysctl_netrom_network_ttl_initialiser,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_ttl,
		.extra2		= &max_ttl
	},
71
	{
L
Linus Torvalds 已提交
72 73 74 75 76 77 78 79 80 81
		.ctl_name	= NET_NETROM_TRANSPORT_TIMEOUT,
		.procname	= "transport_timeout",
		.data		= &sysctl_netrom_transport_timeout,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_t1,
		.extra2		= &max_t1
	},
82
	{
L
Linus Torvalds 已提交
83 84 85 86 87 88 89 90 91 92
		.ctl_name	= NET_NETROM_TRANSPORT_MAXIMUM_TRIES,
		.procname	= "transport_maximum_tries",
		.data		= &sysctl_netrom_transport_maximum_tries,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_n2,
		.extra2		= &max_n2
	},
93
	{
L
Linus Torvalds 已提交
94 95 96 97 98 99 100 101 102 103
		.ctl_name	= NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY,
		.procname	= "transport_acknowledge_delay",
		.data		= &sysctl_netrom_transport_acknowledge_delay,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_t2,
		.extra2		= &max_t2
	},
104
	{
L
Linus Torvalds 已提交
105 106 107 108 109 110 111 112 113 114
		.ctl_name	= NET_NETROM_TRANSPORT_BUSY_DELAY,
		.procname	= "transport_busy_delay",
		.data		= &sysctl_netrom_transport_busy_delay,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_t4,
		.extra2		= &max_t4
	},
115
	{
L
Linus Torvalds 已提交
116 117 118 119 120 121 122 123 124 125
		.ctl_name	= NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE,
		.procname	= "transport_requested_window_size",
		.data		= &sysctl_netrom_transport_requested_window_size,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_window,
		.extra2		= &max_window
	},
126
	{
L
Linus Torvalds 已提交
127 128 129 130 131 132 133 134 135 136
		.ctl_name	= NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT,
		.procname	= "transport_no_activity_timeout",
		.data		= &sysctl_netrom_transport_no_activity_timeout,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_idle,
		.extra2		= &max_idle
	},
137
	{
L
Linus Torvalds 已提交
138 139 140 141 142 143 144 145 146 147
		.ctl_name	= NET_NETROM_ROUTING_CONTROL,
		.procname	= "routing_control",
		.data		= &sysctl_netrom_routing_control,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_route,
		.extra2		= &max_route
	},
148
	{
L
Linus Torvalds 已提交
149 150 151 152 153 154 155 156 157 158
		.ctl_name	= NET_NETROM_LINK_FAILS_COUNT,
		.procname	= "link_fails_count",
		.data		= &sysctl_netrom_link_fails_count,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_fails,
		.extra2		= &max_fails
	},
159
	{
160 161 162 163 164 165 166 167 168 169
		.ctl_name	= NET_NETROM_RESET,
		.procname	= "reset",
		.data		= &sysctl_netrom_reset_circuit,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= &proc_dointvec_minmax,
		.strategy	= &sysctl_intvec,
		.extra1		= &min_reset,
		.extra2		= &max_reset
	},
L
Linus Torvalds 已提交
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
	{ .ctl_name = 0 }
};

static ctl_table nr_dir_table[] = {
	{
		.ctl_name	= NET_NETROM,
		.procname	= "netrom",
		.mode		= 0555,
		.child		= nr_table
	},
	{ .ctl_name = 0 }
};

static ctl_table nr_root_table[] = {
	{
		.ctl_name	= CTL_NET,
		.procname	= "net",
		.mode		= 0555,
		.child		= nr_dir_table
	},
	{ .ctl_name = 0 }
};

void __init nr_register_sysctl(void)
{
195
	nr_table_header = register_sysctl_table(nr_root_table, 0);
L
Linus Torvalds 已提交
196 197 198 199 200 201
}

void nr_unregister_sysctl(void)
{
	unregister_sysctl_table(nr_table_header);
}