xref: /linux/net/dccp/sysctl.c (revision 8ba7e7bfc39e05b57ed90a70db2b411b1204377b)
1e55d912fSArnaldo Carvalho de Melo /*
2e55d912fSArnaldo Carvalho de Melo  *  net/dccp/sysctl.c
3e55d912fSArnaldo Carvalho de Melo  *
4e55d912fSArnaldo Carvalho de Melo  *  An implementation of the DCCP protocol
5e55d912fSArnaldo Carvalho de Melo  *  Arnaldo Carvalho de Melo <acme@mandriva.com>
6e55d912fSArnaldo Carvalho de Melo  *
7e55d912fSArnaldo Carvalho de Melo  *	This program is free software; you can redistribute it and/or
8e55d912fSArnaldo Carvalho de Melo  *	modify it under the terms of the GNU General Public License v2
9e55d912fSArnaldo Carvalho de Melo  *	as published by the Free Software Foundation.
10e55d912fSArnaldo Carvalho de Melo  */
11e55d912fSArnaldo Carvalho de Melo 
12e55d912fSArnaldo Carvalho de Melo #include <linux/mm.h>
13e55d912fSArnaldo Carvalho de Melo #include <linux/sysctl.h>
142e2e9e92SGerrit Renker #include "dccp.h"
152a0109a7SIan McDonald #include "feat.h"
16e55d912fSArnaldo Carvalho de Melo 
17e55d912fSArnaldo Carvalho de Melo #ifndef CONFIG_SYSCTL
18e55d912fSArnaldo Carvalho de Melo #error This file should not be compiled without CONFIG_SYSCTL defined
19e55d912fSArnaldo Carvalho de Melo #endif
20e55d912fSArnaldo Carvalho de Melo 
21883ca833SGerrit Renker /* Boundary values */
22883ca833SGerrit Renker static int		zero     = 0,
23*8ba7e7bfSwangweidong 			one      = 1,
24883ca833SGerrit Renker 			u8_max   = 0xFF;
25bfbb2346SGerrit Renker static unsigned long	seqw_min = DCCPF_SEQ_WMIN,
26bfbb2346SGerrit Renker 			seqw_max = 0xFFFFFFFF;		/* maximum on 32 bit */
27883ca833SGerrit Renker 
28e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_default_table[] = {
29e55d912fSArnaldo Carvalho de Melo 	{
30e55d912fSArnaldo Carvalho de Melo 		.procname	= "seq_window",
31883ca833SGerrit Renker 		.data		= &sysctl_dccp_sequence_window,
32883ca833SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_sequence_window),
33e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
34883ca833SGerrit Renker 		.proc_handler	= proc_doulongvec_minmax,
35883ca833SGerrit Renker 		.extra1		= &seqw_min,		/* RFC 4340, 7.5.2 */
36bfbb2346SGerrit Renker 		.extra2		= &seqw_max,
37e55d912fSArnaldo Carvalho de Melo 	},
38e55d912fSArnaldo Carvalho de Melo 	{
39e55d912fSArnaldo Carvalho de Melo 		.procname	= "rx_ccid",
40883ca833SGerrit Renker 		.data		= &sysctl_dccp_rx_ccid,
41883ca833SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_rx_ccid),
42e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
43883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
44883ca833SGerrit Renker 		.extra1		= &zero,
45883ca833SGerrit Renker 		.extra2		= &u8_max,		/* RFC 4340, 10. */
46e55d912fSArnaldo Carvalho de Melo 	},
47e55d912fSArnaldo Carvalho de Melo 	{
48e55d912fSArnaldo Carvalho de Melo 		.procname	= "tx_ccid",
49883ca833SGerrit Renker 		.data		= &sysctl_dccp_tx_ccid,
50883ca833SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_tx_ccid),
51e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
52883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
53883ca833SGerrit Renker 		.extra1		= &zero,
54883ca833SGerrit Renker 		.extra2		= &u8_max,		/* RFC 4340, 10. */
55e55d912fSArnaldo Carvalho de Melo 	},
56e55d912fSArnaldo Carvalho de Melo 	{
572e2e9e92SGerrit Renker 		.procname	= "request_retries",
582e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_request_retries,
592e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_request_retries),
602e2e9e92SGerrit Renker 		.mode		= 0644,
61883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
62*8ba7e7bfSwangweidong 		.extra1		= &one,
63883ca833SGerrit Renker 		.extra2		= &u8_max,
642e2e9e92SGerrit Renker 	},
652e2e9e92SGerrit Renker 	{
662e2e9e92SGerrit Renker 		.procname	= "retries1",
672e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_retries1,
682e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_retries1),
692e2e9e92SGerrit Renker 		.mode		= 0644,
70883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
71883ca833SGerrit Renker 		.extra1		= &zero,
72883ca833SGerrit Renker 		.extra2		= &u8_max,
732e2e9e92SGerrit Renker 	},
742e2e9e92SGerrit Renker 	{
752e2e9e92SGerrit Renker 		.procname	= "retries2",
762e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_retries2,
772e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_retries2),
782e2e9e92SGerrit Renker 		.mode		= 0644,
79883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
80883ca833SGerrit Renker 		.extra1		= &zero,
81883ca833SGerrit Renker 		.extra2		= &u8_max,
822e2e9e92SGerrit Renker 	},
8382e3ab9dSIan McDonald 	{
8482e3ab9dSIan McDonald 		.procname	= "tx_qlen",
8582e3ab9dSIan McDonald 		.data		= &sysctl_dccp_tx_qlen,
8682e3ab9dSIan McDonald 		.maxlen		= sizeof(sysctl_dccp_tx_qlen),
8782e3ab9dSIan McDonald 		.mode		= 0644,
88883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
89883ca833SGerrit Renker 		.extra1		= &zero,
9082e3ab9dSIan McDonald 	},
91a94f0f97SGerrit Renker 	{
92a94f0f97SGerrit Renker 		.procname	= "sync_ratelimit",
93a94f0f97SGerrit Renker 		.data		= &sysctl_dccp_sync_ratelimit,
94a94f0f97SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_sync_ratelimit),
95a94f0f97SGerrit Renker 		.mode		= 0644,
96a94f0f97SGerrit Renker 		.proc_handler	= proc_dointvec_ms_jiffies,
97a94f0f97SGerrit Renker 	},
9882e3ab9dSIan McDonald 
99f8572d8fSEric W. Biederman 	{ }
100e55d912fSArnaldo Carvalho de Melo };
101e55d912fSArnaldo Carvalho de Melo 
102e55d912fSArnaldo Carvalho de Melo static struct ctl_table_header *dccp_table_header;
103e55d912fSArnaldo Carvalho de Melo 
104e55d912fSArnaldo Carvalho de Melo int __init dccp_sysctl_init(void)
105e55d912fSArnaldo Carvalho de Melo {
106ec8f23ceSEric W. Biederman 	dccp_table_header = register_net_sysctl(&init_net, "net/dccp/default",
107b5ccd792SPavel Emelyanov 			dccp_default_table);
108e55d912fSArnaldo Carvalho de Melo 
109e55d912fSArnaldo Carvalho de Melo 	return dccp_table_header != NULL ? 0 : -ENOMEM;
110e55d912fSArnaldo Carvalho de Melo }
111e55d912fSArnaldo Carvalho de Melo 
112e55d912fSArnaldo Carvalho de Melo void dccp_sysctl_exit(void)
113e55d912fSArnaldo Carvalho de Melo {
114e55d912fSArnaldo Carvalho de Melo 	if (dccp_table_header != NULL) {
1155dd3df10SEric W. Biederman 		unregister_net_sysctl_table(dccp_table_header);
116e55d912fSArnaldo Carvalho de Melo 		dccp_table_header = NULL;
117e55d912fSArnaldo Carvalho de Melo 	}
118e55d912fSArnaldo Carvalho de Melo }
119