sysctl_net_llc.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. };
  46. static struct ctl_table llc_station_table[] = {
  47. { },
  48. };
  49. static struct ctl_table_header *llc2_timeout_header;
  50. static struct ctl_table_header *llc_station_header;
  51. int __init llc_sysctl_init(void)
  52. {
  53. llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
  54. llc_station_header = register_net_sysctl(&init_net, "net/llc/station", llc_station_table);
  55. if (!llc2_timeout_header || !llc_station_header) {
  56. llc_sysctl_exit();
  57. return -ENOMEM;
  58. }
  59. return 0;
  60. }
  61. void llc_sysctl_exit(void)
  62. {
  63. if (llc2_timeout_header) {
  64. unregister_net_sysctl_table(llc2_timeout_header);
  65. llc2_timeout_header = NULL;
  66. }
  67. if (llc_station_header) {
  68. unregister_net_sysctl_table(llc_station_header);
  69. llc_station_header = NULL;
  70. }
  71. }