Commit 8c5955d83ed26455a49d12e783cc2258d11279a9
Committed by
David S. Miller
1 parent
395dde20fb
Exists in
master
and in
7 other branches
[SCTP]: net/sctp/sysctl.c should #include <net/sctp/sctp.h>
Every file should #include the header files containing the prototypes of it's global functions. sctp.h contains the prototypes of sctp_sysctl_{,un}register(). Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 1 additions and 0 deletions Inline Diff
net/sctp/sysctl.c
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel reference Implementation |
2 | * (C) Copyright IBM Corp. 2002, 2004 | 2 | * (C) Copyright IBM Corp. 2002, 2004 |
3 | * Copyright (c) 2002 Intel Corp. | 3 | * Copyright (c) 2002 Intel Corp. |
4 | * | 4 | * |
5 | * This file is part of the SCTP kernel reference Implementation | 5 | * This file is part of the SCTP kernel reference Implementation |
6 | * | 6 | * |
7 | * Sysctl related interfaces for SCTP. | 7 | * Sysctl related interfaces for SCTP. |
8 | * | 8 | * |
9 | * The SCTP reference implementation is free software; | 9 | * The SCTP reference implementation is free software; |
10 | * you can redistribute it and/or modify it under the terms of | 10 | * you can redistribute it and/or modify it under the terms of |
11 | * the GNU General Public License as published by | 11 | * the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2, or (at your option) | 12 | * the Free Software Foundation; either version 2, or (at your option) |
13 | * any later version. | 13 | * any later version. |
14 | * | 14 | * |
15 | * The SCTP reference implementation is distributed in the hope that it | 15 | * The SCTP reference implementation is distributed in the hope that it |
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | * ************************ | 17 | * ************************ |
18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
19 | * See the GNU General Public License for more details. | 19 | * See the GNU General Public License for more details. |
20 | * | 20 | * |
21 | * You should have received a copy of the GNU General Public License | 21 | * You should have received a copy of the GNU General Public License |
22 | * along with GNU CC; see the file COPYING. If not, write to | 22 | * along with GNU CC; see the file COPYING. If not, write to |
23 | * the Free Software Foundation, 59 Temple Place - Suite 330, | 23 | * the Free Software Foundation, 59 Temple Place - Suite 330, |
24 | * Boston, MA 02111-1307, USA. | 24 | * Boston, MA 02111-1307, USA. |
25 | * | 25 | * |
26 | * Please send any bug reports or fixes you make to the | 26 | * Please send any bug reports or fixes you make to the |
27 | * email address(es): | 27 | * email address(es): |
28 | * lksctp developers <lksctp-developers@lists.sourceforge.net> | 28 | * lksctp developers <lksctp-developers@lists.sourceforge.net> |
29 | * | 29 | * |
30 | * Or submit a bug report through the following website: | 30 | * Or submit a bug report through the following website: |
31 | * http://www.sf.net/projects/lksctp | 31 | * http://www.sf.net/projects/lksctp |
32 | * | 32 | * |
33 | * Written or modified by: | 33 | * Written or modified by: |
34 | * Mingqin Liu <liuming@us.ibm.com> | 34 | * Mingqin Liu <liuming@us.ibm.com> |
35 | * Jon Grimm <jgrimm@us.ibm.com> | 35 | * Jon Grimm <jgrimm@us.ibm.com> |
36 | * Ardelle Fan <ardelle.fan@intel.com> | 36 | * Ardelle Fan <ardelle.fan@intel.com> |
37 | * Ryan Layer <rmlayer@us.ibm.com> | 37 | * Ryan Layer <rmlayer@us.ibm.com> |
38 | * Sridhar Samudrala <sri@us.ibm.com> | 38 | * Sridhar Samudrala <sri@us.ibm.com> |
39 | * | 39 | * |
40 | * Any bugs reported given to us we will try to fix... any fixes shared will | 40 | * Any bugs reported given to us we will try to fix... any fixes shared will |
41 | * be incorporated into the next SCTP release. | 41 | * be incorporated into the next SCTP release. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <net/sctp/structs.h> | 44 | #include <net/sctp/structs.h> |
45 | #include <net/sctp/sctp.h> | ||
45 | #include <linux/sysctl.h> | 46 | #include <linux/sysctl.h> |
46 | 47 | ||
47 | static ctl_handler sctp_sysctl_jiffies_ms; | 48 | static ctl_handler sctp_sysctl_jiffies_ms; |
48 | static long rto_timer_min = 1; | 49 | static long rto_timer_min = 1; |
49 | static long rto_timer_max = 86400000; /* One day */ | 50 | static long rto_timer_max = 86400000; /* One day */ |
50 | static long sack_timer_min = 1; | 51 | static long sack_timer_min = 1; |
51 | static long sack_timer_max = 500; | 52 | static long sack_timer_max = 500; |
52 | 53 | ||
53 | static ctl_table sctp_table[] = { | 54 | static ctl_table sctp_table[] = { |
54 | { | 55 | { |
55 | .ctl_name = NET_SCTP_RTO_INITIAL, | 56 | .ctl_name = NET_SCTP_RTO_INITIAL, |
56 | .procname = "rto_initial", | 57 | .procname = "rto_initial", |
57 | .data = &sctp_rto_initial, | 58 | .data = &sctp_rto_initial, |
58 | .maxlen = sizeof(long), | 59 | .maxlen = sizeof(long), |
59 | .mode = 0644, | 60 | .mode = 0644, |
60 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | 61 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, |
61 | .strategy = &sctp_sysctl_jiffies_ms, | 62 | .strategy = &sctp_sysctl_jiffies_ms, |
62 | .extra1 = &rto_timer_min, | 63 | .extra1 = &rto_timer_min, |
63 | .extra2 = &rto_timer_max | 64 | .extra2 = &rto_timer_max |
64 | }, | 65 | }, |
65 | { | 66 | { |
66 | .ctl_name = NET_SCTP_RTO_MIN, | 67 | .ctl_name = NET_SCTP_RTO_MIN, |
67 | .procname = "rto_min", | 68 | .procname = "rto_min", |
68 | .data = &sctp_rto_min, | 69 | .data = &sctp_rto_min, |
69 | .maxlen = sizeof(long), | 70 | .maxlen = sizeof(long), |
70 | .mode = 0644, | 71 | .mode = 0644, |
71 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | 72 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, |
72 | .strategy = &sctp_sysctl_jiffies_ms, | 73 | .strategy = &sctp_sysctl_jiffies_ms, |
73 | .extra1 = &rto_timer_min, | 74 | .extra1 = &rto_timer_min, |
74 | .extra2 = &rto_timer_max | 75 | .extra2 = &rto_timer_max |
75 | }, | 76 | }, |
76 | { | 77 | { |
77 | .ctl_name = NET_SCTP_RTO_MAX, | 78 | .ctl_name = NET_SCTP_RTO_MAX, |
78 | .procname = "rto_max", | 79 | .procname = "rto_max", |
79 | .data = &sctp_rto_max, | 80 | .data = &sctp_rto_max, |
80 | .maxlen = sizeof(long), | 81 | .maxlen = sizeof(long), |
81 | .mode = 0644, | 82 | .mode = 0644, |
82 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | 83 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, |
83 | .strategy = &sctp_sysctl_jiffies_ms, | 84 | .strategy = &sctp_sysctl_jiffies_ms, |
84 | .extra1 = &rto_timer_min, | 85 | .extra1 = &rto_timer_min, |
85 | .extra2 = &rto_timer_max | 86 | .extra2 = &rto_timer_max |
86 | }, | 87 | }, |
87 | { | 88 | { |
88 | .ctl_name = NET_SCTP_VALID_COOKIE_LIFE, | 89 | .ctl_name = NET_SCTP_VALID_COOKIE_LIFE, |
89 | .procname = "valid_cookie_life", | 90 | .procname = "valid_cookie_life", |
90 | .data = &sctp_valid_cookie_life, | 91 | .data = &sctp_valid_cookie_life, |
91 | .maxlen = sizeof(long), | 92 | .maxlen = sizeof(long), |
92 | .mode = 0644, | 93 | .mode = 0644, |
93 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | 94 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, |
94 | .strategy = &sctp_sysctl_jiffies_ms, | 95 | .strategy = &sctp_sysctl_jiffies_ms, |
95 | .extra1 = &rto_timer_min, | 96 | .extra1 = &rto_timer_min, |
96 | .extra2 = &rto_timer_max | 97 | .extra2 = &rto_timer_max |
97 | }, | 98 | }, |
98 | { | 99 | { |
99 | .ctl_name = NET_SCTP_MAX_BURST, | 100 | .ctl_name = NET_SCTP_MAX_BURST, |
100 | .procname = "max_burst", | 101 | .procname = "max_burst", |
101 | .data = &sctp_max_burst, | 102 | .data = &sctp_max_burst, |
102 | .maxlen = sizeof(int), | 103 | .maxlen = sizeof(int), |
103 | .mode = 0644, | 104 | .mode = 0644, |
104 | .proc_handler = &proc_dointvec | 105 | .proc_handler = &proc_dointvec |
105 | }, | 106 | }, |
106 | { | 107 | { |
107 | .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS, | 108 | .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS, |
108 | .procname = "association_max_retrans", | 109 | .procname = "association_max_retrans", |
109 | .data = &sctp_max_retrans_association, | 110 | .data = &sctp_max_retrans_association, |
110 | .maxlen = sizeof(int), | 111 | .maxlen = sizeof(int), |
111 | .mode = 0644, | 112 | .mode = 0644, |
112 | .proc_handler = &proc_dointvec | 113 | .proc_handler = &proc_dointvec |
113 | }, | 114 | }, |
114 | { | 115 | { |
115 | .ctl_name = NET_SCTP_SNDBUF_POLICY, | 116 | .ctl_name = NET_SCTP_SNDBUF_POLICY, |
116 | .procname = "sndbuf_policy", | 117 | .procname = "sndbuf_policy", |
117 | .data = &sctp_sndbuf_policy, | 118 | .data = &sctp_sndbuf_policy, |
118 | .maxlen = sizeof(int), | 119 | .maxlen = sizeof(int), |
119 | .mode = 0644, | 120 | .mode = 0644, |
120 | .proc_handler = &proc_dointvec | 121 | .proc_handler = &proc_dointvec |
121 | }, | 122 | }, |
122 | { | 123 | { |
123 | .ctl_name = NET_SCTP_PATH_MAX_RETRANS, | 124 | .ctl_name = NET_SCTP_PATH_MAX_RETRANS, |
124 | .procname = "path_max_retrans", | 125 | .procname = "path_max_retrans", |
125 | .data = &sctp_max_retrans_path, | 126 | .data = &sctp_max_retrans_path, |
126 | .maxlen = sizeof(int), | 127 | .maxlen = sizeof(int), |
127 | .mode = 0644, | 128 | .mode = 0644, |
128 | .proc_handler = &proc_dointvec | 129 | .proc_handler = &proc_dointvec |
129 | }, | 130 | }, |
130 | { | 131 | { |
131 | .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS, | 132 | .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS, |
132 | .procname = "max_init_retransmits", | 133 | .procname = "max_init_retransmits", |
133 | .data = &sctp_max_retrans_init, | 134 | .data = &sctp_max_retrans_init, |
134 | .maxlen = sizeof(int), | 135 | .maxlen = sizeof(int), |
135 | .mode = 0644, | 136 | .mode = 0644, |
136 | .proc_handler = &proc_dointvec | 137 | .proc_handler = &proc_dointvec |
137 | }, | 138 | }, |
138 | { | 139 | { |
139 | .ctl_name = NET_SCTP_HB_INTERVAL, | 140 | .ctl_name = NET_SCTP_HB_INTERVAL, |
140 | .procname = "hb_interval", | 141 | .procname = "hb_interval", |
141 | .data = &sctp_hb_interval, | 142 | .data = &sctp_hb_interval, |
142 | .maxlen = sizeof(long), | 143 | .maxlen = sizeof(long), |
143 | .mode = 0644, | 144 | .mode = 0644, |
144 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | 145 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, |
145 | .strategy = &sctp_sysctl_jiffies_ms, | 146 | .strategy = &sctp_sysctl_jiffies_ms, |
146 | .extra1 = &rto_timer_min, | 147 | .extra1 = &rto_timer_min, |
147 | .extra2 = &rto_timer_max | 148 | .extra2 = &rto_timer_max |
148 | }, | 149 | }, |
149 | { | 150 | { |
150 | .ctl_name = NET_SCTP_PRESERVE_ENABLE, | 151 | .ctl_name = NET_SCTP_PRESERVE_ENABLE, |
151 | .procname = "cookie_preserve_enable", | 152 | .procname = "cookie_preserve_enable", |
152 | .data = &sctp_cookie_preserve_enable, | 153 | .data = &sctp_cookie_preserve_enable, |
153 | .maxlen = sizeof(long), | 154 | .maxlen = sizeof(long), |
154 | .mode = 0644, | 155 | .mode = 0644, |
155 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | 156 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, |
156 | .strategy = &sctp_sysctl_jiffies_ms, | 157 | .strategy = &sctp_sysctl_jiffies_ms, |
157 | .extra1 = &rto_timer_min, | 158 | .extra1 = &rto_timer_min, |
158 | .extra2 = &rto_timer_max | 159 | .extra2 = &rto_timer_max |
159 | }, | 160 | }, |
160 | { | 161 | { |
161 | .ctl_name = NET_SCTP_RTO_ALPHA, | 162 | .ctl_name = NET_SCTP_RTO_ALPHA, |
162 | .procname = "rto_alpha_exp_divisor", | 163 | .procname = "rto_alpha_exp_divisor", |
163 | .data = &sctp_rto_alpha, | 164 | .data = &sctp_rto_alpha, |
164 | .maxlen = sizeof(int), | 165 | .maxlen = sizeof(int), |
165 | .mode = 0644, | 166 | .mode = 0644, |
166 | .proc_handler = &proc_dointvec | 167 | .proc_handler = &proc_dointvec |
167 | }, | 168 | }, |
168 | { | 169 | { |
169 | .ctl_name = NET_SCTP_RTO_BETA, | 170 | .ctl_name = NET_SCTP_RTO_BETA, |
170 | .procname = "rto_beta_exp_divisor", | 171 | .procname = "rto_beta_exp_divisor", |
171 | .data = &sctp_rto_beta, | 172 | .data = &sctp_rto_beta, |
172 | .maxlen = sizeof(int), | 173 | .maxlen = sizeof(int), |
173 | .mode = 0644, | 174 | .mode = 0644, |
174 | .proc_handler = &proc_dointvec | 175 | .proc_handler = &proc_dointvec |
175 | }, | 176 | }, |
176 | { | 177 | { |
177 | .ctl_name = NET_SCTP_ADDIP_ENABLE, | 178 | .ctl_name = NET_SCTP_ADDIP_ENABLE, |
178 | .procname = "addip_enable", | 179 | .procname = "addip_enable", |
179 | .data = &sctp_addip_enable, | 180 | .data = &sctp_addip_enable, |
180 | .maxlen = sizeof(int), | 181 | .maxlen = sizeof(int), |
181 | .mode = 0644, | 182 | .mode = 0644, |
182 | .proc_handler = &proc_dointvec | 183 | .proc_handler = &proc_dointvec |
183 | }, | 184 | }, |
184 | { | 185 | { |
185 | .ctl_name = NET_SCTP_PRSCTP_ENABLE, | 186 | .ctl_name = NET_SCTP_PRSCTP_ENABLE, |
186 | .procname = "prsctp_enable", | 187 | .procname = "prsctp_enable", |
187 | .data = &sctp_prsctp_enable, | 188 | .data = &sctp_prsctp_enable, |
188 | .maxlen = sizeof(int), | 189 | .maxlen = sizeof(int), |
189 | .mode = 0644, | 190 | .mode = 0644, |
190 | .proc_handler = &proc_dointvec | 191 | .proc_handler = &proc_dointvec |
191 | }, | 192 | }, |
192 | { | 193 | { |
193 | .ctl_name = NET_SCTP_SACK_TIMEOUT, | 194 | .ctl_name = NET_SCTP_SACK_TIMEOUT, |
194 | .procname = "sack_timeout", | 195 | .procname = "sack_timeout", |
195 | .data = &sctp_sack_timeout, | 196 | .data = &sctp_sack_timeout, |
196 | .maxlen = sizeof(long), | 197 | .maxlen = sizeof(long), |
197 | .mode = 0644, | 198 | .mode = 0644, |
198 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | 199 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, |
199 | .strategy = &sctp_sysctl_jiffies_ms, | 200 | .strategy = &sctp_sysctl_jiffies_ms, |
200 | .extra1 = &sack_timer_min, | 201 | .extra1 = &sack_timer_min, |
201 | .extra2 = &sack_timer_max, | 202 | .extra2 = &sack_timer_max, |
202 | }, | 203 | }, |
203 | { .ctl_name = 0 } | 204 | { .ctl_name = 0 } |
204 | }; | 205 | }; |
205 | 206 | ||
206 | static ctl_table sctp_net_table[] = { | 207 | static ctl_table sctp_net_table[] = { |
207 | { | 208 | { |
208 | .ctl_name = NET_SCTP, | 209 | .ctl_name = NET_SCTP, |
209 | .procname = "sctp", | 210 | .procname = "sctp", |
210 | .mode = 0555, | 211 | .mode = 0555, |
211 | .child = sctp_table | 212 | .child = sctp_table |
212 | }, | 213 | }, |
213 | { .ctl_name = 0 } | 214 | { .ctl_name = 0 } |
214 | }; | 215 | }; |
215 | 216 | ||
216 | static ctl_table sctp_root_table[] = { | 217 | static ctl_table sctp_root_table[] = { |
217 | { | 218 | { |
218 | .ctl_name = CTL_NET, | 219 | .ctl_name = CTL_NET, |
219 | .procname = "net", | 220 | .procname = "net", |
220 | .mode = 0555, | 221 | .mode = 0555, |
221 | .child = sctp_net_table | 222 | .child = sctp_net_table |
222 | }, | 223 | }, |
223 | { .ctl_name = 0 } | 224 | { .ctl_name = 0 } |
224 | }; | 225 | }; |
225 | 226 | ||
226 | static struct ctl_table_header * sctp_sysctl_header; | 227 | static struct ctl_table_header * sctp_sysctl_header; |
227 | 228 | ||
228 | /* Sysctl registration. */ | 229 | /* Sysctl registration. */ |
229 | void sctp_sysctl_register(void) | 230 | void sctp_sysctl_register(void) |
230 | { | 231 | { |
231 | sctp_sysctl_header = register_sysctl_table(sctp_root_table, 0); | 232 | sctp_sysctl_header = register_sysctl_table(sctp_root_table, 0); |
232 | } | 233 | } |
233 | 234 | ||
234 | /* Sysctl deregistration. */ | 235 | /* Sysctl deregistration. */ |
235 | void sctp_sysctl_unregister(void) | 236 | void sctp_sysctl_unregister(void) |
236 | { | 237 | { |
237 | unregister_sysctl_table(sctp_sysctl_header); | 238 | unregister_sysctl_table(sctp_sysctl_header); |
238 | } | 239 | } |
239 | 240 | ||
240 | /* Strategy function to convert jiffies to milliseconds. */ | 241 | /* Strategy function to convert jiffies to milliseconds. */ |
241 | static int sctp_sysctl_jiffies_ms(ctl_table *table, int __user *name, int nlen, | 242 | static int sctp_sysctl_jiffies_ms(ctl_table *table, int __user *name, int nlen, |
242 | void __user *oldval, size_t __user *oldlenp, | 243 | void __user *oldval, size_t __user *oldlenp, |
243 | void __user *newval, size_t newlen, void **context) { | 244 | void __user *newval, size_t newlen, void **context) { |
244 | 245 | ||
245 | if (oldval) { | 246 | if (oldval) { |
246 | size_t olen; | 247 | size_t olen; |
247 | 248 | ||
248 | if (oldlenp) { | 249 | if (oldlenp) { |
249 | if (get_user(olen, oldlenp)) | 250 | if (get_user(olen, oldlenp)) |
250 | return -EFAULT; | 251 | return -EFAULT; |
251 | 252 | ||
252 | if (olen != sizeof (int)) | 253 | if (olen != sizeof (int)) |
253 | return -EINVAL; | 254 | return -EINVAL; |
254 | } | 255 | } |
255 | if (put_user((*(int *)(table->data) * 1000) / HZ, | 256 | if (put_user((*(int *)(table->data) * 1000) / HZ, |
256 | (int __user *)oldval) || | 257 | (int __user *)oldval) || |
257 | (oldlenp && put_user(sizeof (int), oldlenp))) | 258 | (oldlenp && put_user(sizeof (int), oldlenp))) |
258 | return -EFAULT; | 259 | return -EFAULT; |
259 | } | 260 | } |
260 | if (newval && newlen) { | 261 | if (newval && newlen) { |
261 | int new; | 262 | int new; |
262 | 263 | ||
263 | if (newlen != sizeof (int)) | 264 | if (newlen != sizeof (int)) |
264 | return -EINVAL; | 265 | return -EINVAL; |
265 | 266 | ||
266 | if (get_user(new, (int __user *)newval)) | 267 | if (get_user(new, (int __user *)newval)) |
267 | return -EFAULT; | 268 | return -EFAULT; |
268 | 269 | ||
269 | *(int *)(table->data) = (new * HZ) / 1000; | 270 | *(int *)(table->data) = (new * HZ) / 1000; |
270 | } | 271 | } |
271 | return 1; | 272 | return 1; |
272 | } | 273 | } |
273 | 274 |