conntrack.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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_SCTP
  10. #include <linux/netfilter/nf_conntrack_sctp.h>
  11. #endif
  12. #include <linux/seqlock.h>
  13. struct ctl_table_header;
  14. struct nf_conntrack_ecache;
  15. struct nf_generic_net {
  16. unsigned int timeout;
  17. };
  18. struct nf_tcp_net {
  19. unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX];
  20. u8 tcp_loose;
  21. u8 tcp_be_liberal;
  22. u8 tcp_max_retrans;
  23. u8 tcp_ignore_invalid_rst;
  24. #if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
  25. unsigned int offload_timeout;
  26. #endif
  27. };
  28. enum udp_conntrack {
  29. UDP_CT_UNREPLIED,
  30. UDP_CT_REPLIED,
  31. UDP_CT_MAX
  32. };
  33. struct nf_udp_net {
  34. unsigned int timeouts[UDP_CT_MAX];
  35. #if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
  36. unsigned int offload_timeout;
  37. #endif
  38. };
  39. struct nf_icmp_net {
  40. unsigned int timeout;
  41. };
  42. #ifdef CONFIG_NF_CT_PROTO_SCTP
  43. struct nf_sctp_net {
  44. unsigned int timeouts[SCTP_CONNTRACK_MAX];
  45. };
  46. #endif
  47. #ifdef CONFIG_NF_CT_PROTO_GRE
  48. enum gre_conntrack {
  49. GRE_CT_UNREPLIED,
  50. GRE_CT_REPLIED,
  51. GRE_CT_MAX
  52. };
  53. struct nf_gre_net {
  54. struct list_head keymap_list;
  55. unsigned int timeouts[GRE_CT_MAX];
  56. };
  57. #endif
  58. struct nf_ip_net {
  59. struct nf_generic_net generic;
  60. struct nf_tcp_net tcp;
  61. struct nf_udp_net udp;
  62. struct nf_icmp_net icmp;
  63. struct nf_icmp_net icmpv6;
  64. #ifdef CONFIG_NF_CT_PROTO_SCTP
  65. struct nf_sctp_net sctp;
  66. #endif
  67. #ifdef CONFIG_NF_CT_PROTO_GRE
  68. struct nf_gre_net gre;
  69. #endif
  70. };
  71. struct netns_ct {
  72. #ifdef CONFIG_NF_CONNTRACK_EVENTS
  73. bool ecache_dwork_pending;
  74. #endif
  75. u8 sysctl_log_invalid; /* Log invalid packets */
  76. u8 sysctl_events;
  77. u8 sysctl_acct;
  78. u8 sysctl_tstamp;
  79. u8 sysctl_checksum;
  80. struct ip_conntrack_stat __percpu *stat;
  81. struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
  82. struct nf_ip_net nf_ct_proto;
  83. #if defined(CONFIG_NF_CONNTRACK_LABELS)
  84. atomic_t labels_used;
  85. #endif
  86. };
  87. #endif