sysctl.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 = DCCPF_SEQ_WMIN,
  22. seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */
  23. static struct ctl_table dccp_default_table[] = {
  24. {
  25. .procname = "seq_window",
  26. .data = &sysctl_dccp_sequence_window,
  27. .maxlen = sizeof(sysctl_dccp_sequence_window),
  28. .mode = 0644,
  29. .proc_handler = proc_doulongvec_minmax,
  30. .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */
  31. .extra2 = &seqw_max,
  32. },
  33. {
  34. .procname = "rx_ccid",
  35. .data = &sysctl_dccp_rx_ccid,
  36. .maxlen = sizeof(sysctl_dccp_rx_ccid),
  37. .mode = 0644,
  38. .proc_handler = proc_dointvec_minmax,
  39. .extra1 = &zero,
  40. .extra2 = &u8_max, /* RFC 4340, 10. */
  41. },
  42. {
  43. .procname = "tx_ccid",
  44. .data = &sysctl_dccp_tx_ccid,
  45. .maxlen = sizeof(sysctl_dccp_tx_ccid),
  46. .mode = 0644,
  47. .proc_handler = proc_dointvec_minmax,
  48. .extra1 = &zero,
  49. .extra2 = &u8_max, /* RFC 4340, 10. */
  50. },
  51. {
  52. .procname = "request_retries",
  53. .data = &sysctl_dccp_request_retries,
  54. .maxlen = sizeof(sysctl_dccp_request_retries),
  55. .mode = 0644,
  56. .proc_handler = proc_dointvec_minmax,
  57. .extra1 = &zero,
  58. .extra2 = &u8_max,
  59. },
  60. {
  61. .procname = "retries1",
  62. .data = &sysctl_dccp_retries1,
  63. .maxlen = sizeof(sysctl_dccp_retries1),
  64. .mode = 0644,
  65. .proc_handler = proc_dointvec_minmax,
  66. .extra1 = &zero,
  67. .extra2 = &u8_max,
  68. },
  69. {
  70. .procname = "retries2",
  71. .data = &sysctl_dccp_retries2,
  72. .maxlen = sizeof(sysctl_dccp_retries2),
  73. .mode = 0644,
  74. .proc_handler = proc_dointvec_minmax,
  75. .extra1 = &zero,
  76. .extra2 = &u8_max,
  77. },
  78. {
  79. .procname = "tx_qlen",
  80. .data = &sysctl_dccp_tx_qlen,
  81. .maxlen = sizeof(sysctl_dccp_tx_qlen),
  82. .mode = 0644,
  83. .proc_handler = proc_dointvec_minmax,
  84. .extra1 = &zero,
  85. },
  86. {
  87. .procname = "sync_ratelimit",
  88. .data = &sysctl_dccp_sync_ratelimit,
  89. .maxlen = sizeof(sysctl_dccp_sync_ratelimit),
  90. .mode = 0644,
  91. .proc_handler = proc_dointvec_ms_jiffies,
  92. },
  93. { }
  94. };
  95. static struct ctl_path dccp_path[] = {
  96. { .procname = "net", },
  97. { .procname = "dccp", },
  98. { .procname = "default", },
  99. { }
  100. };
  101. static struct ctl_table_header *dccp_table_header;
  102. int __init dccp_sysctl_init(void)
  103. {
  104. dccp_table_header = register_sysctl_paths(dccp_path,
  105. dccp_default_table);
  106. return dccp_table_header != NULL ? 0 : -ENOMEM;
  107. }
  108. void dccp_sysctl_exit(void)
  109. {
  110. if (dccp_table_header != NULL) {
  111. unregister_sysctl_table(dccp_table_header);
  112. dccp_table_header = NULL;
  113. }
  114. }