blob: 53731e45403c83ba2edf48da01e71aeda48359b0 [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,
wangweidong8ba7e7b2014-05-13 10:57:58 +080023 one = 1,
Gerrit Renker883ca832009-01-16 23:36:32 +000024 u8_max = 0xFF;
Gerrit Renkerbfbb2342011-01-02 18:15:58 +010025static unsigned long seqw_min = DCCPF_SEQ_WMIN,
26 seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */
Gerrit Renker883ca832009-01-16 23:36:32 +000027
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080028static struct ctl_table dccp_default_table[] = {
29 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080030 .procname = "seq_window",
Gerrit Renker883ca832009-01-16 23:36:32 +000031 .data = &sysctl_dccp_sequence_window,
32 .maxlen = sizeof(sysctl_dccp_sequence_window),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080033 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000034 .proc_handler = proc_doulongvec_minmax,
35 .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */
Gerrit Renkerbfbb2342011-01-02 18:15:58 +010036 .extra2 = &seqw_max,
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080037 },
38 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080039 .procname = "rx_ccid",
Gerrit Renker883ca832009-01-16 23:36:32 +000040 .data = &sysctl_dccp_rx_ccid,
41 .maxlen = sizeof(sysctl_dccp_rx_ccid),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080042 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000043 .proc_handler = proc_dointvec_minmax,
44 .extra1 = &zero,
45 .extra2 = &u8_max, /* RFC 4340, 10. */
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080046 },
47 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080048 .procname = "tx_ccid",
Gerrit Renker883ca832009-01-16 23:36:32 +000049 .data = &sysctl_dccp_tx_ccid,
50 .maxlen = sizeof(sysctl_dccp_tx_ccid),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080051 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000052 .proc_handler = proc_dointvec_minmax,
53 .extra1 = &zero,
54 .extra2 = &u8_max, /* RFC 4340, 10. */
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080055 },
56 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020057 .procname = "request_retries",
58 .data = &sysctl_dccp_request_retries,
59 .maxlen = sizeof(sysctl_dccp_request_retries),
60 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000061 .proc_handler = proc_dointvec_minmax,
wangweidong8ba7e7b2014-05-13 10:57:58 +080062 .extra1 = &one,
Gerrit Renker883ca832009-01-16 23:36:32 +000063 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020064 },
65 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020066 .procname = "retries1",
67 .data = &sysctl_dccp_retries1,
68 .maxlen = sizeof(sysctl_dccp_retries1),
69 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000070 .proc_handler = proc_dointvec_minmax,
71 .extra1 = &zero,
72 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020073 },
74 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020075 .procname = "retries2",
76 .data = &sysctl_dccp_retries2,
77 .maxlen = sizeof(sysctl_dccp_retries2),
78 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000079 .proc_handler = proc_dointvec_minmax,
80 .extra1 = &zero,
81 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020082 },
Ian McDonald82e3ab92006-11-20 19:19:32 -020083 {
Ian McDonald82e3ab92006-11-20 19:19:32 -020084 .procname = "tx_qlen",
85 .data = &sysctl_dccp_tx_qlen,
86 .maxlen = sizeof(sysctl_dccp_tx_qlen),
87 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000088 .proc_handler = proc_dointvec_minmax,
89 .extra1 = &zero,
Ian McDonald82e3ab92006-11-20 19:19:32 -020090 },
Gerrit Renkera94f0f92007-09-26 11:31:49 -030091 {
92 .procname = "sync_ratelimit",
93 .data = &sysctl_dccp_sync_ratelimit,
94 .maxlen = sizeof(sysctl_dccp_sync_ratelimit),
95 .mode = 0644,
96 .proc_handler = proc_dointvec_ms_jiffies,
97 },
Ian McDonald82e3ab92006-11-20 19:19:32 -020098
Eric W. Biedermanf8572d82009-11-05 13:32:03 -080099 { }
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800100};
101
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800102static struct ctl_table_header *dccp_table_header;
103
104int __init dccp_sysctl_init(void)
105{
Eric W. Biedermanec8f23c2012-04-19 13:44:49 +0000106 dccp_table_header = register_net_sysctl(&init_net, "net/dccp/default",
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800107 dccp_default_table);
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800108
109 return dccp_table_header != NULL ? 0 : -ENOMEM;
110}
111
112void dccp_sysctl_exit(void)
113{
114 if (dccp_table_header != NULL) {
Eric W. Biederman5dd3df12012-04-19 13:24:33 +0000115 unregister_net_sysctl_table(dccp_table_header);
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800116 dccp_table_header = NULL;
117 }
118}