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