aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/sysctl.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2006-03-20 19:25:02 -0800
committerDavid S. Miller <davem@davemloft.net>2006-03-20 19:25:02 -0800
commite55d912f5b75723159348a7fc7692f869a86636a (patch)
treec00be180cac20e4247ffda446ad266d885a1a811 /net/dccp/sysctl.c
parent[DCCP]: Call dccp_feat_init more early in dccp_v4_init_sock (diff)
downloadlinux-dev-e55d912f5b75723159348a7fc7692f869a86636a.tar.xz
linux-dev-e55d912f5b75723159348a7fc7692f869a86636a.zip
[DCCP] feat: Introduce sysctls for the default features
[root@qemu ~]# for a in /proc/sys/net/dccp/default/* ; do echo $a ; cat $a ; done /proc/sys/net/dccp/default/ack_ratio 2 /proc/sys/net/dccp/default/rx_ccid 3 /proc/sys/net/dccp/default/send_ackvec 1 /proc/sys/net/dccp/default/send_ndp 1 /proc/sys/net/dccp/default/seq_window 100 /proc/sys/net/dccp/default/tx_ccid 3 [root@qemu ~]# So if wanting to test ccid3 as the tx CCID one can just do: [root@qemu ~]# echo 3 > /proc/sys/net/dccp/default/tx_ccid [root@qemu ~]# echo 2 > /proc/sys/net/dccp/default/rx_ccid [root@qemu ~]# cat /proc/sys/net/dccp/default/[tr]x_ccid 2 3 [root@qemu ~]# Of course we also need the setsockopt for each app to tell its preferences, but for testing or defining something other than CCID2 as the default for apps that don't explicitely set their preference the sysctl interface is handy. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/sysctl.c')
-rw-r--r--net/dccp/sysctl.c124
1 files changed, 124 insertions, 0 deletions
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 @@
+/*
+ * net/dccp/sysctl.c
+ *
+ * An implementation of the DCCP protocol
+ * Arnaldo Carvalho de Melo <acme@mandriva.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License v2
+ * as published by the Free Software Foundation.
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+#ifndef CONFIG_SYSCTL
+#error This file should not be compiled without CONFIG_SYSCTL defined
+#endif
+
+extern int dccp_feat_default_sequence_window;
+extern int dccp_feat_default_rx_ccid;
+extern int dccp_feat_default_tx_ccid;
+extern int dccp_feat_default_ack_ratio;
+extern int dccp_feat_default_send_ack_vector;
+extern int dccp_feat_default_send_ndp_count;
+
+static struct ctl_table dccp_default_table[] = {
+ {
+ .ctl_name = NET_DCCP_DEFAULT_SEQ_WINDOW,
+ .procname = "seq_window",
+ .data = &dccp_feat_default_sequence_window,
+ .maxlen = sizeof(dccp_feat_default_sequence_window),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ {
+ .ctl_name = NET_DCCP_DEFAULT_RX_CCID,
+ .procname = "rx_ccid",
+ .data = &dccp_feat_default_rx_ccid,
+ .maxlen = sizeof(dccp_feat_default_rx_ccid),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ {
+ .ctl_name = NET_DCCP_DEFAULT_TX_CCID,
+ .procname = "tx_ccid",
+ .data = &dccp_feat_default_tx_ccid,
+ .maxlen = sizeof(dccp_feat_default_tx_ccid),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ {
+ .ctl_name = NET_DCCP_DEFAULT_ACK_RATIO,
+ .procname = "ack_ratio",
+ .data = &dccp_feat_default_ack_ratio,
+ .maxlen = sizeof(dccp_feat_default_ack_ratio),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ {
+ .ctl_name = NET_DCCP_DEFAULT_SEND_ACKVEC,
+ .procname = "send_ackvec",
+ .data = &dccp_feat_default_send_ack_vector,
+ .maxlen = sizeof(dccp_feat_default_send_ack_vector),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ {
+ .ctl_name = NET_DCCP_DEFAULT_SEND_NDP,
+ .procname = "send_ndp",
+ .data = &dccp_feat_default_send_ndp_count,
+ .maxlen = sizeof(dccp_feat_default_send_ndp_count),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ { .ctl_name = 0, }
+};
+
+static struct ctl_table dccp_table[] = {
+ {
+ .ctl_name = NET_DCCP_DEFAULT,
+ .procname = "default",
+ .mode = 0555,
+ .child = dccp_default_table,
+ },
+ { .ctl_name = 0, },
+};
+
+static struct ctl_table dccp_dir_table[] = {
+ {
+ .ctl_name = NET_DCCP,
+ .procname = "dccp",
+ .mode = 0555,
+ .child = dccp_table,
+ },
+ { .ctl_name = 0, },
+};
+
+static struct ctl_table dccp_root_table[] = {
+ {
+ .ctl_name = CTL_NET,
+ .procname = "net",
+ .mode = 0555,
+ .child = dccp_dir_table,
+ },
+ { .ctl_name = 0, },
+};
+
+static struct ctl_table_header *dccp_table_header;
+
+int __init dccp_sysctl_init(void)
+{
+ dccp_table_header = register_sysctl_table(dccp_root_table, 1);
+
+ return dccp_table_header != NULL ? 0 : -ENOMEM;
+}
+
+void dccp_sysctl_exit(void)
+{
+ if (dccp_table_header != NULL) {
+ unregister_sysctl_table(dccp_table_header);
+ dccp_table_header = NULL;
+ }
+}