sysctl.c 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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. #include <net/sctp/structs.h>
  44. #include <net/sctp/sctp.h>
  45. #include <linux/sysctl.h>
  46. static int zero = 0;
  47. static int one = 1;
  48. static int timer_max = 86400000; /* ms in one day */
  49. static int int_max = INT_MAX;
  50. static long sack_timer_min = 1;
  51. static long sack_timer_max = 500;
  52. static ctl_table sctp_table[] = {
  53. {
  54. .ctl_name = NET_SCTP_RTO_INITIAL,
  55. .procname = "rto_initial",
  56. .data = &sctp_rto_initial,
  57. .maxlen = sizeof(unsigned int),
  58. .mode = 0644,
  59. .proc_handler = &proc_dointvec_minmax,
  60. .strategy = &sysctl_intvec,
  61. .extra1 = &one,
  62. .extra2 = &timer_max
  63. },
  64. {
  65. .ctl_name = NET_SCTP_RTO_MIN,
  66. .procname = "rto_min",
  67. .data = &sctp_rto_min,
  68. .maxlen = sizeof(unsigned int),
  69. .mode = 0644,
  70. .proc_handler = &proc_dointvec_minmax,
  71. .strategy = &sysctl_intvec,
  72. .extra1 = &one,
  73. .extra2 = &timer_max
  74. },
  75. {
  76. .ctl_name = NET_SCTP_RTO_MAX,
  77. .procname = "rto_max",
  78. .data = &sctp_rto_max,
  79. .maxlen = sizeof(unsigned int),
  80. .mode = 0644,
  81. .proc_handler = &proc_dointvec_minmax,
  82. .strategy = &sysctl_intvec,
  83. .extra1 = &one,
  84. .extra2 = &timer_max
  85. },
  86. {
  87. .ctl_name = NET_SCTP_VALID_COOKIE_LIFE,
  88. .procname = "valid_cookie_life",
  89. .data = &sctp_valid_cookie_life,
  90. .maxlen = sizeof(unsigned int),
  91. .mode = 0644,
  92. .proc_handler = &proc_dointvec_minmax,
  93. .strategy = &sysctl_intvec,
  94. .extra1 = &one,
  95. .extra2 = &timer_max
  96. },
  97. {
  98. .ctl_name = NET_SCTP_MAX_BURST,
  99. .procname = "max_burst",
  100. .data = &sctp_max_burst,
  101. .maxlen = sizeof(int),
  102. .mode = 0644,
  103. .proc_handler = &proc_dointvec_minmax,
  104. .strategy = &sysctl_intvec,
  105. .extra1 = &zero,
  106. .extra2 = &int_max
  107. },
  108. {
  109. .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS,
  110. .procname = "association_max_retrans",
  111. .data = &sctp_max_retrans_association,
  112. .maxlen = sizeof(int),
  113. .mode = 0644,
  114. .proc_handler = &proc_dointvec_minmax,
  115. .strategy = &sysctl_intvec,
  116. .extra1 = &one,
  117. .extra2 = &int_max
  118. },
  119. {
  120. .ctl_name = NET_SCTP_SNDBUF_POLICY,
  121. .procname = "sndbuf_policy",
  122. .data = &sctp_sndbuf_policy,
  123. .maxlen = sizeof(int),
  124. .mode = 0644,
  125. .proc_handler = &proc_dointvec,
  126. .strategy = &sysctl_intvec
  127. },
  128. {
  129. .ctl_name = NET_SCTP_RCVBUF_POLICY,
  130. .procname = "rcvbuf_policy",
  131. .data = &sctp_rcvbuf_policy,
  132. .maxlen = sizeof(int),
  133. .mode = 0644,
  134. .proc_handler = &proc_dointvec,
  135. .strategy = &sysctl_intvec
  136. },
  137. {
  138. .ctl_name = NET_SCTP_PATH_MAX_RETRANS,
  139. .procname = "path_max_retrans",
  140. .data = &sctp_max_retrans_path,
  141. .maxlen = sizeof(int),
  142. .mode = 0644,
  143. .proc_handler = &proc_dointvec_minmax,
  144. .strategy = &sysctl_intvec,
  145. .extra1 = &one,
  146. .extra2 = &int_max
  147. },
  148. {
  149. .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS,
  150. .procname = "max_init_retransmits",
  151. .data = &sctp_max_retrans_init,
  152. .maxlen = sizeof(int),
  153. .mode = 0644,
  154. .proc_handler = &proc_dointvec_minmax,
  155. .strategy = &sysctl_intvec,
  156. .extra1 = &one,
  157. .extra2 = &int_max
  158. },
  159. {
  160. .ctl_name = NET_SCTP_HB_INTERVAL,
  161. .procname = "hb_interval",
  162. .data = &sctp_hb_interval,
  163. .maxlen = sizeof(unsigned int),
  164. .mode = 0644,
  165. .proc_handler = &proc_dointvec_minmax,
  166. .strategy = &sysctl_intvec,
  167. .extra1 = &one,
  168. .extra2 = &timer_max
  169. },
  170. {
  171. .ctl_name = NET_SCTP_PRESERVE_ENABLE,
  172. .procname = "cookie_preserve_enable",
  173. .data = &sctp_cookie_preserve_enable,
  174. .maxlen = sizeof(int),
  175. .mode = 0644,
  176. .proc_handler = &proc_dointvec,
  177. .strategy = &sysctl_intvec
  178. },
  179. {
  180. .ctl_name = NET_SCTP_RTO_ALPHA,
  181. .procname = "rto_alpha_exp_divisor",
  182. .data = &sctp_rto_alpha,
  183. .maxlen = sizeof(int),
  184. .mode = 0444,
  185. .proc_handler = &proc_dointvec,
  186. .strategy = &sysctl_intvec
  187. },
  188. {
  189. .ctl_name = NET_SCTP_RTO_BETA,
  190. .procname = "rto_beta_exp_divisor",
  191. .data = &sctp_rto_beta,
  192. .maxlen = sizeof(int),
  193. .mode = 0444,
  194. .proc_handler = &proc_dointvec,
  195. .strategy = &sysctl_intvec
  196. },
  197. {
  198. .ctl_name = NET_SCTP_ADDIP_ENABLE,
  199. .procname = "addip_enable",
  200. .data = &sctp_addip_enable,
  201. .maxlen = sizeof(int),
  202. .mode = 0644,
  203. .proc_handler = &proc_dointvec,
  204. .strategy = &sysctl_intvec
  205. },
  206. {
  207. .ctl_name = NET_SCTP_PRSCTP_ENABLE,
  208. .procname = "prsctp_enable",
  209. .data = &sctp_prsctp_enable,
  210. .maxlen = sizeof(int),
  211. .mode = 0644,
  212. .proc_handler = &proc_dointvec,
  213. .strategy = &sysctl_intvec
  214. },
  215. {
  216. .ctl_name = NET_SCTP_SACK_TIMEOUT,
  217. .procname = "sack_timeout",
  218. .data = &sctp_sack_timeout,
  219. .maxlen = sizeof(long),
  220. .mode = 0644,
  221. .proc_handler = &proc_dointvec_minmax,
  222. .strategy = &sysctl_intvec,
  223. .extra1 = &sack_timer_min,
  224. .extra2 = &sack_timer_max,
  225. },
  226. { .ctl_name = 0 }
  227. };
  228. static ctl_table sctp_net_table[] = {
  229. {
  230. .ctl_name = NET_SCTP,
  231. .procname = "sctp",
  232. .mode = 0555,
  233. .child = sctp_table
  234. },
  235. { .ctl_name = 0 }
  236. };
  237. static ctl_table sctp_root_table[] = {
  238. {
  239. .ctl_name = CTL_NET,
  240. .procname = "net",
  241. .mode = 0555,
  242. .child = sctp_net_table
  243. },
  244. { .ctl_name = 0 }
  245. };
  246. static struct ctl_table_header * sctp_sysctl_header;
  247. /* Sysctl registration. */
  248. void sctp_sysctl_register(void)
  249. {
  250. sctp_sysctl_header = register_sysctl_table(sctp_root_table);
  251. }
  252. /* Sysctl deregistration. */
  253. void sctp_sysctl_unregister(void)
  254. {
  255. unregister_sysctl_table(sctp_sysctl_header);
  256. }