xref: /linux/net/dccp/sysctl.c (revision 3d1f337b3e7378923c89f37afb573a918ef40be5)
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/config.h>
13 #include <linux/mm.h>
14 #include <linux/sysctl.h>
15 
16 #ifndef CONFIG_SYSCTL
17 #error This file should not be compiled without CONFIG_SYSCTL defined
18 #endif
19 
20 extern int dccp_feat_default_sequence_window;
21 extern int dccp_feat_default_rx_ccid;
22 extern int dccp_feat_default_tx_ccid;
23 extern int dccp_feat_default_ack_ratio;
24 extern int dccp_feat_default_send_ack_vector;
25 extern int dccp_feat_default_send_ndp_count;
26 
27 static struct ctl_table dccp_default_table[] = {
28 	{
29 		.ctl_name	= NET_DCCP_DEFAULT_SEQ_WINDOW,
30 		.procname	= "seq_window",
31 		.data		= &dccp_feat_default_sequence_window,
32 		.maxlen		= sizeof(dccp_feat_default_sequence_window),
33 		.mode		= 0644,
34 		.proc_handler	= proc_dointvec,
35 	},
36 	{
37 		.ctl_name	= NET_DCCP_DEFAULT_RX_CCID,
38 		.procname	= "rx_ccid",
39 		.data		= &dccp_feat_default_rx_ccid,
40 		.maxlen		= sizeof(dccp_feat_default_rx_ccid),
41 		.mode		= 0644,
42 		.proc_handler	= proc_dointvec,
43 	},
44 	{
45 		.ctl_name	= NET_DCCP_DEFAULT_TX_CCID,
46 		.procname	= "tx_ccid",
47 		.data		= &dccp_feat_default_tx_ccid,
48 		.maxlen		= sizeof(dccp_feat_default_tx_ccid),
49 		.mode		= 0644,
50 		.proc_handler	= proc_dointvec,
51 	},
52 	{
53 		.ctl_name	= NET_DCCP_DEFAULT_ACK_RATIO,
54 		.procname	= "ack_ratio",
55 		.data		= &dccp_feat_default_ack_ratio,
56 		.maxlen		= sizeof(dccp_feat_default_ack_ratio),
57 		.mode		= 0644,
58 		.proc_handler	= proc_dointvec,
59 	},
60 	{
61 		.ctl_name	= NET_DCCP_DEFAULT_SEND_ACKVEC,
62 		.procname	= "send_ackvec",
63 		.data		= &dccp_feat_default_send_ack_vector,
64 		.maxlen		= sizeof(dccp_feat_default_send_ack_vector),
65 		.mode		= 0644,
66 		.proc_handler	= proc_dointvec,
67 	},
68 	{
69 		.ctl_name	= NET_DCCP_DEFAULT_SEND_NDP,
70 		.procname	= "send_ndp",
71 		.data		= &dccp_feat_default_send_ndp_count,
72 		.maxlen		= sizeof(dccp_feat_default_send_ndp_count),
73 		.mode		= 0644,
74 		.proc_handler	= proc_dointvec,
75 	},
76 	{ .ctl_name = 0, }
77 };
78 
79 static struct ctl_table dccp_table[] = {
80 	{
81 		.ctl_name	= NET_DCCP_DEFAULT,
82 		.procname	= "default",
83 		.mode		= 0555,
84 		.child		= dccp_default_table,
85 	},
86 	{ .ctl_name = 0, },
87 };
88 
89 static struct ctl_table dccp_dir_table[] = {
90 	{
91 		.ctl_name	= NET_DCCP,
92 		.procname	= "dccp",
93 		.mode		= 0555,
94 		.child		= dccp_table,
95 	},
96 	{ .ctl_name = 0, },
97 };
98 
99 static struct ctl_table dccp_root_table[] = {
100 	{
101 		.ctl_name	= CTL_NET,
102 		.procname	= "net",
103 		.mode		= 0555,
104 		.child		= dccp_dir_table,
105 	},
106 	{ .ctl_name = 0, },
107 };
108 
109 static struct ctl_table_header *dccp_table_header;
110 
111 int __init dccp_sysctl_init(void)
112 {
113 	dccp_table_header = register_sysctl_table(dccp_root_table, 1);
114 
115 	return dccp_table_header != NULL ? 0 : -ENOMEM;
116 }
117 
118 void dccp_sysctl_exit(void)
119 {
120 	if (dccp_table_header != NULL) {
121 		unregister_sysctl_table(dccp_table_header);
122 		dccp_table_header = NULL;
123 	}
124 }
125