aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/sysctl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /net/sctp/sysctl.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'net/sctp/sysctl.c')
-rw-r--r--net/sctp/sysctl.c251
1 files changed, 251 insertions, 0 deletions
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
new file mode 100644
index 000000000000..89fa20c73a5c
--- /dev/null
+++ b/net/sctp/sysctl.c
@@ -0,0 +1,251 @@
1/* SCTP kernel reference Implementation
2 * (C) Copyright IBM Corp. 2002, 2004
3 * Copyright (c) 2002 Intel Corp.
4 *
5 * This file is part of the SCTP kernel reference Implementation
6 *
7 * Sysctl related interfaces for SCTP.
8 *
9 * The SCTP reference implementation is free software;
10 * you can redistribute it and/or modify it under the terms of
11 * the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version.
14 *
15 * The SCTP reference implementation is distributed in the hope that it
16 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
17 * ************************
18 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 * See the GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with GNU CC; see the file COPYING. If not, write to
23 * the Free Software Foundation, 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
25 *
26 * Please send any bug reports or fixes you make to the
27 * email address(es):
28 * lksctp developers <lksctp-developers@lists.sourceforge.net>
29 *
30 * Or submit a bug report through the following website:
31 * http://www.sf.net/projects/lksctp
32 *
33 * Written or modified by:
34 * Mingqin Liu <liuming@us.ibm.com>
35 * Jon Grimm <jgrimm@us.ibm.com>
36 * Ardelle Fan <ardelle.fan@intel.com>
37 * Ryan Layer <rmlayer@us.ibm.com>
38 * Sridhar Samudrala <sri@us.ibm.com>
39 *
40 * Any bugs reported given to us we will try to fix... any fixes shared will
41 * be incorporated into the next SCTP release.
42 */
43
44#include <net/sctp/structs.h>
45#include <linux/sysctl.h>
46
47static ctl_handler sctp_sysctl_jiffies_ms;
48static long rto_timer_min = 1;
49static long rto_timer_max = 86400000; /* One day */
50
51static ctl_table sctp_table[] = {
52 {
53 .ctl_name = NET_SCTP_RTO_INITIAL,
54 .procname = "rto_initial",
55 .data = &sctp_rto_initial,
56 .maxlen = sizeof(long),
57 .mode = 0644,
58 .proc_handler = &proc_doulongvec_ms_jiffies_minmax,
59 .strategy = &sctp_sysctl_jiffies_ms,
60 .extra1 = &rto_timer_min,
61 .extra2 = &rto_timer_max
62 },
63 {
64 .ctl_name = NET_SCTP_RTO_MIN,
65 .procname = "rto_min",
66 .data = &sctp_rto_min,
67 .maxlen = sizeof(long),
68 .mode = 0644,
69 .proc_handler = &proc_doulongvec_ms_jiffies_minmax,
70 .strategy = &sctp_sysctl_jiffies_ms,
71 .extra1 = &rto_timer_min,
72 .extra2 = &rto_timer_max
73 },
74 {
75 .ctl_name = NET_SCTP_RTO_MAX,
76 .procname = "rto_max",
77 .data = &sctp_rto_max,
78 .maxlen = sizeof(long),
79 .mode = 0644,
80 .proc_handler = &proc_doulongvec_ms_jiffies_minmax,
81 .strategy = &sctp_sysctl_jiffies_ms,
82 .extra1 = &rto_timer_min,
83 .extra2 = &rto_timer_max
84 },
85 {
86 .ctl_name = NET_SCTP_VALID_COOKIE_LIFE,
87 .procname = "valid_cookie_life",
88 .data = &sctp_valid_cookie_life,
89 .maxlen = sizeof(long),
90 .mode = 0644,
91 .proc_handler = &proc_doulongvec_ms_jiffies_minmax,
92 .strategy = &sctp_sysctl_jiffies_ms,
93 .extra1 = &rto_timer_min,
94 .extra2 = &rto_timer_max
95 },
96 {
97 .ctl_name = NET_SCTP_MAX_BURST,
98 .procname = "max_burst",
99 .data = &sctp_max_burst,
100 .maxlen = sizeof(int),
101 .mode = 0644,
102 .proc_handler = &proc_dointvec
103 },
104 {
105 .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS,
106 .procname = "association_max_retrans",
107 .data = &sctp_max_retrans_association,
108 .maxlen = sizeof(int),
109 .mode = 0644,
110 .proc_handler = &proc_dointvec
111 },
112 {
113 .ctl_name = NET_SCTP_PATH_MAX_RETRANS,
114 .procname = "path_max_retrans",
115 .data = &sctp_max_retrans_path,
116 .maxlen = sizeof(int),
117 .mode = 0644,
118 .proc_handler = &proc_dointvec
119 },
120 {
121 .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS,
122 .procname = "max_init_retransmits",
123 .data = &sctp_max_retrans_init,
124 .maxlen = sizeof(int),
125 .mode = 0644,
126 .proc_handler = &proc_dointvec
127 },
128 {
129 .ctl_name = NET_SCTP_HB_INTERVAL,
130 .procname = "hb_interval",
131 .data = &sctp_hb_interval,
132 .maxlen = sizeof(long),
133 .mode = 0644,
134 .proc_handler = &proc_doulongvec_ms_jiffies_minmax,
135 .strategy = &sctp_sysctl_jiffies_ms,
136 .extra1 = &rto_timer_min,
137 .extra2 = &rto_timer_max
138 },
139 {
140 .ctl_name = NET_SCTP_PRESERVE_ENABLE,
141 .procname = "cookie_preserve_enable",
142 .data = &sctp_cookie_preserve_enable,
143 .maxlen = sizeof(long),
144 .mode = 0644,
145 .proc_handler = &proc_doulongvec_ms_jiffies_minmax,
146 .strategy = &sctp_sysctl_jiffies_ms,
147 .extra1 = &rto_timer_min,
148 .extra2 = &rto_timer_max
149 },
150 {
151 .ctl_name = NET_SCTP_RTO_ALPHA,
152 .procname = "rto_alpha_exp_divisor",
153 .data = &sctp_rto_alpha,
154 .maxlen = sizeof(int),
155 .mode = 0644,
156 .proc_handler = &proc_dointvec
157 },
158 {
159 .ctl_name = NET_SCTP_RTO_BETA,
160 .procname = "rto_beta_exp_divisor",
161 .data = &sctp_rto_beta,
162 .maxlen = sizeof(int),
163 .mode = 0644,
164 .proc_handler = &proc_dointvec
165 },
166 {
167 .ctl_name = NET_SCTP_ADDIP_ENABLE,
168 .procname = "addip_enable",
169 .data = &sctp_addip_enable,
170 .maxlen = sizeof(int),
171 .mode = 0644,
172 .proc_handler = &proc_dointvec
173 },
174 {
175 .ctl_name = NET_SCTP_PRSCTP_ENABLE,
176 .procname = "prsctp_enable",
177 .data = &sctp_prsctp_enable,
178 .maxlen = sizeof(int),
179 .mode = 0644,
180 .proc_handler = &proc_dointvec
181 },
182 { .ctl_name = 0 }
183};
184
185static ctl_table sctp_net_table[] = {
186 {
187 .ctl_name = NET_SCTP,
188 .procname = "sctp",
189 .mode = 0555,
190 .child = sctp_table
191 },
192 { .ctl_name = 0 }
193};
194
195static ctl_table sctp_root_table[] = {
196 {
197 .ctl_name = CTL_NET,
198 .procname = "net",
199 .mode = 0555,
200 .child = sctp_net_table
201 },
202 { .ctl_name = 0 }
203};
204
205static struct ctl_table_header * sctp_sysctl_header;
206
207/* Sysctl registration. */
208void sctp_sysctl_register(void)
209{
210 sctp_sysctl_header = register_sysctl_table(sctp_root_table, 0);
211}
212
213/* Sysctl deregistration. */
214void sctp_sysctl_unregister(void)
215{
216 unregister_sysctl_table(sctp_sysctl_header);
217}
218
219/* Strategy function to convert jiffies to milliseconds. */
220static int sctp_sysctl_jiffies_ms(ctl_table *table, int __user *name, int nlen,
221 void __user *oldval, size_t __user *oldlenp,
222 void __user *newval, size_t newlen, void **context) {
223
224 if (oldval) {
225 size_t olen;
226
227 if (oldlenp) {
228 if (get_user(olen, oldlenp))
229 return -EFAULT;
230
231 if (olen != sizeof (int))
232 return -EINVAL;
233 }
234 if (put_user((*(int *)(table->data) * 1000) / HZ,
235 (int __user *)oldval) ||
236 (oldlenp && put_user(sizeof (int), oldlenp)))
237 return -EFAULT;
238 }
239 if (newval && newlen) {
240 int new;
241
242 if (newlen != sizeof (int))
243 return -EINVAL;
244
245 if (get_user(new, (int __user *)newval))
246 return -EFAULT;
247
248 *(int *)(table->data) = (new * HZ) / 1000;
249 }
250 return 1;
251}