1e46bd709SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2e55d912fSArnaldo Carvalho de Melo /*
3e55d912fSArnaldo Carvalho de Melo * net/dccp/sysctl.c
4e55d912fSArnaldo Carvalho de Melo *
5e55d912fSArnaldo Carvalho de Melo * An implementation of the DCCP protocol
6e55d912fSArnaldo Carvalho de Melo * Arnaldo Carvalho de Melo <acme@mandriva.com>
7e55d912fSArnaldo Carvalho de Melo */
8e55d912fSArnaldo Carvalho de Melo
9e55d912fSArnaldo Carvalho de Melo #include <linux/mm.h>
10e55d912fSArnaldo Carvalho de Melo #include <linux/sysctl.h>
112e2e9e92SGerrit Renker #include "dccp.h"
122a0109a7SIan McDonald #include "feat.h"
13e55d912fSArnaldo Carvalho de Melo
14e55d912fSArnaldo Carvalho de Melo #ifndef CONFIG_SYSCTL
15e55d912fSArnaldo Carvalho de Melo #error This file should not be compiled without CONFIG_SYSCTL defined
16e55d912fSArnaldo Carvalho de Melo #endif
17e55d912fSArnaldo Carvalho de Melo
18883ca833SGerrit Renker /* Boundary values */
19*eec4844fSMatteo Croce static int u8_max = 0xFF;
20bfbb2346SGerrit Renker static unsigned long seqw_min = DCCPF_SEQ_WMIN,
21bfbb2346SGerrit Renker seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */
22883ca833SGerrit Renker
23e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_default_table[] = {
24e55d912fSArnaldo Carvalho de Melo {
25e55d912fSArnaldo Carvalho de Melo .procname = "seq_window",
26883ca833SGerrit Renker .data = &sysctl_dccp_sequence_window,
27883ca833SGerrit Renker .maxlen = sizeof(sysctl_dccp_sequence_window),
28e55d912fSArnaldo Carvalho de Melo .mode = 0644,
29883ca833SGerrit Renker .proc_handler = proc_doulongvec_minmax,
30883ca833SGerrit Renker .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */
31bfbb2346SGerrit Renker .extra2 = &seqw_max,
32e55d912fSArnaldo Carvalho de Melo },
33e55d912fSArnaldo Carvalho de Melo {
34e55d912fSArnaldo Carvalho de Melo .procname = "rx_ccid",
35883ca833SGerrit Renker .data = &sysctl_dccp_rx_ccid,
36883ca833SGerrit Renker .maxlen = sizeof(sysctl_dccp_rx_ccid),
37e55d912fSArnaldo Carvalho de Melo .mode = 0644,
38883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax,
39*eec4844fSMatteo Croce .extra1 = SYSCTL_ZERO,
40883ca833SGerrit Renker .extra2 = &u8_max, /* RFC 4340, 10. */
41e55d912fSArnaldo Carvalho de Melo },
42e55d912fSArnaldo Carvalho de Melo {
43e55d912fSArnaldo Carvalho de Melo .procname = "tx_ccid",
44883ca833SGerrit Renker .data = &sysctl_dccp_tx_ccid,
45883ca833SGerrit Renker .maxlen = sizeof(sysctl_dccp_tx_ccid),
46e55d912fSArnaldo Carvalho de Melo .mode = 0644,
47883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax,
48*eec4844fSMatteo Croce .extra1 = SYSCTL_ZERO,
49883ca833SGerrit Renker .extra2 = &u8_max, /* RFC 4340, 10. */
50e55d912fSArnaldo Carvalho de Melo },
51e55d912fSArnaldo Carvalho de Melo {
522e2e9e92SGerrit Renker .procname = "request_retries",
532e2e9e92SGerrit Renker .data = &sysctl_dccp_request_retries,
542e2e9e92SGerrit Renker .maxlen = sizeof(sysctl_dccp_request_retries),
552e2e9e92SGerrit Renker .mode = 0644,
56883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax,
57*eec4844fSMatteo Croce .extra1 = SYSCTL_ONE,
58883ca833SGerrit Renker .extra2 = &u8_max,
592e2e9e92SGerrit Renker },
602e2e9e92SGerrit Renker {
612e2e9e92SGerrit Renker .procname = "retries1",
622e2e9e92SGerrit Renker .data = &sysctl_dccp_retries1,
632e2e9e92SGerrit Renker .maxlen = sizeof(sysctl_dccp_retries1),
642e2e9e92SGerrit Renker .mode = 0644,
65883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax,
66*eec4844fSMatteo Croce .extra1 = SYSCTL_ZERO,
67883ca833SGerrit Renker .extra2 = &u8_max,
682e2e9e92SGerrit Renker },
692e2e9e92SGerrit Renker {
702e2e9e92SGerrit Renker .procname = "retries2",
712e2e9e92SGerrit Renker .data = &sysctl_dccp_retries2,
722e2e9e92SGerrit Renker .maxlen = sizeof(sysctl_dccp_retries2),
732e2e9e92SGerrit Renker .mode = 0644,
74883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax,
75*eec4844fSMatteo Croce .extra1 = SYSCTL_ZERO,
76883ca833SGerrit Renker .extra2 = &u8_max,
772e2e9e92SGerrit Renker },
7882e3ab9dSIan McDonald {
7982e3ab9dSIan McDonald .procname = "tx_qlen",
8082e3ab9dSIan McDonald .data = &sysctl_dccp_tx_qlen,
8182e3ab9dSIan McDonald .maxlen = sizeof(sysctl_dccp_tx_qlen),
8282e3ab9dSIan McDonald .mode = 0644,
83883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax,
84*eec4844fSMatteo Croce .extra1 = SYSCTL_ZERO,
8582e3ab9dSIan McDonald },
86a94f0f97SGerrit Renker {
87a94f0f97SGerrit Renker .procname = "sync_ratelimit",
88a94f0f97SGerrit Renker .data = &sysctl_dccp_sync_ratelimit,
89a94f0f97SGerrit Renker .maxlen = sizeof(sysctl_dccp_sync_ratelimit),
90a94f0f97SGerrit Renker .mode = 0644,
91a94f0f97SGerrit Renker .proc_handler = proc_dointvec_ms_jiffies,
92a94f0f97SGerrit Renker },
93e55d912fSArnaldo Carvalho de Melo };
94e55d912fSArnaldo Carvalho de Melo
95e55d912fSArnaldo Carvalho de Melo static struct ctl_table_header *dccp_table_header;
96e55d912fSArnaldo Carvalho de Melo
dccp_sysctl_init(void)97e55d912fSArnaldo Carvalho de Melo int __init dccp_sysctl_init(void)
98e55d912fSArnaldo Carvalho de Melo {
99ec8f23ceSEric W. Biederman dccp_table_header = register_net_sysctl(&init_net, "net/dccp/default",
100b5ccd792SPavel Emelyanov dccp_default_table);
101e55d912fSArnaldo Carvalho de Melo
102e55d912fSArnaldo Carvalho de Melo return dccp_table_header != NULL ? 0 : -ENOMEM;
103e55d912fSArnaldo Carvalho de Melo }
104e55d912fSArnaldo Carvalho de Melo
dccp_sysctl_exit(void)105e55d912fSArnaldo Carvalho de Melo void dccp_sysctl_exit(void)
106e55d912fSArnaldo Carvalho de Melo {
107e55d912fSArnaldo Carvalho de Melo if (dccp_table_header != NULL) {
1085dd3df10SEric W. Biederman unregister_net_sysctl_table(dccp_table_header);
109e55d912fSArnaldo Carvalho de Melo dccp_table_header = NULL;
110e55d912fSArnaldo Carvalho de Melo }
111e55d912fSArnaldo Carvalho de Melo }
112