xref: /linux/net/dccp/sysctl.c (revision f8572d8f2a2ba75408b97dc24ef47c83671795d7)
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,
23883ca833SGerrit Renker 			u8_max   = 0xFF;
24883ca833SGerrit Renker static unsigned long	seqw_min = 32;
25883ca833SGerrit Renker 
26e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_default_table[] = {
27e55d912fSArnaldo Carvalho de Melo 	{
28e55d912fSArnaldo Carvalho de Melo 		.procname	= "seq_window",
29883ca833SGerrit Renker 		.data		= &sysctl_dccp_sequence_window,
30883ca833SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_sequence_window),
31e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
32883ca833SGerrit Renker 		.proc_handler	= proc_doulongvec_minmax,
33883ca833SGerrit Renker 		.extra1		= &seqw_min,		/* RFC 4340, 7.5.2 */
34e55d912fSArnaldo Carvalho de Melo 	},
35e55d912fSArnaldo Carvalho de Melo 	{
36e55d912fSArnaldo Carvalho de Melo 		.procname	= "rx_ccid",
37883ca833SGerrit Renker 		.data		= &sysctl_dccp_rx_ccid,
38883ca833SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_rx_ccid),
39e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
40883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
41883ca833SGerrit Renker 		.extra1		= &zero,
42883ca833SGerrit Renker 		.extra2		= &u8_max,		/* RFC 4340, 10. */
43e55d912fSArnaldo Carvalho de Melo 	},
44e55d912fSArnaldo Carvalho de Melo 	{
45e55d912fSArnaldo Carvalho de Melo 		.procname	= "tx_ccid",
46883ca833SGerrit Renker 		.data		= &sysctl_dccp_tx_ccid,
47883ca833SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_tx_ccid),
48e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
49883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
50883ca833SGerrit Renker 		.extra1		= &zero,
51883ca833SGerrit Renker 		.extra2		= &u8_max,		/* RFC 4340, 10. */
52e55d912fSArnaldo Carvalho de Melo 	},
53e55d912fSArnaldo Carvalho de Melo 	{
542e2e9e92SGerrit Renker 		.procname	= "request_retries",
552e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_request_retries,
562e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_request_retries),
572e2e9e92SGerrit Renker 		.mode		= 0644,
58883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
59883ca833SGerrit Renker 		.extra1		= &zero,
60883ca833SGerrit Renker 		.extra2		= &u8_max,
612e2e9e92SGerrit Renker 	},
622e2e9e92SGerrit Renker 	{
632e2e9e92SGerrit Renker 		.procname	= "retries1",
642e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_retries1,
652e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_retries1),
662e2e9e92SGerrit Renker 		.mode		= 0644,
67883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
68883ca833SGerrit Renker 		.extra1		= &zero,
69883ca833SGerrit Renker 		.extra2		= &u8_max,
702e2e9e92SGerrit Renker 	},
712e2e9e92SGerrit Renker 	{
722e2e9e92SGerrit Renker 		.procname	= "retries2",
732e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_retries2,
742e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_retries2),
752e2e9e92SGerrit Renker 		.mode		= 0644,
76883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
77883ca833SGerrit Renker 		.extra1		= &zero,
78883ca833SGerrit Renker 		.extra2		= &u8_max,
792e2e9e92SGerrit Renker 	},
8082e3ab9dSIan McDonald 	{
8182e3ab9dSIan McDonald 		.procname	= "tx_qlen",
8282e3ab9dSIan McDonald 		.data		= &sysctl_dccp_tx_qlen,
8382e3ab9dSIan McDonald 		.maxlen		= sizeof(sysctl_dccp_tx_qlen),
8482e3ab9dSIan McDonald 		.mode		= 0644,
85883ca833SGerrit Renker 		.proc_handler	= proc_dointvec_minmax,
86883ca833SGerrit Renker 		.extra1		= &zero,
8782e3ab9dSIan McDonald 	},
88a94f0f97SGerrit Renker 	{
89a94f0f97SGerrit Renker 		.procname	= "sync_ratelimit",
90a94f0f97SGerrit Renker 		.data		= &sysctl_dccp_sync_ratelimit,
91a94f0f97SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_sync_ratelimit),
92a94f0f97SGerrit Renker 		.mode		= 0644,
93a94f0f97SGerrit Renker 		.proc_handler	= proc_dointvec_ms_jiffies,
94a94f0f97SGerrit Renker 	},
9582e3ab9dSIan McDonald 
96*f8572d8fSEric W. Biederman 	{ }
97e55d912fSArnaldo Carvalho de Melo };
98e55d912fSArnaldo Carvalho de Melo 
99b5ccd792SPavel Emelyanov static struct ctl_path dccp_path[] = {
100*f8572d8fSEric W. Biederman 	{ .procname = "net", },
101*f8572d8fSEric W. Biederman 	{ .procname = "dccp", },
102*f8572d8fSEric W. Biederman 	{ .procname = "default", },
103b5ccd792SPavel Emelyanov 	{ }
104e55d912fSArnaldo Carvalho de Melo };
105e55d912fSArnaldo Carvalho de Melo 
106e55d912fSArnaldo Carvalho de Melo static struct ctl_table_header *dccp_table_header;
107e55d912fSArnaldo Carvalho de Melo 
108e55d912fSArnaldo Carvalho de Melo int __init dccp_sysctl_init(void)
109e55d912fSArnaldo Carvalho de Melo {
110b5ccd792SPavel Emelyanov 	dccp_table_header = register_sysctl_paths(dccp_path,
111b5ccd792SPavel Emelyanov 			dccp_default_table);
112e55d912fSArnaldo Carvalho de Melo 
113e55d912fSArnaldo Carvalho de Melo 	return dccp_table_header != NULL ? 0 : -ENOMEM;
114e55d912fSArnaldo Carvalho de Melo }
115e55d912fSArnaldo Carvalho de Melo 
116e55d912fSArnaldo Carvalho de Melo void dccp_sysctl_exit(void)
117e55d912fSArnaldo Carvalho de Melo {
118e55d912fSArnaldo Carvalho de Melo 	if (dccp_table_header != NULL) {
119e55d912fSArnaldo Carvalho de Melo 		unregister_sysctl_table(dccp_table_header);
120e55d912fSArnaldo Carvalho de Melo 		dccp_table_header = NULL;
121e55d912fSArnaldo Carvalho de Melo 	}
122e55d912fSArnaldo Carvalho de Melo }
123