1 /* SCTP kernel reference Implementation
2 * (C) Copyright IBM Corp. 2002, 2004
3 * Copyright (c) 2002 Intel Corp.
5 * This file is part of the SCTP kernel reference Implementation
7 * Sysctl related interfaces for SCTP.
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)
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.
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.
26 * Please send any bug reports or fixes you make to the
28 * lksctp developers <lksctp-developers@lists.sourceforge.net>
30 * Or submit a bug report through the following website:
31 * http://www.sf.net/projects/lksctp
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>
40 * Any bugs reported given to us we will try to fix... any fixes shared will
41 * be incorporated into the next SCTP release.
44 #include <net/sctp/structs.h>
45 #include <linux/sysctl.h>
47 static ctl_handler sctp_sysctl_jiffies_ms
;
48 static long rto_timer_min
= 1;
49 static long rto_timer_max
= 86400000; /* One day */
50 static long sack_timer_min
= 1;
51 static long sack_timer_max
= 500;
53 static ctl_table sctp_table
[] = {
55 .ctl_name
= NET_SCTP_RTO_INITIAL
,
56 .procname
= "rto_initial",
57 .data
= &sctp_rto_initial
,
58 .maxlen
= sizeof(long),
60 .proc_handler
= &proc_doulongvec_ms_jiffies_minmax
,
61 .strategy
= &sctp_sysctl_jiffies_ms
,
62 .extra1
= &rto_timer_min
,
63 .extra2
= &rto_timer_max
66 .ctl_name
= NET_SCTP_RTO_MIN
,
67 .procname
= "rto_min",
68 .data
= &sctp_rto_min
,
69 .maxlen
= sizeof(long),
71 .proc_handler
= &proc_doulongvec_ms_jiffies_minmax
,
72 .strategy
= &sctp_sysctl_jiffies_ms
,
73 .extra1
= &rto_timer_min
,
74 .extra2
= &rto_timer_max
77 .ctl_name
= NET_SCTP_RTO_MAX
,
78 .procname
= "rto_max",
79 .data
= &sctp_rto_max
,
80 .maxlen
= sizeof(long),
82 .proc_handler
= &proc_doulongvec_ms_jiffies_minmax
,
83 .strategy
= &sctp_sysctl_jiffies_ms
,
84 .extra1
= &rto_timer_min
,
85 .extra2
= &rto_timer_max
88 .ctl_name
= NET_SCTP_VALID_COOKIE_LIFE
,
89 .procname
= "valid_cookie_life",
90 .data
= &sctp_valid_cookie_life
,
91 .maxlen
= sizeof(long),
93 .proc_handler
= &proc_doulongvec_ms_jiffies_minmax
,
94 .strategy
= &sctp_sysctl_jiffies_ms
,
95 .extra1
= &rto_timer_min
,
96 .extra2
= &rto_timer_max
99 .ctl_name
= NET_SCTP_MAX_BURST
,
100 .procname
= "max_burst",
101 .data
= &sctp_max_burst
,
102 .maxlen
= sizeof(int),
104 .proc_handler
= &proc_dointvec
107 .ctl_name
= NET_SCTP_ASSOCIATION_MAX_RETRANS
,
108 .procname
= "association_max_retrans",
109 .data
= &sctp_max_retrans_association
,
110 .maxlen
= sizeof(int),
112 .proc_handler
= &proc_dointvec
115 .ctl_name
= NET_SCTP_SNDBUF_POLICY
,
116 .procname
= "sndbuf_policy",
117 .data
= &sctp_sndbuf_policy
,
118 .maxlen
= sizeof(int),
120 .proc_handler
= &proc_dointvec
123 .ctl_name
= NET_SCTP_PATH_MAX_RETRANS
,
124 .procname
= "path_max_retrans",
125 .data
= &sctp_max_retrans_path
,
126 .maxlen
= sizeof(int),
128 .proc_handler
= &proc_dointvec
131 .ctl_name
= NET_SCTP_MAX_INIT_RETRANSMITS
,
132 .procname
= "max_init_retransmits",
133 .data
= &sctp_max_retrans_init
,
134 .maxlen
= sizeof(int),
136 .proc_handler
= &proc_dointvec
139 .ctl_name
= NET_SCTP_HB_INTERVAL
,
140 .procname
= "hb_interval",
141 .data
= &sctp_hb_interval
,
142 .maxlen
= sizeof(long),
144 .proc_handler
= &proc_doulongvec_ms_jiffies_minmax
,
145 .strategy
= &sctp_sysctl_jiffies_ms
,
146 .extra1
= &rto_timer_min
,
147 .extra2
= &rto_timer_max
150 .ctl_name
= NET_SCTP_PRESERVE_ENABLE
,
151 .procname
= "cookie_preserve_enable",
152 .data
= &sctp_cookie_preserve_enable
,
153 .maxlen
= sizeof(long),
155 .proc_handler
= &proc_doulongvec_ms_jiffies_minmax
,
156 .strategy
= &sctp_sysctl_jiffies_ms
,
157 .extra1
= &rto_timer_min
,
158 .extra2
= &rto_timer_max
161 .ctl_name
= NET_SCTP_RTO_ALPHA
,
162 .procname
= "rto_alpha_exp_divisor",
163 .data
= &sctp_rto_alpha
,
164 .maxlen
= sizeof(int),
166 .proc_handler
= &proc_dointvec
169 .ctl_name
= NET_SCTP_RTO_BETA
,
170 .procname
= "rto_beta_exp_divisor",
171 .data
= &sctp_rto_beta
,
172 .maxlen
= sizeof(int),
174 .proc_handler
= &proc_dointvec
177 .ctl_name
= NET_SCTP_ADDIP_ENABLE
,
178 .procname
= "addip_enable",
179 .data
= &sctp_addip_enable
,
180 .maxlen
= sizeof(int),
182 .proc_handler
= &proc_dointvec
185 .ctl_name
= NET_SCTP_PRSCTP_ENABLE
,
186 .procname
= "prsctp_enable",
187 .data
= &sctp_prsctp_enable
,
188 .maxlen
= sizeof(int),
190 .proc_handler
= &proc_dointvec
193 .ctl_name
= NET_SCTP_SACK_TIMEOUT
,
194 .procname
= "sack_timeout",
195 .data
= &sctp_sack_timeout
,
196 .maxlen
= sizeof(long),
198 .proc_handler
= &proc_doulongvec_ms_jiffies_minmax
,
199 .strategy
= &sctp_sysctl_jiffies_ms
,
200 .extra1
= &sack_timer_min
,
201 .extra2
= &sack_timer_max
,
206 static ctl_table sctp_net_table
[] = {
208 .ctl_name
= NET_SCTP
,
216 static ctl_table sctp_root_table
[] = {
221 .child
= sctp_net_table
226 static struct ctl_table_header
* sctp_sysctl_header
;
228 /* Sysctl registration. */
229 void sctp_sysctl_register(void)
231 sctp_sysctl_header
= register_sysctl_table(sctp_root_table
, 0);
234 /* Sysctl deregistration. */
235 void sctp_sysctl_unregister(void)
237 unregister_sysctl_table(sctp_sysctl_header
);
240 /* Strategy function to convert jiffies to milliseconds. */
241 static int sctp_sysctl_jiffies_ms(ctl_table
*table
, int __user
*name
, int nlen
,
242 void __user
*oldval
, size_t __user
*oldlenp
,
243 void __user
*newval
, size_t newlen
, void **context
) {
249 if (get_user(olen
, oldlenp
))
252 if (olen
!= sizeof (int))
255 if (put_user((*(int *)(table
->data
) * 1000) / HZ
,
256 (int __user
*)oldval
) ||
257 (oldlenp
&& put_user(sizeof (int), oldlenp
)))
260 if (newval
&& newlen
) {
263 if (newlen
!= sizeof (int))
266 if (get_user(new, (int __user
*)newval
))
269 *(int *)(table
->data
) = (new * HZ
) / 1000;