sysctl.c 6.5 KB
Newer Older
1
/* SCTP kernel implementation
L
Linus Torvalds 已提交
2 3 4
 * (C) Copyright IBM Corp. 2002, 2004
 * Copyright (c) 2002 Intel Corp.
 *
5
 * This file is part of the SCTP kernel implementation
L
Linus Torvalds 已提交
6 7 8
 *
 * Sysctl related interfaces for SCTP.
 *
9
 * This SCTP implementation is free software;
L
Linus Torvalds 已提交
10 11 12 13 14
 * 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, or (at your option)
 * any later version.
 *
15
 * This SCTP implementation is distributed in the hope that it
L
Linus Torvalds 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
 *                 ************************
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNU CC; see the file COPYING.  If not, write to
 * the Free Software Foundation, 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Please send any bug reports or fixes you make to the
 * email address(es):
 *    lksctp developers <lksctp-developers@lists.sourceforge.net>
 *
 * Or submit a bug report through the following website:
 *    http://www.sf.net/projects/lksctp
 *
 * Written or modified by:
 *    Mingqin Liu           <liuming@us.ibm.com>
 *    Jon Grimm             <jgrimm@us.ibm.com>
 *    Ardelle Fan           <ardelle.fan@intel.com>
 *    Ryan Layer            <rmlayer@us.ibm.com>
 *    Sridhar Samudrala     <sri@us.ibm.com>
 *
 * Any bugs reported given to us we will try to fix... any fixes shared will
 * be incorporated into the next SCTP release.
 */

#include <net/sctp/structs.h>
45
#include <net/sctp/sctp.h>
L
Linus Torvalds 已提交
46 47
#include <linux/sysctl.h>

48 49 50 51
static int zero = 0;
static int one = 1;
static int timer_max = 86400000; /* ms in one day */
static int int_max = INT_MAX;
52 53
static int sack_timer_min = 1;
static int sack_timer_max = 500;
54
static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
L
Linus Torvalds 已提交
55

56 57 58
extern int sysctl_sctp_mem[3];
extern int sysctl_sctp_rmem[3];
extern int sysctl_sctp_wmem[3];
59

L
Linus Torvalds 已提交
60 61 62 63
static ctl_table sctp_table[] = {
	{
		.procname	= "rto_initial",
		.data		= &sctp_rto_initial,
64
		.maxlen		= sizeof(unsigned int),
L
Linus Torvalds 已提交
65
		.mode		= 0644,
A
Alexey Dobriyan 已提交
66
		.proc_handler	= proc_dointvec_minmax,
67 68
		.extra1         = &one,
		.extra2         = &timer_max
L
Linus Torvalds 已提交
69 70 71 72
	},
	{
		.procname	= "rto_min",
		.data		= &sctp_rto_min,
73
		.maxlen		= sizeof(unsigned int),
L
Linus Torvalds 已提交
74
		.mode		= 0644,
A
Alexey Dobriyan 已提交
75
		.proc_handler	= proc_dointvec_minmax,
76 77
		.extra1         = &one,
		.extra2         = &timer_max
L
Linus Torvalds 已提交
78 79 80 81
	},
	{
		.procname	= "rto_max",
		.data		= &sctp_rto_max,
82
		.maxlen		= sizeof(unsigned int),
L
Linus Torvalds 已提交
83
		.mode		= 0644,
A
Alexey Dobriyan 已提交
84
		.proc_handler	= proc_dointvec_minmax,
85 86
		.extra1         = &one,
		.extra2         = &timer_max
L
Linus Torvalds 已提交
87 88 89 90
	},
	{
		.procname	= "valid_cookie_life",
		.data		= &sctp_valid_cookie_life,
91
		.maxlen		= sizeof(unsigned int),
L
Linus Torvalds 已提交
92
		.mode		= 0644,
A
Alexey Dobriyan 已提交
93
		.proc_handler	= proc_dointvec_minmax,
94 95
		.extra1         = &one,
		.extra2         = &timer_max
L
Linus Torvalds 已提交
96 97 98 99 100 101
	},
	{
		.procname	= "max_burst",
		.data		= &sctp_max_burst,
		.maxlen		= sizeof(int),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
102
		.proc_handler	= proc_dointvec_minmax,
103 104
		.extra1		= &zero,
		.extra2		= &int_max
L
Linus Torvalds 已提交
105 106 107 108 109 110
	},
	{
		.procname	= "association_max_retrans",
		.data		= &sctp_max_retrans_association,
		.maxlen		= sizeof(int),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
111
		.proc_handler	= proc_dointvec_minmax,
112 113
		.extra1		= &one,
		.extra2		= &int_max
L
Linus Torvalds 已提交
114
	},
115 116 117 118 119
	{
		.procname	= "sndbuf_policy",
		.data		= &sctp_sndbuf_policy,
		.maxlen		= sizeof(int),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
120
		.proc_handler	= proc_dointvec,
121
	},
122 123 124 125 126
	{
		.procname	= "rcvbuf_policy",
		.data		= &sctp_rcvbuf_policy,
		.maxlen		= sizeof(int),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
127
		.proc_handler	= proc_dointvec,
128
	},
L
Linus Torvalds 已提交
129 130 131 132 133
	{
		.procname	= "path_max_retrans",
		.data		= &sctp_max_retrans_path,
		.maxlen		= sizeof(int),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
134
		.proc_handler	= proc_dointvec_minmax,
135 136
		.extra1		= &one,
		.extra2		= &int_max
L
Linus Torvalds 已提交
137 138 139 140 141 142
	},
	{
		.procname	= "max_init_retransmits",
		.data		= &sctp_max_retrans_init,
		.maxlen		= sizeof(int),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
143
		.proc_handler	= proc_dointvec_minmax,
144 145
		.extra1		= &one,
		.extra2		= &int_max
L
Linus Torvalds 已提交
146 147 148 149
	},
	{
		.procname	= "hb_interval",
		.data		= &sctp_hb_interval,
150
		.maxlen		= sizeof(unsigned int),
L
Linus Torvalds 已提交
151
		.mode		= 0644,
A
Alexey Dobriyan 已提交
152
		.proc_handler	= proc_dointvec_minmax,
153 154
		.extra1         = &one,
		.extra2         = &timer_max
L
Linus Torvalds 已提交
155 156 157 158
	},
	{
		.procname	= "cookie_preserve_enable",
		.data		= &sctp_cookie_preserve_enable,
159
		.maxlen		= sizeof(int),
L
Linus Torvalds 已提交
160
		.mode		= 0644,
A
Alexey Dobriyan 已提交
161
		.proc_handler	= proc_dointvec,
L
Linus Torvalds 已提交
162 163 164 165 166
	},
	{
		.procname	= "rto_alpha_exp_divisor",
		.data		= &sctp_rto_alpha,
		.maxlen		= sizeof(int),
167
		.mode		= 0444,
A
Alexey Dobriyan 已提交
168
		.proc_handler	= proc_dointvec,
L
Linus Torvalds 已提交
169 170 171 172 173
	},
	{
		.procname	= "rto_beta_exp_divisor",
		.data		= &sctp_rto_beta,
		.maxlen		= sizeof(int),
174
		.mode		= 0444,
A
Alexey Dobriyan 已提交
175
		.proc_handler	= proc_dointvec,
L
Linus Torvalds 已提交
176 177 178 179 180 181
	},
	{
		.procname	= "addip_enable",
		.data		= &sctp_addip_enable,
		.maxlen		= sizeof(int),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
182
		.proc_handler	= proc_dointvec,
L
Linus Torvalds 已提交
183 184 185 186 187 188
	},
	{
		.procname	= "prsctp_enable",
		.data		= &sctp_prsctp_enable,
		.maxlen		= sizeof(int),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
189
		.proc_handler	= proc_dointvec,
L
Linus Torvalds 已提交
190
	},
191 192 193
	{
		.procname	= "sack_timeout",
		.data		= &sctp_sack_timeout,
194
		.maxlen		= sizeof(int),
195
		.mode		= 0644,
A
Alexey Dobriyan 已提交
196
		.proc_handler	= proc_dointvec_minmax,
197 198 199
		.extra1         = &sack_timer_min,
		.extra2         = &sack_timer_max,
	},
200 201 202 203 204
	{
		.procname	= "sctp_mem",
		.data		= &sysctl_sctp_mem,
		.maxlen		= sizeof(sysctl_sctp_mem),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
205
		.proc_handler	= proc_dointvec,
206 207 208 209 210 211
	},
	{
		.procname	= "sctp_rmem",
		.data		= &sysctl_sctp_rmem,
		.maxlen		= sizeof(sysctl_sctp_rmem),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
212
		.proc_handler	= proc_dointvec,
213 214 215 216 217 218
	},
	{
		.procname	= "sctp_wmem",
		.data		= &sysctl_sctp_wmem,
		.maxlen		= sizeof(sysctl_sctp_wmem),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
219
		.proc_handler	= proc_dointvec,
220
	},
221 222 223 224 225
	{
		.procname	= "auth_enable",
		.data		= &sctp_auth_enable,
		.maxlen		= sizeof(int),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
226
		.proc_handler	= proc_dointvec,
227
	},
228 229 230 231 232
	{
		.procname	= "addip_noauth_enable",
		.data		= &sctp_addip_noauth,
		.maxlen		= sizeof(int),
		.mode		= 0644,
A
Alexey Dobriyan 已提交
233
		.proc_handler	= proc_dointvec,
234
	},
235 236 237 238 239
	{
		.procname	= "addr_scope_policy",
		.data		= &sctp_scope_policy,
		.maxlen		= sizeof(int),
		.mode		= 0644,
240
		.proc_handler	= proc_dointvec_minmax,
241 242 243
		.extra1		= &zero,
		.extra2		= &addr_scope_max,
	},
244
	{ }
L
Linus Torvalds 已提交
245 246
};

247
static struct ctl_path sctp_path[] = {
248 249
	{ .procname = "net", },
	{ .procname = "sctp", },
250
	{ }
L
Linus Torvalds 已提交
251 252 253 254 255 256 257
};

static struct ctl_table_header * sctp_sysctl_header;

/* Sysctl registration.  */
void sctp_sysctl_register(void)
{
258
	sctp_sysctl_header = register_sysctl_paths(sctp_path, sctp_table);
L
Linus Torvalds 已提交
259 260 261 262 263 264 265
}

/* Sysctl deregistration.  */
void sctp_sysctl_unregister(void)
{
	unregister_sysctl_table(sctp_sysctl_header);
}