blob: 607ab71b5a0cb3af65067e7d69badb862d5bfb5a [file] [log] [blame]
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -08001/*
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
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080012#include <linux/mm.h>
13#include <linux/sysctl.h>
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020014#include "dccp.h"
Ian McDonald2a0109a2006-08-26 19:15:35 -070015#include "feat.h"
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080016
17#ifndef CONFIG_SYSCTL
18#error This file should not be compiled without CONFIG_SYSCTL defined
19#endif
20
Gerrit Renker883ca832009-01-16 23:36:32 +000021/* Boundary values */
22static int zero = 0,
23 u8_max = 0xFF;
Gerrit Renkerbfbb2342011-01-02 18:15:58 +010024static unsigned long seqw_min = DCCPF_SEQ_WMIN,
25 seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */
Gerrit Renker883ca832009-01-16 23:36:32 +000026
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080027static struct ctl_table dccp_default_table[] = {
28 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080029 .procname = "seq_window",
Gerrit Renker883ca832009-01-16 23:36:32 +000030 .data = &sysctl_dccp_sequence_window,
31 .maxlen = sizeof(sysctl_dccp_sequence_window),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080032 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000033 .proc_handler = proc_doulongvec_minmax,
34 .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */
Gerrit Renkerbfbb2342011-01-02 18:15:58 +010035 .extra2 = &seqw_max,
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080036 },
37 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080038 .procname = "rx_ccid",
Gerrit Renker883ca832009-01-16 23:36:32 +000039 .data = &sysctl_dccp_rx_ccid,
40 .maxlen = sizeof(sysctl_dccp_rx_ccid),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080041 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000042 .proc_handler = proc_dointvec_minmax,
43 .extra1 = &zero,
44 .extra2 = &u8_max, /* RFC 4340, 10. */
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080045 },
46 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080047 .procname = "tx_ccid",
Gerrit Renker883ca832009-01-16 23:36:32 +000048 .data = &sysctl_dccp_tx_ccid,
49 .maxlen = sizeof(sysctl_dccp_tx_ccid),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080050 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000051 .proc_handler = proc_dointvec_minmax,
52 .extra1 = &zero,
53 .extra2 = &u8_max, /* RFC 4340, 10. */
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080054 },
55 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020056 .procname = "request_retries",
57 .data = &sysctl_dccp_request_retries,
58 .maxlen = sizeof(sysctl_dccp_request_retries),
59 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000060 .proc_handler = proc_dointvec_minmax,
61 .extra1 = &zero,
62 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020063 },
64 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020065 .procname = "retries1",
66 .data = &sysctl_dccp_retries1,
67 .maxlen = sizeof(sysctl_dccp_retries1),
68 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000069 .proc_handler = proc_dointvec_minmax,
70 .extra1 = &zero,
71 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020072 },
73 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020074 .procname = "retries2",
75 .data = &sysctl_dccp_retries2,
76 .maxlen = sizeof(sysctl_dccp_retries2),
77 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000078 .proc_handler = proc_dointvec_minmax,
79 .extra1 = &zero,
80 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020081 },
Ian McDonald82e3ab92006-11-20 19:19:32 -020082 {
Ian McDonald82e3ab92006-11-20 19:19:32 -020083 .procname = "tx_qlen",
84 .data = &sysctl_dccp_tx_qlen,
85 .maxlen = sizeof(sysctl_dccp_tx_qlen),
86 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000087 .proc_handler = proc_dointvec_minmax,
88 .extra1 = &zero,
Ian McDonald82e3ab92006-11-20 19:19:32 -020089 },
Gerrit Renkera94f0f92007-09-26 11:31:49 -030090 {
91 .procname = "sync_ratelimit",
92 .data = &sysctl_dccp_sync_ratelimit,
93 .maxlen = sizeof(sysctl_dccp_sync_ratelimit),
94 .mode = 0644,
95 .proc_handler = proc_dointvec_ms_jiffies,
96 },
Ian McDonald82e3ab92006-11-20 19:19:32 -020097
Eric W. Biedermanf8572d82009-11-05 13:32:03 -080098 { }
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080099};
100
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800101static struct ctl_table_header *dccp_table_header;
102
103int __init dccp_sysctl_init(void)
104{
Eric W. Biedermanec8f23c2012-04-19 13:44:49 +0000105 dccp_table_header = register_net_sysctl(&init_net, "net/dccp/default",
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800106 dccp_default_table);
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800107
108 return dccp_table_header != NULL ? 0 : -ENOMEM;
109}
110
111void dccp_sysctl_exit(void)
112{
113 if (dccp_table_header != NULL) {
Eric W. Biederman5dd3df12012-04-19 13:24:33 +0000114 unregister_net_sysctl_table(dccp_table_header);
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800115 dccp_table_header = NULL;
116 }
117}