sysctl.c 2.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
 *  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/mm.h>
#include <linux/sysctl.h>
14
#include "dccp.h"
I
Ian McDonald 已提交
15
#include "feat.h"
16 17 18 19 20

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

21 22 23 24 25
/* Boundary values */
static int		zero     = 0,
			u8_max   = 0xFF;
static unsigned long	seqw_min = 32;

26 27 28
static struct ctl_table dccp_default_table[] = {
	{
		.procname	= "seq_window",
29 30
		.data		= &sysctl_dccp_sequence_window,
		.maxlen		= sizeof(sysctl_dccp_sequence_window),
31
		.mode		= 0644,
32 33
		.proc_handler	= proc_doulongvec_minmax,
		.extra1		= &seqw_min,		/* RFC 4340, 7.5.2 */
34 35 36
	},
	{
		.procname	= "rx_ccid",
37 38
		.data		= &sysctl_dccp_rx_ccid,
		.maxlen		= sizeof(sysctl_dccp_rx_ccid),
39
		.mode		= 0644,
40 41 42
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
		.extra2		= &u8_max,		/* RFC 4340, 10. */
43 44 45
	},
	{
		.procname	= "tx_ccid",
46 47
		.data		= &sysctl_dccp_tx_ccid,
		.maxlen		= sizeof(sysctl_dccp_tx_ccid),
48
		.mode		= 0644,
49 50 51
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
		.extra2		= &u8_max,		/* RFC 4340, 10. */
52
	},
53 54 55 56 57
	{
		.procname	= "request_retries",
		.data		= &sysctl_dccp_request_retries,
		.maxlen		= sizeof(sysctl_dccp_request_retries),
		.mode		= 0644,
58 59 60
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
		.extra2		= &u8_max,
61 62 63 64 65 66
	},
	{
		.procname	= "retries1",
		.data		= &sysctl_dccp_retries1,
		.maxlen		= sizeof(sysctl_dccp_retries1),
		.mode		= 0644,
67 68 69
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
		.extra2		= &u8_max,
70 71 72 73 74 75
	},
	{
		.procname	= "retries2",
		.data		= &sysctl_dccp_retries2,
		.maxlen		= sizeof(sysctl_dccp_retries2),
		.mode		= 0644,
76 77 78
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
		.extra2		= &u8_max,
79
	},
I
Ian McDonald 已提交
80 81 82 83 84
	{
		.procname	= "tx_qlen",
		.data		= &sysctl_dccp_tx_qlen,
		.maxlen		= sizeof(sysctl_dccp_tx_qlen),
		.mode		= 0644,
85 86
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &zero,
I
Ian McDonald 已提交
87
	},
G
Gerrit Renker 已提交
88 89 90 91 92 93 94
	{
		.procname	= "sync_ratelimit",
		.data		= &sysctl_dccp_sync_ratelimit,
		.maxlen		= sizeof(sysctl_dccp_sync_ratelimit),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_ms_jiffies,
	},
I
Ian McDonald 已提交
95

96 97 98
	{ .ctl_name = 0, }
};

99 100 101 102 103
static struct ctl_path dccp_path[] = {
	{ .procname = "net", .ctl_name = CTL_NET, },
	{ .procname = "dccp", .ctl_name = NET_DCCP, },
	{ .procname = "default", .ctl_name = NET_DCCP_DEFAULT, },
	{ }
104 105 106 107 108 109
};

static struct ctl_table_header *dccp_table_header;

int __init dccp_sysctl_init(void)
{
110 111
	dccp_table_header = register_sysctl_paths(dccp_path,
			dccp_default_table);
112 113 114 115 116 117 118 119 120 121 122

	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;
	}
}