1 /* SCTP kernel implementation
2 * (C) Copyright IBM Corp. 2002, 2004
3 * Copyright (c) 2002 Intel Corp.
5 * This file is part of the SCTP kernel implementation
7 * Sysctl related interfaces for SCTP.
9 * This SCTP 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 * This SCTP 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 <net/sctp/sctp.h>
46 #include <linux/sysctl.h>
50 static int timer_max
= 86400000; /* ms in one day */
51 static int int_max
= INT_MAX
;
52 static int sack_timer_min
= 1;
53 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 */
55 static int rwnd_scale_max
= 16;
56 static unsigned long max_autoclose_min
= 0;
57 static unsigned long max_autoclose_max
=
58 (MAX_SCHEDULE_TIMEOUT
/ HZ
> UINT_MAX
)
59 ? UINT_MAX
: MAX_SCHEDULE_TIMEOUT
/ HZ
;
61 extern long sysctl_sctp_mem
[3];
62 extern int sysctl_sctp_rmem
[3];
63 extern int sysctl_sctp_wmem
[3];
65 static ctl_table sctp_table
[] = {
67 .procname
= "sctp_mem",
68 .data
= &sysctl_sctp_mem
,
69 .maxlen
= sizeof(sysctl_sctp_mem
),
71 .proc_handler
= proc_doulongvec_minmax
74 .procname
= "sctp_rmem",
75 .data
= &sysctl_sctp_rmem
,
76 .maxlen
= sizeof(sysctl_sctp_rmem
),
78 .proc_handler
= proc_dointvec
,
81 .procname
= "sctp_wmem",
82 .data
= &sysctl_sctp_wmem
,
83 .maxlen
= sizeof(sysctl_sctp_wmem
),
85 .proc_handler
= proc_dointvec
,
91 static ctl_table sctp_net_table
[] = {
93 .procname
= "rto_initial",
94 .data
= &init_net
.sctp
.rto_initial
,
95 .maxlen
= sizeof(unsigned int),
97 .proc_handler
= proc_dointvec_minmax
,
102 .procname
= "rto_min",
103 .data
= &init_net
.sctp
.rto_min
,
104 .maxlen
= sizeof(unsigned int),
106 .proc_handler
= proc_dointvec_minmax
,
111 .procname
= "rto_max",
112 .data
= &init_net
.sctp
.rto_max
,
113 .maxlen
= sizeof(unsigned int),
115 .proc_handler
= proc_dointvec_minmax
,
120 .procname
= "rto_alpha_exp_divisor",
121 .data
= &init_net
.sctp
.rto_alpha
,
122 .maxlen
= sizeof(int),
124 .proc_handler
= proc_dointvec
,
127 .procname
= "rto_beta_exp_divisor",
128 .data
= &init_net
.sctp
.rto_beta
,
129 .maxlen
= sizeof(int),
131 .proc_handler
= proc_dointvec
,
134 .procname
= "max_burst",
135 .data
= &init_net
.sctp
.max_burst
,
136 .maxlen
= sizeof(int),
138 .proc_handler
= proc_dointvec_minmax
,
143 .procname
= "cookie_preserve_enable",
144 .data
= &init_net
.sctp
.cookie_preserve_enable
,
145 .maxlen
= sizeof(int),
147 .proc_handler
= proc_dointvec
,
150 .procname
= "valid_cookie_life",
151 .data
= &init_net
.sctp
.valid_cookie_life
,
152 .maxlen
= sizeof(unsigned int),
154 .proc_handler
= proc_dointvec_minmax
,
159 .procname
= "sack_timeout",
160 .data
= &init_net
.sctp
.sack_timeout
,
161 .maxlen
= sizeof(int),
163 .proc_handler
= proc_dointvec_minmax
,
164 .extra1
= &sack_timer_min
,
165 .extra2
= &sack_timer_max
,
168 .procname
= "hb_interval",
169 .data
= &init_net
.sctp
.hb_interval
,
170 .maxlen
= sizeof(unsigned int),
172 .proc_handler
= proc_dointvec_minmax
,
177 .procname
= "association_max_retrans",
178 .data
= &init_net
.sctp
.max_retrans_association
,
179 .maxlen
= sizeof(int),
181 .proc_handler
= proc_dointvec_minmax
,
186 .procname
= "path_max_retrans",
187 .data
= &init_net
.sctp
.max_retrans_path
,
188 .maxlen
= sizeof(int),
190 .proc_handler
= proc_dointvec_minmax
,
195 .procname
= "max_init_retransmits",
196 .data
= &init_net
.sctp
.max_retrans_init
,
197 .maxlen
= sizeof(int),
199 .proc_handler
= proc_dointvec_minmax
,
204 .procname
= "pf_retrans",
205 .data
= &init_net
.sctp
.pf_retrans
,
206 .maxlen
= sizeof(int),
208 .proc_handler
= proc_dointvec_minmax
,
213 .procname
= "sndbuf_policy",
214 .data
= &init_net
.sctp
.sndbuf_policy
,
215 .maxlen
= sizeof(int),
217 .proc_handler
= proc_dointvec
,
220 .procname
= "rcvbuf_policy",
221 .data
= &init_net
.sctp
.rcvbuf_policy
,
222 .maxlen
= sizeof(int),
224 .proc_handler
= proc_dointvec
,
227 .procname
= "default_auto_asconf",
228 .data
= &init_net
.sctp
.default_auto_asconf
,
229 .maxlen
= sizeof(int),
231 .proc_handler
= proc_dointvec
,
234 .procname
= "addip_enable",
235 .data
= &init_net
.sctp
.addip_enable
,
236 .maxlen
= sizeof(int),
238 .proc_handler
= proc_dointvec
,
241 .procname
= "addip_noauth_enable",
242 .data
= &init_net
.sctp
.addip_noauth
,
243 .maxlen
= sizeof(int),
245 .proc_handler
= proc_dointvec
,
248 .procname
= "prsctp_enable",
249 .data
= &init_net
.sctp
.prsctp_enable
,
250 .maxlen
= sizeof(int),
252 .proc_handler
= proc_dointvec
,
255 .procname
= "auth_enable",
256 .data
= &init_net
.sctp
.auth_enable
,
257 .maxlen
= sizeof(int),
259 .proc_handler
= proc_dointvec
,
262 .procname
= "addr_scope_policy",
263 .data
= &init_net
.sctp
.scope_policy
,
264 .maxlen
= sizeof(int),
266 .proc_handler
= proc_dointvec_minmax
,
268 .extra2
= &addr_scope_max
,
271 .procname
= "rwnd_update_shift",
272 .data
= &init_net
.sctp
.rwnd_upd_shift
,
273 .maxlen
= sizeof(int),
275 .proc_handler
= &proc_dointvec_minmax
,
277 .extra2
= &rwnd_scale_max
,
280 .procname
= "max_autoclose",
281 .data
= &init_net
.sctp
.max_autoclose
,
282 .maxlen
= sizeof(unsigned long),
284 .proc_handler
= &proc_doulongvec_minmax
,
285 .extra1
= &max_autoclose_min
,
286 .extra2
= &max_autoclose_max
,
292 int sctp_sysctl_net_register(struct net
*net
)
294 struct ctl_table
*table
;
297 table
= kmemdup(sctp_net_table
, sizeof(sctp_net_table
), GFP_KERNEL
);
301 for (i
= 0; table
[i
].data
; i
++)
302 table
[i
].data
+= (char *)(&net
->sctp
) - (char *)&init_net
.sctp
;
304 net
->sctp
.sysctl_header
= register_net_sysctl(net
, "net/sctp", table
);
308 void sctp_sysctl_net_unregister(struct net
*net
)
310 unregister_net_sysctl_table(net
->sctp
.sysctl_header
);
313 static struct ctl_table_header
* sctp_sysctl_header
;
315 /* Sysctl registration. */
316 void sctp_sysctl_register(void)
318 sctp_sysctl_header
= register_net_sysctl(&init_net
, "net/sctp", sctp_table
);
321 /* Sysctl deregistration. */
322 void sctp_sysctl_unregister(void)
324 unregister_net_sysctl_table(sctp_sysctl_header
);