summaryrefslogtreecommitdiff
path: root/net/dccp/sysctl.c
blob: 64c89e9c229ea1d4298a83c947ff29837d9382ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
 *  net/dccp/sysctl.c
 *
 *  An implementation of the DCCP protocol
 *  Arnaldo Carvalho de Melo <acme@mandriva.com>
 *
 *	This program is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU General Public License v2
 *	as published by the Free Software Foundation.
 */

#include <linux/config.h>
#include <linux/mm.h>
#include <linux/sysctl.h>

#ifndef CONFIG_SYSCTL
#error This file should not be compiled without CONFIG_SYSCTL defined
#endif

extern int dccp_feat_default_sequence_window;
extern int dccp_feat_default_rx_ccid;
extern int dccp_feat_default_tx_ccid;
extern int dccp_feat_default_ack_ratio;
extern int dccp_feat_default_send_ack_vector;
extern int dccp_feat_default_send_ndp_count;

static struct ctl_table dccp_default_table[] = {
	{
		.ctl_name	= NET_DCCP_DEFAULT_SEQ_WINDOW,
		.procname	= "seq_window",
		.data		= &dccp_feat_default_sequence_window,
		.maxlen		= sizeof(dccp_feat_default_sequence_window),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.ctl_name	= NET_DCCP_DEFAULT_RX_CCID,
		.procname	= "rx_ccid",
		.data		= &dccp_feat_default_rx_ccid,
		.maxlen		= sizeof(dccp_feat_default_rx_ccid),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.ctl_name	= NET_DCCP_DEFAULT_TX_CCID,
		.procname	= "tx_ccid",
		.data		= &dccp_feat_default_tx_ccid,
		.maxlen		= sizeof(dccp_feat_default_tx_ccid),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.ctl_name	= NET_DCCP_DEFAULT_ACK_RATIO,
		.procname	= "ack_ratio",
		.data		= &dccp_feat_default_ack_ratio,
		.maxlen		= sizeof(dccp_feat_default_ack_ratio),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.ctl_name	= NET_DCCP_DEFAULT_SEND_ACKVEC,
		.procname	= "send_ackvec",
		.data		= &dccp_feat_default_send_ack_vector,
		.maxlen		= sizeof(dccp_feat_default_send_ack_vector),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.ctl_name	= NET_DCCP_DEFAULT_SEND_NDP,
		.procname	= "send_ndp",
		.data		= &dccp_feat_default_send_ndp_count,
		.maxlen		= sizeof(dccp_feat_default_send_ndp_count),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{ .ctl_name = 0, }
};

static struct ctl_table dccp_table[] = {
	{
		.ctl_name	= NET_DCCP_DEFAULT,
		.procname	= "default",
		.mode		= 0555,
		.child		= dccp_default_table,
	},
	{ .ctl_name = 0, },
};

static struct ctl_table dccp_dir_table[] = {
	{
		.ctl_name	= NET_DCCP,
		.procname	= "dccp",
		.mode		= 0555,
		.child		= dccp_table,
	},
	{ .ctl_name = 0, },
};

static struct ctl_table dccp_root_table[] = {
	{
		.ctl_name	= CTL_NET,
		.procname	= "net",
		.mode		= 0555,
		.child		= dccp_dir_table,
	},
	{ .ctl_name = 0, },
};

static struct ctl_table_header *dccp_table_header;

int __init dccp_sysctl_init(void)
{
	dccp_table_header = register_sysctl_table(dccp_root_table, 1);

	return dccp_table_header != NULL ? 0 : -ENOMEM;
}

void dccp_sysctl_exit(void)
{
	if (dccp_table_header != NULL) {
		unregister_sysctl_table(dccp_table_header);
		dccp_table_header = NULL;
	}
}