Linux Audio

Check our new training course

Loading...
v3.5.6
  1/* SCTP kernel implementation
  2 * (C) Copyright IBM Corp. 2002, 2004
  3 * Copyright (c) 2002 Intel Corp.
  4 *
  5 * This file is part of the SCTP kernel implementation
  6 *
  7 * Sysctl related interfaces for SCTP.
  8 *
  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)
 13 * any later version.
 14 *
 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.
 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 <net/sctp/sctp.h>
 46#include <linux/sysctl.h>
 47
 48static int zero = 0;
 49static int one = 1;
 50static int timer_max = 86400000; /* ms in one day */
 51static int int_max = INT_MAX;
 52static int sack_timer_min = 1;
 53static int sack_timer_max = 500;
 54static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
 55static int rwnd_scale_max = 16;
 56static unsigned long max_autoclose_min = 0;
 57static unsigned long max_autoclose_max =
 58	(MAX_SCHEDULE_TIMEOUT / HZ > UINT_MAX)
 59	? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ;
 60
 61extern long sysctl_sctp_mem[3];
 62extern int sysctl_sctp_rmem[3];
 63extern int sysctl_sctp_wmem[3];
 64
 65static ctl_table sctp_table[] = {
 66	{
 67		.procname	= "rto_initial",
 68		.data		= &sctp_rto_initial,
 69		.maxlen		= sizeof(unsigned int),
 70		.mode		= 0644,
 71		.proc_handler	= proc_dointvec_minmax,
 72		.extra1         = &one,
 73		.extra2         = &timer_max
 74	},
 75	{
 76		.procname	= "rto_min",
 77		.data		= &sctp_rto_min,
 78		.maxlen		= sizeof(unsigned int),
 79		.mode		= 0644,
 80		.proc_handler	= proc_dointvec_minmax,
 81		.extra1         = &one,
 82		.extra2         = &timer_max
 83	},
 84	{
 85		.procname	= "rto_max",
 86		.data		= &sctp_rto_max,
 87		.maxlen		= sizeof(unsigned int),
 88		.mode		= 0644,
 89		.proc_handler	= proc_dointvec_minmax,
 90		.extra1         = &one,
 91		.extra2         = &timer_max
 92	},
 93	{
 94		.procname	= "valid_cookie_life",
 95		.data		= &sctp_valid_cookie_life,
 96		.maxlen		= sizeof(unsigned int),
 97		.mode		= 0644,
 98		.proc_handler	= proc_dointvec_minmax,
 99		.extra1         = &one,
100		.extra2         = &timer_max
101	},
102	{
103		.procname	= "max_burst",
104		.data		= &sctp_max_burst,
105		.maxlen		= sizeof(int),
106		.mode		= 0644,
107		.proc_handler	= proc_dointvec_minmax,
108		.extra1		= &zero,
109		.extra2		= &int_max
110	},
111	{
112		.procname	= "association_max_retrans",
113		.data		= &sctp_max_retrans_association,
114		.maxlen		= sizeof(int),
115		.mode		= 0644,
116		.proc_handler	= proc_dointvec_minmax,
117		.extra1		= &one,
118		.extra2		= &int_max
119	},
120	{
121		.procname	= "sndbuf_policy",
122		.data		= &sctp_sndbuf_policy,
123		.maxlen		= sizeof(int),
124		.mode		= 0644,
125		.proc_handler	= proc_dointvec,
126	},
127	{
128		.procname	= "rcvbuf_policy",
129		.data		= &sctp_rcvbuf_policy,
130		.maxlen		= sizeof(int),
131		.mode		= 0644,
132		.proc_handler	= proc_dointvec,
133	},
134	{
135		.procname	= "path_max_retrans",
136		.data		= &sctp_max_retrans_path,
137		.maxlen		= sizeof(int),
138		.mode		= 0644,
139		.proc_handler	= proc_dointvec_minmax,
140		.extra1		= &one,
141		.extra2		= &int_max
142	},
143	{
144		.procname	= "max_init_retransmits",
145		.data		= &sctp_max_retrans_init,
146		.maxlen		= sizeof(int),
147		.mode		= 0644,
148		.proc_handler	= proc_dointvec_minmax,
149		.extra1		= &one,
150		.extra2		= &int_max
151	},
152	{
153		.procname	= "hb_interval",
154		.data		= &sctp_hb_interval,
155		.maxlen		= sizeof(unsigned int),
156		.mode		= 0644,
157		.proc_handler	= proc_dointvec_minmax,
158		.extra1         = &one,
159		.extra2         = &timer_max
160	},
161	{
162		.procname	= "cookie_preserve_enable",
163		.data		= &sctp_cookie_preserve_enable,
164		.maxlen		= sizeof(int),
165		.mode		= 0644,
166		.proc_handler	= proc_dointvec,
167	},
168	{
169		.procname	= "rto_alpha_exp_divisor",
170		.data		= &sctp_rto_alpha,
171		.maxlen		= sizeof(int),
172		.mode		= 0444,
173		.proc_handler	= proc_dointvec,
174	},
175	{
176		.procname	= "rto_beta_exp_divisor",
177		.data		= &sctp_rto_beta,
178		.maxlen		= sizeof(int),
179		.mode		= 0444,
180		.proc_handler	= proc_dointvec,
181	},
182	{
183		.procname	= "addip_enable",
184		.data		= &sctp_addip_enable,
185		.maxlen		= sizeof(int),
186		.mode		= 0644,
187		.proc_handler	= proc_dointvec,
188	},
189	{
190		.procname	= "default_auto_asconf",
191		.data		= &sctp_default_auto_asconf,
192		.maxlen		= sizeof(int),
193		.mode		= 0644,
194		.proc_handler	= proc_dointvec,
195	},
196	{
197		.procname	= "prsctp_enable",
198		.data		= &sctp_prsctp_enable,
199		.maxlen		= sizeof(int),
200		.mode		= 0644,
201		.proc_handler	= proc_dointvec,
202	},
203	{
204		.procname	= "sack_timeout",
205		.data		= &sctp_sack_timeout,
206		.maxlen		= sizeof(int),
207		.mode		= 0644,
208		.proc_handler	= proc_dointvec_minmax,
209		.extra1         = &sack_timer_min,
210		.extra2         = &sack_timer_max,
211	},
212	{
213		.procname	= "sctp_mem",
214		.data		= &sysctl_sctp_mem,
215		.maxlen		= sizeof(sysctl_sctp_mem),
216		.mode		= 0644,
217		.proc_handler	= proc_doulongvec_minmax
218	},
219	{
220		.procname	= "sctp_rmem",
221		.data		= &sysctl_sctp_rmem,
222		.maxlen		= sizeof(sysctl_sctp_rmem),
223		.mode		= 0644,
224		.proc_handler	= proc_dointvec,
225	},
226	{
227		.procname	= "sctp_wmem",
228		.data		= &sysctl_sctp_wmem,
229		.maxlen		= sizeof(sysctl_sctp_wmem),
230		.mode		= 0644,
231		.proc_handler	= proc_dointvec,
232	},
233	{
234		.procname	= "auth_enable",
235		.data		= &sctp_auth_enable,
236		.maxlen		= sizeof(int),
237		.mode		= 0644,
238		.proc_handler	= proc_dointvec,
239	},
240	{
241		.procname	= "addip_noauth_enable",
242		.data		= &sctp_addip_noauth,
243		.maxlen		= sizeof(int),
244		.mode		= 0644,
245		.proc_handler	= proc_dointvec,
246	},
247	{
248		.procname	= "addr_scope_policy",
249		.data		= &sctp_scope_policy,
250		.maxlen		= sizeof(int),
251		.mode		= 0644,
252		.proc_handler	= proc_dointvec_minmax,
253		.extra1		= &zero,
254		.extra2		= &addr_scope_max,
255	},
256	{
257		.procname	= "rwnd_update_shift",
258		.data		= &sctp_rwnd_upd_shift,
259		.maxlen		= sizeof(int),
260		.mode		= 0644,
261		.proc_handler	= &proc_dointvec_minmax,
262		.extra1		= &one,
263		.extra2		= &rwnd_scale_max,
264	},
265	{
266		.procname	= "max_autoclose",
267		.data		= &sctp_max_autoclose,
268		.maxlen		= sizeof(unsigned long),
269		.mode		= 0644,
270		.proc_handler	= &proc_doulongvec_minmax,
271		.extra1		= &max_autoclose_min,
272		.extra2		= &max_autoclose_max,
273	},
274
275	{ /* sentinel */ }
276};
277
 
 
 
 
 
 
278static struct ctl_table_header * sctp_sysctl_header;
279
280/* Sysctl registration.  */
281void sctp_sysctl_register(void)
282{
283	sctp_sysctl_header = register_net_sysctl(&init_net, "net/sctp", sctp_table);
284}
285
286/* Sysctl deregistration.  */
287void sctp_sysctl_unregister(void)
288{
289	unregister_net_sysctl_table(sctp_sysctl_header);
290}
v3.1
  1/* SCTP kernel implementation
  2 * (C) Copyright IBM Corp. 2002, 2004
  3 * Copyright (c) 2002 Intel Corp.
  4 *
  5 * This file is part of the SCTP kernel implementation
  6 *
  7 * Sysctl related interfaces for SCTP.
  8 *
  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)
 13 * any later version.
 14 *
 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.
 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 <net/sctp/sctp.h>
 46#include <linux/sysctl.h>
 47
 48static int zero = 0;
 49static int one = 1;
 50static int timer_max = 86400000; /* ms in one day */
 51static int int_max = INT_MAX;
 52static int sack_timer_min = 1;
 53static int sack_timer_max = 500;
 54static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
 55static int rwnd_scale_max = 16;
 
 
 
 
 56
 57extern long sysctl_sctp_mem[3];
 58extern int sysctl_sctp_rmem[3];
 59extern int sysctl_sctp_wmem[3];
 60
 61static ctl_table sctp_table[] = {
 62	{
 63		.procname	= "rto_initial",
 64		.data		= &sctp_rto_initial,
 65		.maxlen		= sizeof(unsigned int),
 66		.mode		= 0644,
 67		.proc_handler	= proc_dointvec_minmax,
 68		.extra1         = &one,
 69		.extra2         = &timer_max
 70	},
 71	{
 72		.procname	= "rto_min",
 73		.data		= &sctp_rto_min,
 74		.maxlen		= sizeof(unsigned int),
 75		.mode		= 0644,
 76		.proc_handler	= proc_dointvec_minmax,
 77		.extra1         = &one,
 78		.extra2         = &timer_max
 79	},
 80	{
 81		.procname	= "rto_max",
 82		.data		= &sctp_rto_max,
 83		.maxlen		= sizeof(unsigned int),
 84		.mode		= 0644,
 85		.proc_handler	= proc_dointvec_minmax,
 86		.extra1         = &one,
 87		.extra2         = &timer_max
 88	},
 89	{
 90		.procname	= "valid_cookie_life",
 91		.data		= &sctp_valid_cookie_life,
 92		.maxlen		= sizeof(unsigned int),
 93		.mode		= 0644,
 94		.proc_handler	= proc_dointvec_minmax,
 95		.extra1         = &one,
 96		.extra2         = &timer_max
 97	},
 98	{
 99		.procname	= "max_burst",
100		.data		= &sctp_max_burst,
101		.maxlen		= sizeof(int),
102		.mode		= 0644,
103		.proc_handler	= proc_dointvec_minmax,
104		.extra1		= &zero,
105		.extra2		= &int_max
106	},
107	{
108		.procname	= "association_max_retrans",
109		.data		= &sctp_max_retrans_association,
110		.maxlen		= sizeof(int),
111		.mode		= 0644,
112		.proc_handler	= proc_dointvec_minmax,
113		.extra1		= &one,
114		.extra2		= &int_max
115	},
116	{
117		.procname	= "sndbuf_policy",
118		.data		= &sctp_sndbuf_policy,
119		.maxlen		= sizeof(int),
120		.mode		= 0644,
121		.proc_handler	= proc_dointvec,
122	},
123	{
124		.procname	= "rcvbuf_policy",
125		.data		= &sctp_rcvbuf_policy,
126		.maxlen		= sizeof(int),
127		.mode		= 0644,
128		.proc_handler	= proc_dointvec,
129	},
130	{
131		.procname	= "path_max_retrans",
132		.data		= &sctp_max_retrans_path,
133		.maxlen		= sizeof(int),
134		.mode		= 0644,
135		.proc_handler	= proc_dointvec_minmax,
136		.extra1		= &one,
137		.extra2		= &int_max
138	},
139	{
140		.procname	= "max_init_retransmits",
141		.data		= &sctp_max_retrans_init,
142		.maxlen		= sizeof(int),
143		.mode		= 0644,
144		.proc_handler	= proc_dointvec_minmax,
145		.extra1		= &one,
146		.extra2		= &int_max
147	},
148	{
149		.procname	= "hb_interval",
150		.data		= &sctp_hb_interval,
151		.maxlen		= sizeof(unsigned int),
152		.mode		= 0644,
153		.proc_handler	= proc_dointvec_minmax,
154		.extra1         = &one,
155		.extra2         = &timer_max
156	},
157	{
158		.procname	= "cookie_preserve_enable",
159		.data		= &sctp_cookie_preserve_enable,
160		.maxlen		= sizeof(int),
161		.mode		= 0644,
162		.proc_handler	= proc_dointvec,
163	},
164	{
165		.procname	= "rto_alpha_exp_divisor",
166		.data		= &sctp_rto_alpha,
167		.maxlen		= sizeof(int),
168		.mode		= 0444,
169		.proc_handler	= proc_dointvec,
170	},
171	{
172		.procname	= "rto_beta_exp_divisor",
173		.data		= &sctp_rto_beta,
174		.maxlen		= sizeof(int),
175		.mode		= 0444,
176		.proc_handler	= proc_dointvec,
177	},
178	{
179		.procname	= "addip_enable",
180		.data		= &sctp_addip_enable,
181		.maxlen		= sizeof(int),
182		.mode		= 0644,
183		.proc_handler	= proc_dointvec,
184	},
185	{
186		.procname	= "default_auto_asconf",
187		.data		= &sctp_default_auto_asconf,
188		.maxlen		= sizeof(int),
189		.mode		= 0644,
190		.proc_handler	= proc_dointvec,
191	},
192	{
193		.procname	= "prsctp_enable",
194		.data		= &sctp_prsctp_enable,
195		.maxlen		= sizeof(int),
196		.mode		= 0644,
197		.proc_handler	= proc_dointvec,
198	},
199	{
200		.procname	= "sack_timeout",
201		.data		= &sctp_sack_timeout,
202		.maxlen		= sizeof(int),
203		.mode		= 0644,
204		.proc_handler	= proc_dointvec_minmax,
205		.extra1         = &sack_timer_min,
206		.extra2         = &sack_timer_max,
207	},
208	{
209		.procname	= "sctp_mem",
210		.data		= &sysctl_sctp_mem,
211		.maxlen		= sizeof(sysctl_sctp_mem),
212		.mode		= 0644,
213		.proc_handler	= proc_doulongvec_minmax
214	},
215	{
216		.procname	= "sctp_rmem",
217		.data		= &sysctl_sctp_rmem,
218		.maxlen		= sizeof(sysctl_sctp_rmem),
219		.mode		= 0644,
220		.proc_handler	= proc_dointvec,
221	},
222	{
223		.procname	= "sctp_wmem",
224		.data		= &sysctl_sctp_wmem,
225		.maxlen		= sizeof(sysctl_sctp_wmem),
226		.mode		= 0644,
227		.proc_handler	= proc_dointvec,
228	},
229	{
230		.procname	= "auth_enable",
231		.data		= &sctp_auth_enable,
232		.maxlen		= sizeof(int),
233		.mode		= 0644,
234		.proc_handler	= proc_dointvec,
235	},
236	{
237		.procname	= "addip_noauth_enable",
238		.data		= &sctp_addip_noauth,
239		.maxlen		= sizeof(int),
240		.mode		= 0644,
241		.proc_handler	= proc_dointvec,
242	},
243	{
244		.procname	= "addr_scope_policy",
245		.data		= &sctp_scope_policy,
246		.maxlen		= sizeof(int),
247		.mode		= 0644,
248		.proc_handler	= proc_dointvec_minmax,
249		.extra1		= &zero,
250		.extra2		= &addr_scope_max,
251	},
252	{
253		.procname	= "rwnd_update_shift",
254		.data		= &sctp_rwnd_upd_shift,
255		.maxlen		= sizeof(int),
256		.mode		= 0644,
257		.proc_handler	= &proc_dointvec_minmax,
258		.extra1		= &one,
259		.extra2		= &rwnd_scale_max,
260	},
 
 
 
 
 
 
 
 
 
261
262	{ /* sentinel */ }
263};
264
265static struct ctl_path sctp_path[] = {
266	{ .procname = "net", },
267	{ .procname = "sctp", },
268	{ }
269};
270
271static struct ctl_table_header * sctp_sysctl_header;
272
273/* Sysctl registration.  */
274void sctp_sysctl_register(void)
275{
276	sctp_sysctl_header = register_sysctl_paths(sctp_path, sctp_table);
277}
278
279/* Sysctl deregistration.  */
280void sctp_sysctl_unregister(void)
281{
282	unregister_sysctl_table(sctp_sysctl_header);
283}