blob: a5a1856234e76bd32368b799c49ab43520092532 [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;
24static unsigned long seqw_min = 32;
25
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080026static struct ctl_table dccp_default_table[] = {
27 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080028 .procname = "seq_window",
Gerrit Renker883ca832009-01-16 23:36:32 +000029 .data = &sysctl_dccp_sequence_window,
30 .maxlen = sizeof(sysctl_dccp_sequence_window),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080031 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000032 .proc_handler = proc_doulongvec_minmax,
33 .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080034 },
35 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080036 .procname = "rx_ccid",
Gerrit Renker883ca832009-01-16 23:36:32 +000037 .data = &sysctl_dccp_rx_ccid,
38 .maxlen = sizeof(sysctl_dccp_rx_ccid),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080039 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000040 .proc_handler = proc_dointvec_minmax,
41 .extra1 = &zero,
42 .extra2 = &u8_max, /* RFC 4340, 10. */
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080043 },
44 {
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080045 .procname = "tx_ccid",
Gerrit Renker883ca832009-01-16 23:36:32 +000046 .data = &sysctl_dccp_tx_ccid,
47 .maxlen = sizeof(sysctl_dccp_tx_ccid),
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080048 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000049 .proc_handler = proc_dointvec_minmax,
50 .extra1 = &zero,
51 .extra2 = &u8_max, /* RFC 4340, 10. */
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080052 },
53 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020054 .procname = "request_retries",
55 .data = &sysctl_dccp_request_retries,
56 .maxlen = sizeof(sysctl_dccp_request_retries),
57 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000058 .proc_handler = proc_dointvec_minmax,
59 .extra1 = &zero,
60 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020061 },
62 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020063 .procname = "retries1",
64 .data = &sysctl_dccp_retries1,
65 .maxlen = sizeof(sysctl_dccp_retries1),
66 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000067 .proc_handler = proc_dointvec_minmax,
68 .extra1 = &zero,
69 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020070 },
71 {
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020072 .procname = "retries2",
73 .data = &sysctl_dccp_retries2,
74 .maxlen = sizeof(sysctl_dccp_retries2),
75 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000076 .proc_handler = proc_dointvec_minmax,
77 .extra1 = &zero,
78 .extra2 = &u8_max,
Gerrit Renker2e2e9e92006-11-13 13:23:52 -020079 },
Ian McDonald82e3ab92006-11-20 19:19:32 -020080 {
Ian McDonald82e3ab92006-11-20 19:19:32 -020081 .procname = "tx_qlen",
82 .data = &sysctl_dccp_tx_qlen,
83 .maxlen = sizeof(sysctl_dccp_tx_qlen),
84 .mode = 0644,
Gerrit Renker883ca832009-01-16 23:36:32 +000085 .proc_handler = proc_dointvec_minmax,
86 .extra1 = &zero,
Ian McDonald82e3ab92006-11-20 19:19:32 -020087 },
Gerrit Renkera94f0f92007-09-26 11:31:49 -030088 {
89 .procname = "sync_ratelimit",
90 .data = &sysctl_dccp_sync_ratelimit,
91 .maxlen = sizeof(sysctl_dccp_sync_ratelimit),
92 .mode = 0644,
93 .proc_handler = proc_dointvec_ms_jiffies,
94 },
Ian McDonald82e3ab92006-11-20 19:19:32 -020095
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -080096 { .ctl_name = 0, }
97};
98
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -080099static struct ctl_path dccp_path[] = {
100 { .procname = "net", .ctl_name = CTL_NET, },
101 { .procname = "dccp", .ctl_name = NET_DCCP, },
102 { .procname = "default", .ctl_name = NET_DCCP_DEFAULT, },
103 { }
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800104};
105
106static struct ctl_table_header *dccp_table_header;
107
108int __init dccp_sysctl_init(void)
109{
Pavel Emelyanovb5ccd792008-01-09 00:30:05 -0800110 dccp_table_header = register_sysctl_paths(dccp_path,
111 dccp_default_table);
Arnaldo Carvalho de Meloe55d9122006-03-20 19:25:02 -0800112
113 return dccp_table_header != NULL ? 0 : -ENOMEM;
114}
115
116void dccp_sysctl_exit(void)
117{
118 if (dccp_table_header != NULL) {
119 unregister_sysctl_table(dccp_table_header);
120 dccp_table_header = NULL;
121 }
122}