sysctl_net_rose.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License as published by
  4. * the Free Software Foundation; either version 2 of the License, or
  5. * (at your option) any later version.
  6. *
  7. * Copyright (C) 1996 Mike Shaver (shaver@zeroknowledge.com)
  8. */
  9. #include <linux/mm.h>
  10. #include <linux/sysctl.h>
  11. #include <linux/init.h>
  12. #include <net/ax25.h>
  13. #include <net/rose.h>
  14. static int min_timer[] = {1 * HZ};
  15. static int max_timer[] = {300 * HZ};
  16. static int min_idle[] = {0 * HZ};
  17. static int max_idle[] = {65535 * HZ};
  18. static int min_route[1], max_route[] = {1};
  19. static int min_ftimer[] = {60 * HZ};
  20. static int max_ftimer[] = {600 * HZ};
  21. static int min_maxvcs[] = {1}, max_maxvcs[] = {254};
  22. static int min_window[] = {1}, max_window[] = {7};
  23. static struct ctl_table_header *rose_table_header;
  24. static ctl_table rose_table[] = {
  25. {
  26. .ctl_name = NET_ROSE_RESTART_REQUEST_TIMEOUT,
  27. .procname = "restart_request_timeout",
  28. .data = &sysctl_rose_restart_request_timeout,
  29. .maxlen = sizeof(int),
  30. .mode = 0644,
  31. .proc_handler = &proc_dointvec_minmax,
  32. .strategy = &sysctl_intvec,
  33. .extra1 = &min_timer,
  34. .extra2 = &max_timer
  35. },
  36. {
  37. .ctl_name = NET_ROSE_CALL_REQUEST_TIMEOUT,
  38. .procname = "call_request_timeout",
  39. .data = &sysctl_rose_call_request_timeout,
  40. .maxlen = sizeof(int),
  41. .mode = 0644,
  42. .proc_handler = &proc_dointvec_minmax,
  43. .strategy = &sysctl_intvec,
  44. .extra1 = &min_timer,
  45. .extra2 = &max_timer
  46. },
  47. {
  48. .ctl_name = NET_ROSE_RESET_REQUEST_TIMEOUT,
  49. .procname = "reset_request_timeout",
  50. .data = &sysctl_rose_reset_request_timeout,
  51. .maxlen = sizeof(int),
  52. .mode = 0644,
  53. .proc_handler = &proc_dointvec_minmax,
  54. .strategy = &sysctl_intvec,
  55. .extra1 = &min_timer,
  56. .extra2 = &max_timer
  57. },
  58. {
  59. .ctl_name = NET_ROSE_CLEAR_REQUEST_TIMEOUT,
  60. .procname = "clear_request_timeout",
  61. .data = &sysctl_rose_clear_request_timeout,
  62. .maxlen = sizeof(int),
  63. .mode = 0644,
  64. .proc_handler = &proc_dointvec_minmax,
  65. .strategy = &sysctl_intvec,
  66. .extra1 = &min_timer,
  67. .extra2 = &max_timer
  68. },
  69. {
  70. .ctl_name = NET_ROSE_NO_ACTIVITY_TIMEOUT,
  71. .procname = "no_activity_timeout",
  72. .data = &sysctl_rose_no_activity_timeout,
  73. .maxlen = sizeof(int),
  74. .mode = 0644,
  75. .proc_handler = &proc_dointvec_minmax,
  76. .strategy = &sysctl_intvec,
  77. .extra1 = &min_idle,
  78. .extra2 = &max_idle
  79. },
  80. {
  81. .ctl_name = NET_ROSE_ACK_HOLD_BACK_TIMEOUT,
  82. .procname = "acknowledge_hold_back_timeout",
  83. .data = &sysctl_rose_ack_hold_back_timeout,
  84. .maxlen = sizeof(int),
  85. .mode = 0644,
  86. .proc_handler = &proc_dointvec_minmax,
  87. .strategy = &sysctl_intvec,
  88. .extra1 = &min_timer,
  89. .extra2 = &max_timer
  90. },
  91. {
  92. .ctl_name = NET_ROSE_ROUTING_CONTROL,
  93. .procname = "routing_control",
  94. .data = &sysctl_rose_routing_control,
  95. .maxlen = sizeof(int),
  96. .mode = 0644,
  97. .proc_handler = &proc_dointvec_minmax,
  98. .strategy = &sysctl_intvec,
  99. .extra1 = &min_route,
  100. .extra2 = &max_route
  101. },
  102. {
  103. .ctl_name = NET_ROSE_LINK_FAIL_TIMEOUT,
  104. .procname = "link_fail_timeout",
  105. .data = &sysctl_rose_link_fail_timeout,
  106. .maxlen = sizeof(int),
  107. .mode = 0644,
  108. .proc_handler = &proc_dointvec_minmax,
  109. .strategy = &sysctl_intvec,
  110. .extra1 = &min_ftimer,
  111. .extra2 = &max_ftimer
  112. },
  113. {
  114. .ctl_name = NET_ROSE_MAX_VCS,
  115. .procname = "maximum_virtual_circuits",
  116. .data = &sysctl_rose_maximum_vcs,
  117. .maxlen = sizeof(int),
  118. .mode = 0644,
  119. .proc_handler = &proc_dointvec_minmax,
  120. .strategy = &sysctl_intvec,
  121. .extra1 = &min_maxvcs,
  122. .extra2 = &max_maxvcs
  123. },
  124. {
  125. .ctl_name = NET_ROSE_WINDOW_SIZE,
  126. .procname = "window_size",
  127. .data = &sysctl_rose_window_size,
  128. .maxlen = sizeof(int),
  129. .mode = 0644,
  130. .proc_handler = &proc_dointvec_minmax,
  131. .strategy = &sysctl_intvec,
  132. .extra1 = &min_window,
  133. .extra2 = &max_window
  134. },
  135. { .ctl_name = 0 }
  136. };
  137. static ctl_table rose_dir_table[] = {
  138. {
  139. .ctl_name = NET_ROSE,
  140. .procname = "rose",
  141. .mode = 0555,
  142. .child = rose_table
  143. },
  144. { .ctl_name = 0 }
  145. };
  146. static ctl_table rose_root_table[] = {
  147. {
  148. .ctl_name = CTL_NET,
  149. .procname = "net",
  150. .mode = 0555,
  151. .child = rose_dir_table
  152. },
  153. { .ctl_name = 0 }
  154. };
  155. void __init rose_register_sysctl(void)
  156. {
  157. rose_table_header = register_sysctl_table(rose_root_table, 1);
  158. }
  159. void rose_unregister_sysctl(void)
  160. {
  161. unregister_sysctl_table(rose_table_header);
  162. }