xref: /linux/net/dccp/sysctl.c (revision 2e2e9e92bd723244ea20fa488b1780111f2b05e1)
1 /*
2  *  net/dccp/sysctl.c
3  *
4  *  An implementation of the DCCP protocol
5  *  Arnaldo Carvalho de Melo <acme@mandriva.com>
6  *
7  *	This program is free software; you can redistribute it and/or
8  *	modify it under the terms of the GNU General Public License v2
9  *	as published by the Free Software Foundation.
10  */
11 
12 #include <linux/mm.h>
13 #include <linux/sysctl.h>
14 #include "dccp.h"
15 #include "feat.h"
16 
17 #ifndef CONFIG_SYSCTL
18 #error This file should not be compiled without CONFIG_SYSCTL defined
19 #endif
20 
21 static struct ctl_table dccp_default_table[] = {
22 	{
23 		.ctl_name	= NET_DCCP_DEFAULT_SEQ_WINDOW,
24 		.procname	= "seq_window",
25 		.data		= &dccp_feat_default_sequence_window,
26 		.maxlen		= sizeof(dccp_feat_default_sequence_window),
27 		.mode		= 0644,
28 		.proc_handler	= proc_dointvec,
29 	},
30 	{
31 		.ctl_name	= NET_DCCP_DEFAULT_RX_CCID,
32 		.procname	= "rx_ccid",
33 		.data		= &dccp_feat_default_rx_ccid,
34 		.maxlen		= sizeof(dccp_feat_default_rx_ccid),
35 		.mode		= 0644,
36 		.proc_handler	= proc_dointvec,
37 	},
38 	{
39 		.ctl_name	= NET_DCCP_DEFAULT_TX_CCID,
40 		.procname	= "tx_ccid",
41 		.data		= &dccp_feat_default_tx_ccid,
42 		.maxlen		= sizeof(dccp_feat_default_tx_ccid),
43 		.mode		= 0644,
44 		.proc_handler	= proc_dointvec,
45 	},
46 	{
47 		.ctl_name	= NET_DCCP_DEFAULT_ACK_RATIO,
48 		.procname	= "ack_ratio",
49 		.data		= &dccp_feat_default_ack_ratio,
50 		.maxlen		= sizeof(dccp_feat_default_ack_ratio),
51 		.mode		= 0644,
52 		.proc_handler	= proc_dointvec,
53 	},
54 	{
55 		.ctl_name	= NET_DCCP_DEFAULT_SEND_ACKVEC,
56 		.procname	= "send_ackvec",
57 		.data		= &dccp_feat_default_send_ack_vector,
58 		.maxlen		= sizeof(dccp_feat_default_send_ack_vector),
59 		.mode		= 0644,
60 		.proc_handler	= proc_dointvec,
61 	},
62 	{
63 		.ctl_name	= NET_DCCP_DEFAULT_SEND_NDP,
64 		.procname	= "send_ndp",
65 		.data		= &dccp_feat_default_send_ndp_count,
66 		.maxlen		= sizeof(dccp_feat_default_send_ndp_count),
67 		.mode		= 0644,
68 		.proc_handler	= proc_dointvec,
69 	},
70 	{
71 		.ctl_name	= NET_DCCP_DEFAULT_REQ_RETRIES,
72 		.procname	= "request_retries",
73 		.data		= &sysctl_dccp_request_retries,
74 		.maxlen		= sizeof(sysctl_dccp_request_retries),
75 		.mode		= 0644,
76 		.proc_handler	= proc_dointvec,
77 	},
78 	{
79 		.ctl_name	= NET_DCCP_DEFAULT_RETRIES1,
80 		.procname	= "retries1",
81 		.data		= &sysctl_dccp_retries1,
82 		.maxlen		= sizeof(sysctl_dccp_retries1),
83 		.mode		= 0644,
84 		.proc_handler	= proc_dointvec,
85 	},
86 	{
87 		.ctl_name	= NET_DCCP_DEFAULT_RETRIES2,
88 		.procname	= "retries2",
89 		.data		= &sysctl_dccp_retries2,
90 		.maxlen		= sizeof(sysctl_dccp_retries2),
91 		.mode		= 0644,
92 		.proc_handler	= proc_dointvec,
93 	},
94 	{ .ctl_name = 0, }
95 };
96 
97 static struct ctl_table dccp_table[] = {
98 	{
99 		.ctl_name	= NET_DCCP_DEFAULT,
100 		.procname	= "default",
101 		.mode		= 0555,
102 		.child		= dccp_default_table,
103 	},
104 	{ .ctl_name = 0, },
105 };
106 
107 static struct ctl_table dccp_dir_table[] = {
108 	{
109 		.ctl_name	= NET_DCCP,
110 		.procname	= "dccp",
111 		.mode		= 0555,
112 		.child		= dccp_table,
113 	},
114 	{ .ctl_name = 0, },
115 };
116 
117 static struct ctl_table dccp_root_table[] = {
118 	{
119 		.ctl_name	= CTL_NET,
120 		.procname	= "net",
121 		.mode		= 0555,
122 		.child		= dccp_dir_table,
123 	},
124 	{ .ctl_name = 0, },
125 };
126 
127 static struct ctl_table_header *dccp_table_header;
128 
129 int __init dccp_sysctl_init(void)
130 {
131 	dccp_table_header = register_sysctl_table(dccp_root_table, 1);
132 
133 	return dccp_table_header != NULL ? 0 : -ENOMEM;
134 }
135 
136 void dccp_sysctl_exit(void)
137 {
138 	if (dccp_table_header != NULL) {
139 		unregister_sysctl_table(dccp_table_header);
140 		dccp_table_header = NULL;
141 	}
142 }
143