sysctl_net_llc.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * sysctl_net_llc.c: sysctl interface to LLC net subsystem.
  4. *
  5. * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  6. */
  7. #include <linux/mm.h>
  8. #include <linux/init.h>
  9. #include <linux/sysctl.h>
  10. #include <net/net_namespace.h>
  11. #include <net/llc.h>
  12. #ifndef CONFIG_SYSCTL
  13. #error This file should not be compiled without CONFIG_SYSCTL defined
  14. #endif
  15. static struct ctl_table llc2_timeout_table[] = {
  16. {
  17. .procname = "ack",
  18. .data = &sysctl_llc2_ack_timeout,
  19. .maxlen = sizeof(sysctl_llc2_ack_timeout),
  20. .mode = 0644,
  21. .proc_handler = proc_dointvec_jiffies,
  22. },
  23. {
  24. .procname = "busy",
  25. .data = &sysctl_llc2_busy_timeout,
  26. .maxlen = sizeof(sysctl_llc2_busy_timeout),
  27. .mode = 0644,
  28. .proc_handler = proc_dointvec_jiffies,
  29. },
  30. {
  31. .procname = "p",
  32. .data = &sysctl_llc2_p_timeout,
  33. .maxlen = sizeof(sysctl_llc2_p_timeout),
  34. .mode = 0644,
  35. .proc_handler = proc_dointvec_jiffies,
  36. },
  37. {
  38. .procname = "rej",
  39. .data = &sysctl_llc2_rej_timeout,
  40. .maxlen = sizeof(sysctl_llc2_rej_timeout),
  41. .mode = 0644,
  42. .proc_handler = proc_dointvec_jiffies,
  43. },
  44. };
  45. static struct ctl_table_header *llc2_timeout_header;
  46. static struct ctl_table_header *llc_station_header;
  47. int __init llc_sysctl_init(void)
  48. {
  49. struct ctl_table empty[1] = {};
  50. llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
  51. llc_station_header = register_net_sysctl_sz(&init_net, "net/llc/station", empty, 0);
  52. if (!llc2_timeout_header || !llc_station_header) {
  53. llc_sysctl_exit();
  54. return -ENOMEM;
  55. }
  56. return 0;
  57. }
  58. void llc_sysctl_exit(void)
  59. {
  60. if (llc2_timeout_header) {
  61. unregister_net_sysctl_table(llc2_timeout_header);
  62. llc2_timeout_header = NULL;
  63. }
  64. if (llc_station_header) {
  65. unregister_net_sysctl_table(llc_station_header);
  66. llc_station_header = NULL;
  67. }
  68. }