sysctl_net_llc.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. static struct ctl_table llc2_timeout_table[] = {
  13. {
  14. .procname = "ack",
  15. .data = &sysctl_llc2_ack_timeout,
  16. .maxlen = sizeof(sysctl_llc2_ack_timeout),
  17. .mode = 0644,
  18. .proc_handler = proc_dointvec_jiffies,
  19. },
  20. {
  21. .procname = "busy",
  22. .data = &sysctl_llc2_busy_timeout,
  23. .maxlen = sizeof(sysctl_llc2_busy_timeout),
  24. .mode = 0644,
  25. .proc_handler = proc_dointvec_jiffies,
  26. },
  27. {
  28. .procname = "p",
  29. .data = &sysctl_llc2_p_timeout,
  30. .maxlen = sizeof(sysctl_llc2_p_timeout),
  31. .mode = 0644,
  32. .proc_handler = proc_dointvec_jiffies,
  33. },
  34. {
  35. .procname = "rej",
  36. .data = &sysctl_llc2_rej_timeout,
  37. .maxlen = sizeof(sysctl_llc2_rej_timeout),
  38. .mode = 0644,
  39. .proc_handler = proc_dointvec_jiffies,
  40. },
  41. };
  42. static struct ctl_table_header *llc2_timeout_header;
  43. static struct ctl_table_header *llc_station_header;
  44. int __init llc_sysctl_init(void)
  45. {
  46. struct ctl_table empty[1] = {};
  47. llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
  48. llc_station_header = register_net_sysctl_sz(&init_net, "net/llc/station", empty, 0);
  49. if (!llc2_timeout_header || !llc_station_header) {
  50. llc_sysctl_exit();
  51. return -ENOMEM;
  52. }
  53. return 0;
  54. }
  55. void llc_sysctl_exit(void)
  56. {
  57. if (llc2_timeout_header) {
  58. unregister_net_sysctl_table(llc2_timeout_header);
  59. llc2_timeout_header = NULL;
  60. }
  61. if (llc_station_header) {
  62. unregister_net_sysctl_table(llc_station_header);
  63. llc_station_header = NULL;
  64. }
  65. }