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