Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* SCTP kernel reference Implementation |
| 2 | * (C) Copyright IBM Corp. 2002, 2004 |
| 3 | * Copyright (c) 2002 Intel Corp. |
| 4 | * |
| 5 | * This file is part of the SCTP kernel reference Implementation |
| 6 | * |
| 7 | * Sysctl related interfaces for SCTP. |
| 8 | * |
| 9 | * The SCTP reference implementation is free software; |
| 10 | * you can redistribute it and/or modify it under the terms of |
| 11 | * the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2, or (at your option) |
| 13 | * any later version. |
| 14 | * |
| 15 | * The SCTP reference implementation is distributed in the hope that it |
| 16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
| 17 | * ************************ |
| 18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 19 | * See the GNU General Public License for more details. |
| 20 | * |
| 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 |
| 23 | * the Free Software Foundation, 59 Temple Place - Suite 330, |
| 24 | * Boston, MA 02111-1307, USA. |
| 25 | * |
| 26 | * Please send any bug reports or fixes you make to the |
| 27 | * email address(es): |
| 28 | * lksctp developers <lksctp-developers@lists.sourceforge.net> |
| 29 | * |
| 30 | * Or submit a bug report through the following website: |
| 31 | * http://www.sf.net/projects/lksctp |
| 32 | * |
| 33 | * Written or modified by: |
| 34 | * Mingqin Liu <liuming@us.ibm.com> |
| 35 | * Jon Grimm <jgrimm@us.ibm.com> |
| 36 | * Ardelle Fan <ardelle.fan@intel.com> |
| 37 | * Ryan Layer <rmlayer@us.ibm.com> |
| 38 | * Sridhar Samudrala <sri@us.ibm.com> |
| 39 | * |
| 40 | * Any bugs reported given to us we will try to fix... any fixes shared will |
| 41 | * be incorporated into the next SCTP release. |
| 42 | */ |
| 43 | |
| 44 | #include <net/sctp/structs.h> |
Adrian Bunk | 8c5955d | 2005-09-05 18:07:42 -0700 | [diff] [blame] | 45 | #include <net/sctp/sctp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #include <linux/sysctl.h> |
| 47 | |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 48 | static int zero = 0; |
| 49 | static int one = 1; |
| 50 | static int timer_max = 86400000; /* ms in one day */ |
| 51 | static int int_max = INT_MAX; |
Vlad Yasevich | 2f85a42 | 2005-06-28 13:24:23 -0700 | [diff] [blame] | 52 | static long sack_timer_min = 1; |
| 53 | static long sack_timer_max = 500; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
| 55 | static ctl_table sctp_table[] = { |
| 56 | { |
| 57 | .ctl_name = NET_SCTP_RTO_INITIAL, |
| 58 | .procname = "rto_initial", |
| 59 | .data = &sctp_rto_initial, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 60 | .maxlen = sizeof(unsigned int), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 62 | .proc_handler = &proc_dointvec_minmax, |
| 63 | .strategy = &sysctl_intvec, |
| 64 | .extra1 = &one, |
| 65 | .extra2 = &timer_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | }, |
| 67 | { |
| 68 | .ctl_name = NET_SCTP_RTO_MIN, |
| 69 | .procname = "rto_min", |
| 70 | .data = &sctp_rto_min, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 71 | .maxlen = sizeof(unsigned int), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 73 | .proc_handler = &proc_dointvec_minmax, |
| 74 | .strategy = &sysctl_intvec, |
| 75 | .extra1 = &one, |
| 76 | .extra2 = &timer_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | }, |
| 78 | { |
| 79 | .ctl_name = NET_SCTP_RTO_MAX, |
| 80 | .procname = "rto_max", |
| 81 | .data = &sctp_rto_max, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 82 | .maxlen = sizeof(unsigned int), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 84 | .proc_handler = &proc_dointvec_minmax, |
| 85 | .strategy = &sysctl_intvec, |
| 86 | .extra1 = &one, |
| 87 | .extra2 = &timer_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }, |
| 89 | { |
| 90 | .ctl_name = NET_SCTP_VALID_COOKIE_LIFE, |
| 91 | .procname = "valid_cookie_life", |
| 92 | .data = &sctp_valid_cookie_life, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 93 | .maxlen = sizeof(unsigned int), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 95 | .proc_handler = &proc_dointvec_minmax, |
| 96 | .strategy = &sysctl_intvec, |
| 97 | .extra1 = &one, |
| 98 | .extra2 = &timer_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | }, |
| 100 | { |
| 101 | .ctl_name = NET_SCTP_MAX_BURST, |
| 102 | .procname = "max_burst", |
| 103 | .data = &sctp_max_burst, |
| 104 | .maxlen = sizeof(int), |
| 105 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 106 | .proc_handler = &proc_dointvec_minmax, |
| 107 | .strategy = &sysctl_intvec, |
| 108 | .extra1 = &zero, |
| 109 | .extra2 = &int_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | }, |
| 111 | { |
| 112 | .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS, |
| 113 | .procname = "association_max_retrans", |
| 114 | .data = &sctp_max_retrans_association, |
| 115 | .maxlen = sizeof(int), |
| 116 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 117 | .proc_handler = &proc_dointvec_minmax, |
| 118 | .strategy = &sysctl_intvec, |
| 119 | .extra1 = &one, |
| 120 | .extra2 = &int_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | }, |
| 122 | { |
Neil Horman | 4eb701d | 2005-04-28 12:02:04 -0700 | [diff] [blame] | 123 | .ctl_name = NET_SCTP_SNDBUF_POLICY, |
| 124 | .procname = "sndbuf_policy", |
| 125 | .data = &sctp_sndbuf_policy, |
| 126 | .maxlen = sizeof(int), |
| 127 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 128 | .proc_handler = &proc_dointvec, |
| 129 | .strategy = &sysctl_intvec |
Neil Horman | 4eb701d | 2005-04-28 12:02:04 -0700 | [diff] [blame] | 130 | }, |
| 131 | { |
Neil Horman | 049b3ff | 2005-11-11 16:08:24 -0800 | [diff] [blame] | 132 | .ctl_name = NET_SCTP_RCVBUF_POLICY, |
| 133 | .procname = "rcvbuf_policy", |
| 134 | .data = &sctp_rcvbuf_policy, |
| 135 | .maxlen = sizeof(int), |
| 136 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 137 | .proc_handler = &proc_dointvec, |
| 138 | .strategy = &sysctl_intvec |
Neil Horman | 049b3ff | 2005-11-11 16:08:24 -0800 | [diff] [blame] | 139 | }, |
| 140 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | .ctl_name = NET_SCTP_PATH_MAX_RETRANS, |
| 142 | .procname = "path_max_retrans", |
| 143 | .data = &sctp_max_retrans_path, |
| 144 | .maxlen = sizeof(int), |
| 145 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 146 | .proc_handler = &proc_dointvec_minmax, |
| 147 | .strategy = &sysctl_intvec, |
| 148 | .extra1 = &one, |
| 149 | .extra2 = &int_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | }, |
| 151 | { |
| 152 | .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS, |
| 153 | .procname = "max_init_retransmits", |
| 154 | .data = &sctp_max_retrans_init, |
| 155 | .maxlen = sizeof(int), |
| 156 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 157 | .proc_handler = &proc_dointvec_minmax, |
| 158 | .strategy = &sysctl_intvec, |
| 159 | .extra1 = &one, |
| 160 | .extra2 = &int_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | }, |
| 162 | { |
| 163 | .ctl_name = NET_SCTP_HB_INTERVAL, |
| 164 | .procname = "hb_interval", |
| 165 | .data = &sctp_hb_interval, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 166 | .maxlen = sizeof(unsigned int), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 168 | .proc_handler = &proc_dointvec_minmax, |
| 169 | .strategy = &sysctl_intvec, |
| 170 | .extra1 = &one, |
| 171 | .extra2 = &timer_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | }, |
| 173 | { |
| 174 | .ctl_name = NET_SCTP_PRESERVE_ENABLE, |
| 175 | .procname = "cookie_preserve_enable", |
| 176 | .data = &sctp_cookie_preserve_enable, |
Vlad Yasevich | 8116ffa | 2006-01-17 11:55:17 -0800 | [diff] [blame] | 177 | .maxlen = sizeof(int), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 179 | .proc_handler = &proc_dointvec, |
| 180 | .strategy = &sysctl_intvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | }, |
| 182 | { |
| 183 | .ctl_name = NET_SCTP_RTO_ALPHA, |
| 184 | .procname = "rto_alpha_exp_divisor", |
| 185 | .data = &sctp_rto_alpha, |
| 186 | .maxlen = sizeof(int), |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 187 | .mode = 0444, |
| 188 | .proc_handler = &proc_dointvec, |
| 189 | .strategy = &sysctl_intvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | }, |
| 191 | { |
| 192 | .ctl_name = NET_SCTP_RTO_BETA, |
| 193 | .procname = "rto_beta_exp_divisor", |
| 194 | .data = &sctp_rto_beta, |
| 195 | .maxlen = sizeof(int), |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 196 | .mode = 0444, |
| 197 | .proc_handler = &proc_dointvec, |
| 198 | .strategy = &sysctl_intvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | }, |
| 200 | { |
| 201 | .ctl_name = NET_SCTP_ADDIP_ENABLE, |
| 202 | .procname = "addip_enable", |
| 203 | .data = &sctp_addip_enable, |
| 204 | .maxlen = sizeof(int), |
| 205 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 206 | .proc_handler = &proc_dointvec, |
| 207 | .strategy = &sysctl_intvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | }, |
| 209 | { |
| 210 | .ctl_name = NET_SCTP_PRSCTP_ENABLE, |
| 211 | .procname = "prsctp_enable", |
| 212 | .data = &sctp_prsctp_enable, |
| 213 | .maxlen = sizeof(int), |
| 214 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 215 | .proc_handler = &proc_dointvec, |
| 216 | .strategy = &sysctl_intvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | }, |
Vlad Yasevich | 2f85a42 | 2005-06-28 13:24:23 -0700 | [diff] [blame] | 218 | { |
| 219 | .ctl_name = NET_SCTP_SACK_TIMEOUT, |
| 220 | .procname = "sack_timeout", |
| 221 | .data = &sctp_sack_timeout, |
| 222 | .maxlen = sizeof(long), |
| 223 | .mode = 0644, |
Vladislav Yasevich | 3fd091e | 2006-08-22 13:29:17 -0700 | [diff] [blame] | 224 | .proc_handler = &proc_dointvec_minmax, |
| 225 | .strategy = &sysctl_intvec, |
Vlad Yasevich | 2f85a42 | 2005-06-28 13:24:23 -0700 | [diff] [blame] | 226 | .extra1 = &sack_timer_min, |
| 227 | .extra2 = &sack_timer_max, |
| 228 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | { .ctl_name = 0 } |
| 230 | }; |
| 231 | |
| 232 | static ctl_table sctp_net_table[] = { |
| 233 | { |
| 234 | .ctl_name = NET_SCTP, |
| 235 | .procname = "sctp", |
| 236 | .mode = 0555, |
| 237 | .child = sctp_table |
| 238 | }, |
| 239 | { .ctl_name = 0 } |
| 240 | }; |
| 241 | |
| 242 | static ctl_table sctp_root_table[] = { |
| 243 | { |
| 244 | .ctl_name = CTL_NET, |
| 245 | .procname = "net", |
| 246 | .mode = 0555, |
| 247 | .child = sctp_net_table |
| 248 | }, |
| 249 | { .ctl_name = 0 } |
| 250 | }; |
| 251 | |
| 252 | static struct ctl_table_header * sctp_sysctl_header; |
| 253 | |
| 254 | /* Sysctl registration. */ |
| 255 | void sctp_sysctl_register(void) |
| 256 | { |
Eric W. Biederman | 0b4d414 | 2007-02-14 00:34:09 -0800 | [diff] [blame] | 257 | sctp_sysctl_header = register_sysctl_table(sctp_root_table); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | /* Sysctl deregistration. */ |
| 261 | void sctp_sysctl_unregister(void) |
| 262 | { |
| 263 | unregister_sysctl_table(sctp_sysctl_header); |
| 264 | } |