sysctl_net_netrom.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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/netrom.h>
  14. /*
  15. * Values taken from NET/ROM documentation.
  16. */
  17. static int min_quality[] = {0}, max_quality[] = {255};
  18. static int min_obs[] = {0}, max_obs[] = {255};
  19. static int min_ttl[] = {0}, max_ttl[] = {255};
  20. static int min_t1[] = {5 * HZ};
  21. static int max_t1[] = {600 * HZ};
  22. static int min_n2[] = {2}, max_n2[] = {127};
  23. static int min_t2[] = {1 * HZ};
  24. static int max_t2[] = {60 * HZ};
  25. static int min_t4[] = {1 * HZ};
  26. static int max_t4[] = {1000 * HZ};
  27. static int min_window[] = {1}, max_window[] = {127};
  28. static int min_idle[] = {0 * HZ};
  29. static int max_idle[] = {65535 * HZ};
  30. static int min_route[] = {0}, max_route[] = {1};
  31. static int min_fails[] = {1}, max_fails[] = {10};
  32. static int min_reset[] = {0}, max_reset[] = {1};
  33. static struct ctl_table_header *nr_table_header;
  34. static struct ctl_table nr_table[] = {
  35. {
  36. .procname = "default_path_quality",
  37. .data = &sysctl_netrom_default_path_quality,
  38. .maxlen = sizeof(int),
  39. .mode = 0644,
  40. .proc_handler = proc_dointvec_minmax,
  41. .extra1 = &min_quality,
  42. .extra2 = &max_quality
  43. },
  44. {
  45. .procname = "obsolescence_count_initialiser",
  46. .data = &sysctl_netrom_obsolescence_count_initialiser,
  47. .maxlen = sizeof(int),
  48. .mode = 0644,
  49. .proc_handler = proc_dointvec_minmax,
  50. .extra1 = &min_obs,
  51. .extra2 = &max_obs
  52. },
  53. {
  54. .procname = "network_ttl_initialiser",
  55. .data = &sysctl_netrom_network_ttl_initialiser,
  56. .maxlen = sizeof(int),
  57. .mode = 0644,
  58. .proc_handler = proc_dointvec_minmax,
  59. .extra1 = &min_ttl,
  60. .extra2 = &max_ttl
  61. },
  62. {
  63. .procname = "transport_timeout",
  64. .data = &sysctl_netrom_transport_timeout,
  65. .maxlen = sizeof(int),
  66. .mode = 0644,
  67. .proc_handler = proc_dointvec_minmax,
  68. .extra1 = &min_t1,
  69. .extra2 = &max_t1
  70. },
  71. {
  72. .procname = "transport_maximum_tries",
  73. .data = &sysctl_netrom_transport_maximum_tries,
  74. .maxlen = sizeof(int),
  75. .mode = 0644,
  76. .proc_handler = proc_dointvec_minmax,
  77. .extra1 = &min_n2,
  78. .extra2 = &max_n2
  79. },
  80. {
  81. .procname = "transport_acknowledge_delay",
  82. .data = &sysctl_netrom_transport_acknowledge_delay,
  83. .maxlen = sizeof(int),
  84. .mode = 0644,
  85. .proc_handler = proc_dointvec_minmax,
  86. .extra1 = &min_t2,
  87. .extra2 = &max_t2
  88. },
  89. {
  90. .procname = "transport_busy_delay",
  91. .data = &sysctl_netrom_transport_busy_delay,
  92. .maxlen = sizeof(int),
  93. .mode = 0644,
  94. .proc_handler = proc_dointvec_minmax,
  95. .extra1 = &min_t4,
  96. .extra2 = &max_t4
  97. },
  98. {
  99. .procname = "transport_requested_window_size",
  100. .data = &sysctl_netrom_transport_requested_window_size,
  101. .maxlen = sizeof(int),
  102. .mode = 0644,
  103. .proc_handler = proc_dointvec_minmax,
  104. .extra1 = &min_window,
  105. .extra2 = &max_window
  106. },
  107. {
  108. .procname = "transport_no_activity_timeout",
  109. .data = &sysctl_netrom_transport_no_activity_timeout,
  110. .maxlen = sizeof(int),
  111. .mode = 0644,
  112. .proc_handler = proc_dointvec_minmax,
  113. .extra1 = &min_idle,
  114. .extra2 = &max_idle
  115. },
  116. {
  117. .procname = "routing_control",
  118. .data = &sysctl_netrom_routing_control,
  119. .maxlen = sizeof(int),
  120. .mode = 0644,
  121. .proc_handler = proc_dointvec_minmax,
  122. .extra1 = &min_route,
  123. .extra2 = &max_route
  124. },
  125. {
  126. .procname = "link_fails_count",
  127. .data = &sysctl_netrom_link_fails_count,
  128. .maxlen = sizeof(int),
  129. .mode = 0644,
  130. .proc_handler = proc_dointvec_minmax,
  131. .extra1 = &min_fails,
  132. .extra2 = &max_fails
  133. },
  134. {
  135. .procname = "reset",
  136. .data = &sysctl_netrom_reset_circuit,
  137. .maxlen = sizeof(int),
  138. .mode = 0644,
  139. .proc_handler = proc_dointvec_minmax,
  140. .extra1 = &min_reset,
  141. .extra2 = &max_reset
  142. },
  143. { }
  144. };
  145. void __init nr_register_sysctl(void)
  146. {
  147. nr_table_header = register_net_sysctl(&init_net, "net/netrom", nr_table);
  148. }
  149. void nr_unregister_sysctl(void)
  150. {
  151. unregister_net_sysctl_table(nr_table_header);
  152. }