sysctl.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * net/dccp/sysctl.c
  3. *
  4. * An implementation of the DCCP protocol
  5. * Arnaldo Carvalho de Melo <acme@mandriva.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License v2
  9. * as published by the Free Software Foundation.
  10. */
  11. #include <linux/mm.h>
  12. #include <linux/sysctl.h>
  13. #include "dccp.h"
  14. #include "feat.h"
  15. #ifndef CONFIG_SYSCTL
  16. #error This file should not be compiled without CONFIG_SYSCTL defined
  17. #endif
  18. /* Boundary values */
  19. static int zero = 0,
  20. u8_max = 0xFF;
  21. static unsigned long seqw_min = 32;
  22. static struct ctl_table dccp_default_table[] = {
  23. {
  24. .procname = "seq_window",
  25. .data = &sysctl_dccp_sequence_window,
  26. .maxlen = sizeof(sysctl_dccp_sequence_window),
  27. .mode = 0644,
  28. .proc_handler = proc_doulongvec_minmax,
  29. .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */
  30. },
  31. {
  32. .procname = "rx_ccid",
  33. .data = &sysctl_dccp_rx_ccid,
  34. .maxlen = sizeof(sysctl_dccp_rx_ccid),
  35. .mode = 0644,
  36. .proc_handler = proc_dointvec_minmax,
  37. .extra1 = &zero,
  38. .extra2 = &u8_max, /* RFC 4340, 10. */
  39. },
  40. {
  41. .procname = "tx_ccid",
  42. .data = &sysctl_dccp_tx_ccid,
  43. .maxlen = sizeof(sysctl_dccp_tx_ccid),
  44. .mode = 0644,
  45. .proc_handler = proc_dointvec_minmax,
  46. .extra1 = &zero,
  47. .extra2 = &u8_max, /* RFC 4340, 10. */
  48. },
  49. {
  50. .procname = "request_retries",
  51. .data = &sysctl_dccp_request_retries,
  52. .maxlen = sizeof(sysctl_dccp_request_retries),
  53. .mode = 0644,
  54. .proc_handler = proc_dointvec_minmax,
  55. .extra1 = &zero,
  56. .extra2 = &u8_max,
  57. },
  58. {
  59. .procname = "retries1",
  60. .data = &sysctl_dccp_retries1,
  61. .maxlen = sizeof(sysctl_dccp_retries1),
  62. .mode = 0644,
  63. .proc_handler = proc_dointvec_minmax,
  64. .extra1 = &zero,
  65. .extra2 = &u8_max,
  66. },
  67. {
  68. .procname = "retries2",
  69. .data = &sysctl_dccp_retries2,
  70. .maxlen = sizeof(sysctl_dccp_retries2),
  71. .mode = 0644,
  72. .proc_handler = proc_dointvec_minmax,
  73. .extra1 = &zero,
  74. .extra2 = &u8_max,
  75. },
  76. {
  77. .procname = "tx_qlen",
  78. .data = &sysctl_dccp_tx_qlen,
  79. .maxlen = sizeof(sysctl_dccp_tx_qlen),
  80. .mode = 0644,
  81. .proc_handler = proc_dointvec_minmax,
  82. .extra1 = &zero,
  83. },
  84. {
  85. .procname = "sync_ratelimit",
  86. .data = &sysctl_dccp_sync_ratelimit,
  87. .maxlen = sizeof(sysctl_dccp_sync_ratelimit),
  88. .mode = 0644,
  89. .proc_handler = proc_dointvec_ms_jiffies,
  90. },
  91. { .ctl_name = 0, }
  92. };
  93. static struct ctl_path dccp_path[] = {
  94. { .procname = "net", .ctl_name = CTL_NET, },
  95. { .procname = "dccp", .ctl_name = NET_DCCP, },
  96. { .procname = "default", .ctl_name = NET_DCCP_DEFAULT, },
  97. { }
  98. };
  99. static struct ctl_table_header *dccp_table_header;
  100. int __init dccp_sysctl_init(void)
  101. {
  102. dccp_table_header = register_sysctl_paths(dccp_path,
  103. dccp_default_table);
  104. return dccp_table_header != NULL ? 0 : -ENOMEM;
  105. }
  106. void dccp_sysctl_exit(void)
  107. {
  108. if (dccp_table_header != NULL) {
  109. unregister_sysctl_table(dccp_table_header);
  110. dccp_table_header = NULL;
  111. }
  112. }