blob: ee8d4f5afa72262c96b220bfdd5ef954d11daa38 [file] [log] [blame]
Thomas Gleixnere46bd702019-05-31 01:09:47 -07001// SPDX-License-Identifier: GPL-2.0-only
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -08002/*
3 * net/dccp/sysctl.c
4 *
5 * An implementation of the DCCP protocol
6 * Arnaldo Carvalho de Melo <acme@mandriva.com>
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -08007 */
8
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -08009#include <linux/mm.h>
10#include <linux/sysctl.h>
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020011#include "dccp.h"
Ian McDonald2a0109a2006-08-26 19:15:35 -070012#include "feat.h"
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080013
14#ifndef CONFIG_SYSCTL
15#error This file should not be compiled without CONFIG_SYSCTL defined
16#endif
17
Gerrit Renker883ca832009-01-16 23:36:32 +000018/* Boundary values */
Matteo Croceeec48442019-07-18 15:58:50 -070019static int u8_max = 0xFF;
Gerrit Renkerbfbb2342011-01-02 18:15:58 +010020static unsigned long seqw_min = DCCPF_SEQ_WMIN,
21 seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */
Gerrit Renker883ca832009-01-16 23:36:32 +000022
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080023static struct ctl_table dccp_default_table[] = {
24 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080025 .procname = "seq_window",
Gerrit Renker883ca832009-01-16 23:36:32 +000026 .data = &sysctl_dccp_sequence_window,
27 .maxlen = sizeof(sysctl_dccp_sequence_window),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080028 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000029 .proc_handler = proc_doulongvec_minmax,
30 .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */
Gerrit Renkerbfbb2342011-01-02 18:15:58 +010031 .extra2 = &seqw_max,
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080032 },
33 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080034 .procname = "rx_ccid",
Gerrit Renker883ca832009-01-16 23:36:32 +000035 .data = &sysctl_dccp_rx_ccid,
36 .maxlen = sizeof(sysctl_dccp_rx_ccid),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080037 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000038 .proc_handler = proc_dointvec_minmax,
Matteo Croceeec48442019-07-18 15:58:50 -070039 .extra1 = SYSCTL_ZERO,
Gerrit Renker883ca832009-01-16 23:36:32 +000040 .extra2 = &u8_max, /* RFC 4340, 10. */
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080041 },
42 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080043 .procname = "tx_ccid",
Gerrit Renker883ca832009-01-16 23:36:32 +000044 .data = &sysctl_dccp_tx_ccid,
45 .maxlen = sizeof(sysctl_dccp_tx_ccid),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080046 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000047 .proc_handler = proc_dointvec_minmax,
Matteo Croceeec48442019-07-18 15:58:50 -070048 .extra1 = SYSCTL_ZERO,
Gerrit Renker883ca832009-01-16 23:36:32 +000049 .extra2 = &u8_max, /* RFC 4340, 10. */
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080050 },
51 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020052 .procname = "request_retries",
53 .data = &sysctl_dccp_request_retries,
54 .maxlen = sizeof(sysctl_dccp_request_retries),
55 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000056 .proc_handler = proc_dointvec_minmax,
Matteo Croceeec48442019-07-18 15:58:50 -070057 .extra1 = SYSCTL_ONE,
Gerrit Renker883ca832009-01-16 23:36:32 +000058 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020059 },
60 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020061 .procname = "retries1",
62 .data = &sysctl_dccp_retries1,
63 .maxlen = sizeof(sysctl_dccp_retries1),
64 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000065 .proc_handler = proc_dointvec_minmax,
Matteo Croceeec48442019-07-18 15:58:50 -070066 .extra1 = SYSCTL_ZERO,
Gerrit Renker883ca832009-01-16 23:36:32 +000067 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020068 },
69 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020070 .procname = "retries2",
71 .data = &sysctl_dccp_retries2,
72 .maxlen = sizeof(sysctl_dccp_retries2),
73 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000074 .proc_handler = proc_dointvec_minmax,
Matteo Croceeec48442019-07-18 15:58:50 -070075 .extra1 = SYSCTL_ZERO,
Gerrit Renker883ca832009-01-16 23:36:32 +000076 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020077 },
Ian McDonald82e3ab92006-11-20 19:19:32 -020078 {
Ian McDonald82e3ab92006-11-20 19:19:32 -020079 .procname = "tx_qlen",
80 .data = &sysctl_dccp_tx_qlen,
81 .maxlen = sizeof(sysctl_dccp_tx_qlen),
82 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000083 .proc_handler = proc_dointvec_minmax,
Matteo Croceeec48442019-07-18 15:58:50 -070084 .extra1 = SYSCTL_ZERO,
Ian McDonald82e3ab92006-11-20 19:19:32 -020085 },
Gerrit Renkera94f0f92007-09-26 11:31:49 -030086 {
87 .procname = "sync_ratelimit",
88 .data = &sysctl_dccp_sync_ratelimit,
89 .maxlen = sizeof(sysctl_dccp_sync_ratelimit),
90 .mode = 0644,
91 .proc_handler = proc_dointvec_ms_jiffies,
92 },
Ian McDonald82e3ab92006-11-20 19:19:32 -020093
Eric W. Biedermanf8572d82009-11-05 13:32:03 -080094 { }
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080095};
96
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080097static struct ctl_table_header *dccp_table_header;
98
99int __init dccp_sysctl_init(void)
100{
Eric W. Biedermanec8f23c2012-04-19 13:44:49 +0000101 dccp_table_header = register_net_sysctl(&init_net, "net/dccp/default",
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800102 dccp_default_table);
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800103
104 return dccp_table_header != NULL ? 0 : -ENOMEM;
105}
106
107void dccp_sysctl_exit(void)
108{
109 if (dccp_table_header != NULL) {
Eric W. Biederman5dd3df12012-04-19 13:24:33 +0000110 unregister_net_sysctl_table(dccp_table_header);
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800111 dccp_table_header = NULL;
112 }
113}