aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/dccp/Makefile2
-rw-r--r--net/dccp/dccp.h14
-rw-r--r--net/dccp/options.c22
-rw-r--r--net/dccp/proto.c9
-rw-r--r--net/dccp/sysctl.c124
5 files changed, 160 insertions, 11 deletions
diff --git a/net/dccp/Makefile b/net/dccp/Makefile
index 5736acea1c86..7af0569fe4cb 100644
--- a/net/dccp/Makefile
+++ b/net/dccp/Makefile
@@ -11,6 +11,8 @@ dccp-$(CONFIG_IP_DCCP_ACKVEC) += ackvec.o
11 11
12obj-$(CONFIG_INET_DCCP_DIAG) += dccp_diag.o 12obj-$(CONFIG_INET_DCCP_DIAG) += dccp_diag.o
13 13
14dccp-$(CONFIG_SYSCTL) += sysctl.o
15
14dccp_diag-y := diag.o 16dccp_diag-y := diag.o
15 17
16obj-y += ccids/ 18obj-y += ccids/
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 1764adb4f15e..f059541f5a1d 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -433,4 +433,18 @@ static inline void timeval_sub_usecs(struct timeval *tv,
433 } 433 }
434} 434}
435 435
436#ifdef CONFIG_SYSCTL
437extern int dccp_sysctl_init(void);
438extern void dccp_sysctl_exit(void);
439#else
440static inline int dccp_sysctl_init(void)
441{
442 return 0;
443}
444
445static inline void dccp_sysctl_exit(void)
446{
447}
448#endif
449
436#endif /* _DCCP_H */ 450#endif /* _DCCP_H */
diff --git a/net/dccp/options.c b/net/dccp/options.c
index 7d73b33a6043..3ecd319c0f59 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -23,19 +23,21 @@
23#include "dccp.h" 23#include "dccp.h"
24#include "feat.h" 24#include "feat.h"
25 25
26/* stores the default values for new connection. may be changed with sysctl */ 26int dccp_feat_default_sequence_window = DCCPF_INITIAL_SEQUENCE_WINDOW;
27static const struct dccp_options dccpo_default_values = { 27int dccp_feat_default_rx_ccid = DCCPF_INITIAL_CCID;
28 .dccpo_sequence_window = DCCPF_INITIAL_SEQUENCE_WINDOW, 28int dccp_feat_default_tx_ccid = DCCPF_INITIAL_CCID;
29 .dccpo_rx_ccid = DCCPF_INITIAL_CCID, 29int dccp_feat_default_ack_ratio = DCCPF_INITIAL_ACK_RATIO;
30 .dccpo_tx_ccid = DCCPF_INITIAL_CCID, 30int dccp_feat_default_send_ack_vector = DCCPF_INITIAL_SEND_ACK_VECTOR;
31 .dccpo_ack_ratio = DCCPF_INITIAL_ACK_RATIO, 31int dccp_feat_default_send_ndp_count = DCCPF_INITIAL_SEND_NDP_COUNT;
32 .dccpo_send_ack_vector = DCCPF_INITIAL_SEND_ACK_VECTOR,
33 .dccpo_send_ndp_count = DCCPF_INITIAL_SEND_NDP_COUNT,
34};
35 32
36void dccp_options_init(struct dccp_options *dccpo) 33void dccp_options_init(struct dccp_options *dccpo)
37{ 34{
38 memcpy(dccpo, &dccpo_default_values, sizeof(*dccpo)); 35 dccpo->dccpo_sequence_window = dccp_feat_default_sequence_window;
36 dccpo->dccpo_rx_ccid = dccp_feat_default_rx_ccid;
37 dccpo->dccpo_tx_ccid = dccp_feat_default_tx_ccid;
38 dccpo->dccpo_ack_ratio = dccp_feat_default_ack_ratio;
39 dccpo->dccpo_send_ack_vector = dccp_feat_default_send_ack_vector;
40 dccpo->dccpo_send_ndp_count = dccp_feat_default_send_ndp_count;
39} 41}
40 42
41static u32 dccp_decode_value_var(const unsigned char *bf, const u8 len) 43static u32 dccp_decode_value_var(const unsigned char *bf, const u8 len)
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 53735ee2bbd1..6403e9306ddb 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -934,11 +934,17 @@ static int __init dccp_init(void)
934 if (rc) 934 if (rc)
935 goto out_unregister_protosw; 935 goto out_unregister_protosw;
936 936
937 rc = dccp_ctl_sock_init(); 937 rc = dccp_sysctl_init();
938 if (rc) 938 if (rc)
939 goto out_ackvec_exit; 939 goto out_ackvec_exit;
940
941 rc = dccp_ctl_sock_init();
942 if (rc)
943 goto out_sysctl_exit;
940out: 944out:
941 return rc; 945 return rc;
946out_sysctl_exit:
947 dccp_sysctl_exit();
942out_ackvec_exit: 948out_ackvec_exit:
943 dccp_ackvec_exit(); 949 dccp_ackvec_exit();
944out_unregister_protosw: 950out_unregister_protosw:
@@ -983,6 +989,7 @@ static void __exit dccp_fini(void)
983 kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); 989 kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep);
984 proto_unregister(&dccp_prot); 990 proto_unregister(&dccp_prot);
985 dccp_ackvec_exit(); 991 dccp_ackvec_exit();
992 dccp_sysctl_exit();
986} 993}
987 994
988module_init(dccp_init); 995module_init(dccp_init);
diff --git a/net/dccp/sysctl.c b/net/dccp/sysctl.c
new file mode 100644
index 000000000000..64c89e9c229e
--- /dev/null
+++ b/net/dccp/sysctl.c
@@ -0,0 +1,124 @@
1/*
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
12#include <linux/config.h>
13#include <linux/mm.h>
14#include <linux/sysctl.h>
15
16#ifndef CONFIG_SYSCTL
17#error This file should not be compiled without CONFIG_SYSCTL defined
18#endif
19
20extern int dccp_feat_default_sequence_window;
21extern int dccp_feat_default_rx_ccid;
22extern int dccp_feat_default_tx_ccid;
23extern int dccp_feat_default_ack_ratio;
24extern int dccp_feat_default_send_ack_vector;
25extern int dccp_feat_default_send_ndp_count;
26
27static struct ctl_table dccp_default_table[] = {
28 {
29 .ctl_name = NET_DCCP_DEFAULT_SEQ_WINDOW,
30 .procname = "seq_window",
31 .data = &dccp_feat_default_sequence_window,
32 .maxlen = sizeof(dccp_feat_default_sequence_window),
33 .mode = 0644,
34 .proc_handler = proc_dointvec,
35 },
36 {
37 .ctl_name = NET_DCCP_DEFAULT_RX_CCID,
38 .procname = "rx_ccid",
39 .data = &dccp_feat_default_rx_ccid,
40 .maxlen = sizeof(dccp_feat_default_rx_ccid),
41 .mode = 0644,
42 .proc_handler = proc_dointvec,
43 },
44 {
45 .ctl_name = NET_DCCP_DEFAULT_TX_CCID,
46 .procname = "tx_ccid",
47 .data = &dccp_feat_default_tx_ccid,
48 .maxlen = sizeof(dccp_feat_default_tx_ccid),
49 .mode = 0644,
50 .proc_handler = proc_dointvec,
51 },
52 {
53 .ctl_name = NET_DCCP_DEFAULT_ACK_RATIO,
54 .procname = "ack_ratio",
55 .data = &dccp_feat_default_ack_ratio,
56 .maxlen = sizeof(dccp_feat_default_ack_ratio),
57 .mode = 0644,
58 .proc_handler = proc_dointvec,
59 },
60 {
61 .ctl_name = NET_DCCP_DEFAULT_SEND_ACKVEC,
62 .procname = "send_ackvec",
63 .data = &dccp_feat_default_send_ack_vector,
64 .maxlen = sizeof(dccp_feat_default_send_ack_vector),
65 .mode = 0644,
66 .proc_handler = proc_dointvec,
67 },
68 {
69 .ctl_name = NET_DCCP_DEFAULT_SEND_NDP,
70 .procname = "send_ndp",
71 .data = &dccp_feat_default_send_ndp_count,
72 .maxlen = sizeof(dccp_feat_default_send_ndp_count),
73 .mode = 0644,
74 .proc_handler = proc_dointvec,
75 },
76 { .ctl_name = 0, }
77};
78
79static struct ctl_table dccp_table[] = {
80 {
81 .ctl_name = NET_DCCP_DEFAULT,
82 .procname = "default",
83 .mode = 0555,
84 .child = dccp_default_table,
85 },
86 { .ctl_name = 0, },
87};
88
89static struct ctl_table dccp_dir_table[] = {
90 {
91 .ctl_name = NET_DCCP,
92 .procname = "dccp",
93 .mode = 0555,
94 .child = dccp_table,
95 },
96 { .ctl_name = 0, },
97};
98
99static struct ctl_table dccp_root_table[] = {
100 {
101 .ctl_name = CTL_NET,
102 .procname = "net",
103 .mode = 0555,
104 .child = dccp_dir_table,
105 },
106 { .ctl_name = 0, },
107};
108
109static struct ctl_table_header *dccp_table_header;
110
111int __init dccp_sysctl_init(void)
112{
113 dccp_table_header = register_sysctl_table(dccp_root_table, 1);
114
115 return dccp_table_header != NULL ? 0 : -ENOMEM;
116}
117
118void dccp_sysctl_exit(void)
119{
120 if (dccp_table_header != NULL) {
121 unregister_sysctl_table(dccp_table_header);
122 dccp_table_header = NULL;
123 }
124}