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