conntrack.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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_generic_net {
  19. unsigned int timeout;
  20. };
  21. struct nf_tcp_net {
  22. unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX];
  23. u8 tcp_loose;
  24. u8 tcp_be_liberal;
  25. u8 tcp_max_retrans;
  26. u8 tcp_ignore_invalid_rst;
  27. #if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
  28. unsigned int offload_timeout;
  29. #endif
  30. };
  31. enum udp_conntrack {
  32. UDP_CT_UNREPLIED,
  33. UDP_CT_REPLIED,
  34. UDP_CT_MAX
  35. };
  36. struct nf_udp_net {
  37. unsigned int timeouts[UDP_CT_MAX];
  38. #if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
  39. unsigned int offload_timeout;
  40. #endif
  41. };
  42. struct nf_icmp_net {
  43. unsigned int timeout;
  44. };
  45. #ifdef CONFIG_NF_CT_PROTO_DCCP
  46. struct nf_dccp_net {
  47. u8 dccp_loose;
  48. unsigned int dccp_timeout[CT_DCCP_MAX + 1];
  49. };
  50. #endif
  51. #ifdef CONFIG_NF_CT_PROTO_SCTP
  52. struct nf_sctp_net {
  53. unsigned int timeouts[SCTP_CONNTRACK_MAX];
  54. };
  55. #endif
  56. #ifdef CONFIG_NF_CT_PROTO_GRE
  57. enum gre_conntrack {
  58. GRE_CT_UNREPLIED,
  59. GRE_CT_REPLIED,
  60. GRE_CT_MAX
  61. };
  62. struct nf_gre_net {
  63. struct list_head keymap_list;
  64. unsigned int timeouts[GRE_CT_MAX];
  65. };
  66. #endif
  67. struct nf_ip_net {
  68. struct nf_generic_net generic;
  69. struct nf_tcp_net tcp;
  70. struct nf_udp_net udp;
  71. struct nf_icmp_net icmp;
  72. struct nf_icmp_net icmpv6;
  73. #ifdef CONFIG_NF_CT_PROTO_DCCP
  74. struct nf_dccp_net dccp;
  75. #endif
  76. #ifdef CONFIG_NF_CT_PROTO_SCTP
  77. struct nf_sctp_net sctp;
  78. #endif
  79. #ifdef CONFIG_NF_CT_PROTO_GRE
  80. struct nf_gre_net gre;
  81. #endif
  82. };
  83. struct netns_ct {
  84. #ifdef CONFIG_NF_CONNTRACK_EVENTS
  85. bool ecache_dwork_pending;
  86. #endif
  87. u8 sysctl_log_invalid; /* Log invalid packets */
  88. u8 sysctl_events;
  89. u8 sysctl_acct;
  90. u8 sysctl_tstamp;
  91. u8 sysctl_checksum;
  92. struct ip_conntrack_stat __percpu *stat;
  93. struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
  94. struct nf_ip_net nf_ct_proto;
  95. #if defined(CONFIG_NF_CONNTRACK_LABELS)
  96. atomic_t labels_used;
  97. #endif
  98. };
  99. #endif