sysctl.c 2.8 KB

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