conntrack.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __NETNS_CONNTRACK_H
  3. #define __NETNS_CONNTRACK_H
  4. #include <linux/list.h>
  5. #include <linux/list_nulls.h>
  6. #include <linux/atomic.h>
  7. #include <linux/workqueue.h>
  8. #include <linux/netfilter/nf_conntrack_tcp.h>
  9. #ifdef CONFIG_NF_CT_PROTO_DCCP
  10. #include <linux/netfilter/nf_conntrack_dccp.h>
  11. #endif
  12. #ifdef CONFIG_NF_CT_PROTO_SCTP
  13. #include <linux/netfilter/nf_conntrack_sctp.h>
  14. #endif
  15. #include <linux/seqlock.h>
  16. struct ctl_table_header;
  17. struct nf_conntrack_ecache;
  18. struct nf_proto_net {
  19. #ifdef CONFIG_SYSCTL
  20. struct ctl_table_header *ctl_table_header;
  21. struct ctl_table *ctl_table;
  22. #endif
  23. unsigned int users;
  24. };
  25. struct nf_generic_net {
  26. struct nf_proto_net pn;
  27. unsigned int timeout;
  28. };
  29. struct nf_tcp_net {
  30. struct nf_proto_net pn;
  31. unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX];
  32. unsigned int tcp_loose;
  33. unsigned int tcp_be_liberal;
  34. unsigned int tcp_max_retrans;
  35. };
  36. enum udp_conntrack {
  37. UDP_CT_UNREPLIED,
  38. UDP_CT_REPLIED,
  39. UDP_CT_MAX
  40. };
  41. struct nf_udp_net {
  42. struct nf_proto_net pn;
  43. unsigned int timeouts[UDP_CT_MAX];
  44. };
  45. struct nf_icmp_net {
  46. struct nf_proto_net pn;
  47. unsigned int timeout;
  48. };
  49. #ifdef CONFIG_NF_CT_PROTO_DCCP
  50. struct nf_dccp_net {
  51. struct nf_proto_net pn;
  52. int dccp_loose;
  53. unsigned int dccp_timeout[CT_DCCP_MAX + 1];
  54. };
  55. #endif
  56. #ifdef CONFIG_NF_CT_PROTO_SCTP
  57. struct nf_sctp_net {
  58. struct nf_proto_net pn;
  59. unsigned int timeouts[SCTP_CONNTRACK_MAX];
  60. };
  61. #endif
  62. struct nf_ip_net {
  63. struct nf_generic_net generic;
  64. struct nf_tcp_net tcp;
  65. struct nf_udp_net udp;
  66. struct nf_icmp_net icmp;
  67. struct nf_icmp_net icmpv6;
  68. #ifdef CONFIG_NF_CT_PROTO_DCCP
  69. struct nf_dccp_net dccp;
  70. #endif
  71. #ifdef CONFIG_NF_CT_PROTO_SCTP
  72. struct nf_sctp_net sctp;
  73. #endif
  74. };
  75. struct ct_pcpu {
  76. spinlock_t lock;
  77. struct hlist_nulls_head unconfirmed;
  78. struct hlist_nulls_head dying;
  79. };
  80. struct netns_ct {
  81. atomic_t count;
  82. unsigned int expect_count;
  83. #ifdef CONFIG_NF_CONNTRACK_EVENTS
  84. struct delayed_work ecache_dwork;
  85. bool ecache_dwork_pending;
  86. #endif
  87. #ifdef CONFIG_SYSCTL
  88. struct ctl_table_header *sysctl_header;
  89. struct ctl_table_header *acct_sysctl_header;
  90. struct ctl_table_header *tstamp_sysctl_header;
  91. struct ctl_table_header *event_sysctl_header;
  92. struct ctl_table_header *helper_sysctl_header;
  93. #endif
  94. unsigned int sysctl_log_invalid; /* Log invalid packets */
  95. int sysctl_events;
  96. int sysctl_acct;
  97. int sysctl_auto_assign_helper;
  98. bool auto_assign_helper_warned;
  99. int sysctl_tstamp;
  100. int sysctl_checksum;
  101. struct ct_pcpu __percpu *pcpu_lists;
  102. struct ip_conntrack_stat __percpu *stat;
  103. struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
  104. struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
  105. struct nf_ip_net nf_ct_proto;
  106. #if defined(CONFIG_NF_CONNTRACK_LABELS)
  107. unsigned int labels_used;
  108. #endif
  109. };
  110. #endif