Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 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 | |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 12 | #include <linux/mm.h> |
| 13 | #include <linux/sysctl.h> |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 14 | #include "dccp.h" |
Ian McDonald | 2a0109a | 2006-08-26 19:15:35 -0700 | [diff] [blame] | 15 | #include "feat.h" |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 16 | |
| 17 | #ifndef CONFIG_SYSCTL |
| 18 | #error This file should not be compiled without CONFIG_SYSCTL defined |
| 19 | #endif |
| 20 | |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 21 | /* Boundary values */ |
| 22 | static int zero = 0, |
| 23 | u8_max = 0xFF; |
| 24 | static unsigned long seqw_min = 32; |
| 25 | |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 26 | static struct ctl_table dccp_default_table[] = { |
| 27 | { |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 28 | .procname = "seq_window", |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 29 | .data = &sysctl_dccp_sequence_window, |
| 30 | .maxlen = sizeof(sysctl_dccp_sequence_window), |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 31 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 32 | .proc_handler = proc_doulongvec_minmax, |
| 33 | .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */ |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 34 | }, |
| 35 | { |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 36 | .procname = "rx_ccid", |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 37 | .data = &sysctl_dccp_rx_ccid, |
| 38 | .maxlen = sizeof(sysctl_dccp_rx_ccid), |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 39 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 40 | .proc_handler = proc_dointvec_minmax, |
| 41 | .extra1 = &zero, |
| 42 | .extra2 = &u8_max, /* RFC 4340, 10. */ |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 43 | }, |
| 44 | { |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 45 | .procname = "tx_ccid", |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 46 | .data = &sysctl_dccp_tx_ccid, |
| 47 | .maxlen = sizeof(sysctl_dccp_tx_ccid), |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 48 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 49 | .proc_handler = proc_dointvec_minmax, |
| 50 | .extra1 = &zero, |
| 51 | .extra2 = &u8_max, /* RFC 4340, 10. */ |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 52 | }, |
| 53 | { |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 54 | .procname = "request_retries", |
| 55 | .data = &sysctl_dccp_request_retries, |
| 56 | .maxlen = sizeof(sysctl_dccp_request_retries), |
| 57 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 58 | .proc_handler = proc_dointvec_minmax, |
| 59 | .extra1 = &zero, |
| 60 | .extra2 = &u8_max, |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 61 | }, |
| 62 | { |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 63 | .procname = "retries1", |
| 64 | .data = &sysctl_dccp_retries1, |
| 65 | .maxlen = sizeof(sysctl_dccp_retries1), |
| 66 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 67 | .proc_handler = proc_dointvec_minmax, |
| 68 | .extra1 = &zero, |
| 69 | .extra2 = &u8_max, |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 70 | }, |
| 71 | { |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 72 | .procname = "retries2", |
| 73 | .data = &sysctl_dccp_retries2, |
| 74 | .maxlen = sizeof(sysctl_dccp_retries2), |
| 75 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 76 | .proc_handler = proc_dointvec_minmax, |
| 77 | .extra1 = &zero, |
| 78 | .extra2 = &u8_max, |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 79 | }, |
Ian McDonald | 82e3ab9 | 2006-11-20 19:19:32 -0200 | [diff] [blame] | 80 | { |
Ian McDonald | 82e3ab9 | 2006-11-20 19:19:32 -0200 | [diff] [blame] | 81 | .procname = "tx_qlen", |
| 82 | .data = &sysctl_dccp_tx_qlen, |
| 83 | .maxlen = sizeof(sysctl_dccp_tx_qlen), |
| 84 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 85 | .proc_handler = proc_dointvec_minmax, |
| 86 | .extra1 = &zero, |
Ian McDonald | 82e3ab9 | 2006-11-20 19:19:32 -0200 | [diff] [blame] | 87 | }, |
Gerrit Renker | a94f0f9 | 2007-09-26 11:31:49 -0300 | [diff] [blame] | 88 | { |
| 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 McDonald | 82e3ab9 | 2006-11-20 19:19:32 -0200 | [diff] [blame] | 95 | |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 96 | { .ctl_name = 0, } |
| 97 | }; |
| 98 | |
Pavel Emelyanov | b5ccd79 | 2008-01-09 00:30:05 -0800 | [diff] [blame] | 99 | static 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 Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | static struct ctl_table_header *dccp_table_header; |
| 107 | |
| 108 | int __init dccp_sysctl_init(void) |
| 109 | { |
Pavel Emelyanov | b5ccd79 | 2008-01-09 00:30:05 -0800 | [diff] [blame] | 110 | dccp_table_header = register_sysctl_paths(dccp_path, |
| 111 | dccp_default_table); |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 112 | |
| 113 | return dccp_table_header != NULL ? 0 : -ENOMEM; |
| 114 | } |
| 115 | |
| 116 | void 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 | } |