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