18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __NETNS_CONNTRACK_H
38c2ecf20Sopenharmony_ci#define __NETNS_CONNTRACK_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/list.h>
68c2ecf20Sopenharmony_ci#include <linux/list_nulls.h>
78c2ecf20Sopenharmony_ci#include <linux/atomic.h>
88c2ecf20Sopenharmony_ci#include <linux/workqueue.h>
98c2ecf20Sopenharmony_ci#include <linux/netfilter/nf_conntrack_tcp.h>
108c2ecf20Sopenharmony_ci#ifdef CONFIG_NF_CT_PROTO_DCCP
118c2ecf20Sopenharmony_ci#include <linux/netfilter/nf_conntrack_dccp.h>
128c2ecf20Sopenharmony_ci#endif
138c2ecf20Sopenharmony_ci#ifdef CONFIG_NF_CT_PROTO_SCTP
148c2ecf20Sopenharmony_ci#include <linux/netfilter/nf_conntrack_sctp.h>
158c2ecf20Sopenharmony_ci#endif
168c2ecf20Sopenharmony_ci#include <linux/seqlock.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct ctl_table_header;
198c2ecf20Sopenharmony_cistruct nf_conntrack_ecache;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistruct nf_generic_net {
228c2ecf20Sopenharmony_ci	unsigned int timeout;
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistruct nf_tcp_net {
268c2ecf20Sopenharmony_ci	unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX];
278c2ecf20Sopenharmony_ci	int tcp_loose;
288c2ecf20Sopenharmony_ci	int tcp_be_liberal;
298c2ecf20Sopenharmony_ci	int tcp_max_retrans;
308c2ecf20Sopenharmony_ci};
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cienum udp_conntrack {
338c2ecf20Sopenharmony_ci	UDP_CT_UNREPLIED,
348c2ecf20Sopenharmony_ci	UDP_CT_REPLIED,
358c2ecf20Sopenharmony_ci	UDP_CT_MAX
368c2ecf20Sopenharmony_ci};
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistruct nf_udp_net {
398c2ecf20Sopenharmony_ci	unsigned int timeouts[UDP_CT_MAX];
408c2ecf20Sopenharmony_ci};
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistruct nf_icmp_net {
438c2ecf20Sopenharmony_ci	unsigned int timeout;
448c2ecf20Sopenharmony_ci};
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#ifdef CONFIG_NF_CT_PROTO_DCCP
478c2ecf20Sopenharmony_cistruct nf_dccp_net {
488c2ecf20Sopenharmony_ci	int dccp_loose;
498c2ecf20Sopenharmony_ci	unsigned int dccp_timeout[CT_DCCP_MAX + 1];
508c2ecf20Sopenharmony_ci};
518c2ecf20Sopenharmony_ci#endif
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#ifdef CONFIG_NF_CT_PROTO_SCTP
548c2ecf20Sopenharmony_cistruct nf_sctp_net {
558c2ecf20Sopenharmony_ci	unsigned int timeouts[SCTP_CONNTRACK_MAX];
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci#endif
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#ifdef CONFIG_NF_CT_PROTO_GRE
608c2ecf20Sopenharmony_cienum gre_conntrack {
618c2ecf20Sopenharmony_ci	GRE_CT_UNREPLIED,
628c2ecf20Sopenharmony_ci	GRE_CT_REPLIED,
638c2ecf20Sopenharmony_ci	GRE_CT_MAX
648c2ecf20Sopenharmony_ci};
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_cistruct nf_gre_net {
678c2ecf20Sopenharmony_ci	struct list_head	keymap_list;
688c2ecf20Sopenharmony_ci	unsigned int		timeouts[GRE_CT_MAX];
698c2ecf20Sopenharmony_ci};
708c2ecf20Sopenharmony_ci#endif
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_cistruct nf_ip_net {
738c2ecf20Sopenharmony_ci	struct nf_generic_net   generic;
748c2ecf20Sopenharmony_ci	struct nf_tcp_net	tcp;
758c2ecf20Sopenharmony_ci	struct nf_udp_net	udp;
768c2ecf20Sopenharmony_ci	struct nf_icmp_net	icmp;
778c2ecf20Sopenharmony_ci	struct nf_icmp_net	icmpv6;
788c2ecf20Sopenharmony_ci#ifdef CONFIG_NF_CT_PROTO_DCCP
798c2ecf20Sopenharmony_ci	struct nf_dccp_net	dccp;
808c2ecf20Sopenharmony_ci#endif
818c2ecf20Sopenharmony_ci#ifdef CONFIG_NF_CT_PROTO_SCTP
828c2ecf20Sopenharmony_ci	struct nf_sctp_net	sctp;
838c2ecf20Sopenharmony_ci#endif
848c2ecf20Sopenharmony_ci#ifdef CONFIG_NF_CT_PROTO_GRE
858c2ecf20Sopenharmony_ci	struct nf_gre_net	gre;
868c2ecf20Sopenharmony_ci#endif
878c2ecf20Sopenharmony_ci};
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_cistruct ct_pcpu {
908c2ecf20Sopenharmony_ci	spinlock_t		lock;
918c2ecf20Sopenharmony_ci	struct hlist_nulls_head unconfirmed;
928c2ecf20Sopenharmony_ci	struct hlist_nulls_head dying;
938c2ecf20Sopenharmony_ci};
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_cistruct netns_ct {
968c2ecf20Sopenharmony_ci	atomic_t		count;
978c2ecf20Sopenharmony_ci	unsigned int		expect_count;
988c2ecf20Sopenharmony_ci#ifdef CONFIG_NF_CONNTRACK_EVENTS
998c2ecf20Sopenharmony_ci	struct delayed_work ecache_dwork;
1008c2ecf20Sopenharmony_ci	bool ecache_dwork_pending;
1018c2ecf20Sopenharmony_ci#endif
1028c2ecf20Sopenharmony_ci	bool			auto_assign_helper_warned;
1038c2ecf20Sopenharmony_ci#ifdef CONFIG_SYSCTL
1048c2ecf20Sopenharmony_ci	struct ctl_table_header	*sysctl_header;
1058c2ecf20Sopenharmony_ci#endif
1068c2ecf20Sopenharmony_ci	unsigned int		sysctl_log_invalid; /* Log invalid packets */
1078c2ecf20Sopenharmony_ci	int			sysctl_events;
1088c2ecf20Sopenharmony_ci	int			sysctl_acct;
1098c2ecf20Sopenharmony_ci	int			sysctl_auto_assign_helper;
1108c2ecf20Sopenharmony_ci	int			sysctl_tstamp;
1118c2ecf20Sopenharmony_ci	int			sysctl_checksum;
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci	struct ct_pcpu __percpu *pcpu_lists;
1148c2ecf20Sopenharmony_ci	struct ip_conntrack_stat __percpu *stat;
1158c2ecf20Sopenharmony_ci	struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
1168c2ecf20Sopenharmony_ci	struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
1178c2ecf20Sopenharmony_ci	struct nf_ip_net	nf_ct_proto;
1188c2ecf20Sopenharmony_ci#if defined(CONFIG_NF_CONNTRACK_LABELS)
1198c2ecf20Sopenharmony_ci	unsigned int		labels_used;
1208c2ecf20Sopenharmony_ci#endif
1218c2ecf20Sopenharmony_ci};
1228c2ecf20Sopenharmony_ci#endif
123