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; |
Gerrit Renker | bfbb234 | 2011-01-02 18:15:58 +0100 | [diff] [blame] | 24 | static unsigned long seqw_min = DCCPF_SEQ_WMIN, |
| 25 | seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */ |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 26 | |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 27 | static struct ctl_table dccp_default_table[] = { |
| 28 | { |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 29 | .procname = "seq_window", |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 30 | .data = &sysctl_dccp_sequence_window, |
| 31 | .maxlen = sizeof(sysctl_dccp_sequence_window), |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 32 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 33 | .proc_handler = proc_doulongvec_minmax, |
| 34 | .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */ |
Gerrit Renker | bfbb234 | 2011-01-02 18:15:58 +0100 | [diff] [blame] | 35 | .extra2 = &seqw_max, |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 36 | }, |
| 37 | { |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 38 | .procname = "rx_ccid", |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 39 | .data = &sysctl_dccp_rx_ccid, |
| 40 | .maxlen = sizeof(sysctl_dccp_rx_ccid), |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 41 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 42 | .proc_handler = proc_dointvec_minmax, |
| 43 | .extra1 = &zero, |
| 44 | .extra2 = &u8_max, /* RFC 4340, 10. */ |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 45 | }, |
| 46 | { |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 47 | .procname = "tx_ccid", |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 48 | .data = &sysctl_dccp_tx_ccid, |
| 49 | .maxlen = sizeof(sysctl_dccp_tx_ccid), |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 50 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 51 | .proc_handler = proc_dointvec_minmax, |
| 52 | .extra1 = &zero, |
| 53 | .extra2 = &u8_max, /* RFC 4340, 10. */ |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 54 | }, |
| 55 | { |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 56 | .procname = "request_retries", |
| 57 | .data = &sysctl_dccp_request_retries, |
| 58 | .maxlen = sizeof(sysctl_dccp_request_retries), |
| 59 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 60 | .proc_handler = proc_dointvec_minmax, |
| 61 | .extra1 = &zero, |
| 62 | .extra2 = &u8_max, |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 63 | }, |
| 64 | { |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 65 | .procname = "retries1", |
| 66 | .data = &sysctl_dccp_retries1, |
| 67 | .maxlen = sizeof(sysctl_dccp_retries1), |
| 68 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 69 | .proc_handler = proc_dointvec_minmax, |
| 70 | .extra1 = &zero, |
| 71 | .extra2 = &u8_max, |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 72 | }, |
| 73 | { |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 74 | .procname = "retries2", |
| 75 | .data = &sysctl_dccp_retries2, |
| 76 | .maxlen = sizeof(sysctl_dccp_retries2), |
| 77 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 78 | .proc_handler = proc_dointvec_minmax, |
| 79 | .extra1 = &zero, |
| 80 | .extra2 = &u8_max, |
Gerrit Renker | 2e2e9e9 | 2006-11-13 13:23:52 -0200 | [diff] [blame] | 81 | }, |
Ian McDonald | 82e3ab9 | 2006-11-20 19:19:32 -0200 | [diff] [blame] | 82 | { |
Ian McDonald | 82e3ab9 | 2006-11-20 19:19:32 -0200 | [diff] [blame] | 83 | .procname = "tx_qlen", |
| 84 | .data = &sysctl_dccp_tx_qlen, |
| 85 | .maxlen = sizeof(sysctl_dccp_tx_qlen), |
| 86 | .mode = 0644, |
Gerrit Renker | 883ca83 | 2009-01-16 23:36:32 +0000 | [diff] [blame] | 87 | .proc_handler = proc_dointvec_minmax, |
| 88 | .extra1 = &zero, |
Ian McDonald | 82e3ab9 | 2006-11-20 19:19:32 -0200 | [diff] [blame] | 89 | }, |
Gerrit Renker | a94f0f9 | 2007-09-26 11:31:49 -0300 | [diff] [blame] | 90 | { |
| 91 | .procname = "sync_ratelimit", |
| 92 | .data = &sysctl_dccp_sync_ratelimit, |
| 93 | .maxlen = sizeof(sysctl_dccp_sync_ratelimit), |
| 94 | .mode = 0644, |
| 95 | .proc_handler = proc_dointvec_ms_jiffies, |
| 96 | }, |
Ian McDonald | 82e3ab9 | 2006-11-20 19:19:32 -0200 | [diff] [blame] | 97 | |
Eric W. Biederman | f8572d8 | 2009-11-05 13:32:03 -0800 | [diff] [blame] | 98 | { } |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 99 | }; |
| 100 | |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 101 | static struct ctl_table_header *dccp_table_header; |
| 102 | |
| 103 | int __init dccp_sysctl_init(void) |
| 104 | { |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 105 | dccp_table_header = register_net_sysctl(&init_net, "net/dccp/default", |
Pavel Emelyanov | b5ccd79 | 2008-01-09 00:30:05 -0800 | [diff] [blame] | 106 | dccp_default_table); |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 107 | |
| 108 | return dccp_table_header != NULL ? 0 : -ENOMEM; |
| 109 | } |
| 110 | |
| 111 | void dccp_sysctl_exit(void) |
| 112 | { |
| 113 | if (dccp_table_header != NULL) { |
Eric W. Biederman | 5dd3df1 | 2012-04-19 13:24:33 +0000 | [diff] [blame] | 114 | unregister_net_sysctl_table(dccp_table_header); |
Arnaldo Carvalho de Melo | e55d912 | 2006-03-20 19:25:02 -0800 | [diff] [blame] | 115 | dccp_table_header = NULL; |
| 116 | } |
| 117 | } |