Loading...
1#ifndef __NETNS_CONNTRACK_H
2#define __NETNS_CONNTRACK_H
3
4#include <linux/list.h>
5#include <linux/list_nulls.h>
6#include <linux/atomic.h>
7#include <linux/netfilter/nf_conntrack_tcp.h>
8#include <linux/seqlock.h>
9
10struct ctl_table_header;
11struct nf_conntrack_ecache;
12
13struct nf_proto_net {
14#ifdef CONFIG_SYSCTL
15 struct ctl_table_header *ctl_table_header;
16 struct ctl_table *ctl_table;
17#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
18 struct ctl_table_header *ctl_compat_header;
19 struct ctl_table *ctl_compat_table;
20#endif
21#endif
22 unsigned int users;
23};
24
25struct nf_generic_net {
26 struct nf_proto_net pn;
27 unsigned int timeout;
28};
29
30struct nf_tcp_net {
31 struct nf_proto_net pn;
32 unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX];
33 unsigned int tcp_loose;
34 unsigned int tcp_be_liberal;
35 unsigned int tcp_max_retrans;
36};
37
38enum udp_conntrack {
39 UDP_CT_UNREPLIED,
40 UDP_CT_REPLIED,
41 UDP_CT_MAX
42};
43
44struct nf_udp_net {
45 struct nf_proto_net pn;
46 unsigned int timeouts[UDP_CT_MAX];
47};
48
49struct nf_icmp_net {
50 struct nf_proto_net pn;
51 unsigned int timeout;
52};
53
54struct nf_ip_net {
55 struct nf_generic_net generic;
56 struct nf_tcp_net tcp;
57 struct nf_udp_net udp;
58 struct nf_icmp_net icmp;
59 struct nf_icmp_net icmpv6;
60#if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT)
61 struct ctl_table_header *ctl_table_header;
62 struct ctl_table *ctl_table;
63#endif
64};
65
66struct ct_pcpu {
67 spinlock_t lock;
68 struct hlist_nulls_head unconfirmed;
69 struct hlist_nulls_head dying;
70 struct hlist_nulls_head tmpl;
71};
72
73struct netns_ct {
74 atomic_t count;
75 unsigned int expect_count;
76#ifdef CONFIG_SYSCTL
77 struct ctl_table_header *sysctl_header;
78 struct ctl_table_header *acct_sysctl_header;
79 struct ctl_table_header *tstamp_sysctl_header;
80 struct ctl_table_header *event_sysctl_header;
81 struct ctl_table_header *helper_sysctl_header;
82#endif
83 char *slabname;
84 unsigned int sysctl_log_invalid; /* Log invalid packets */
85 unsigned int sysctl_events_retry_timeout;
86 int sysctl_events;
87 int sysctl_acct;
88 int sysctl_auto_assign_helper;
89 bool auto_assign_helper_warned;
90 int sysctl_tstamp;
91 int sysctl_checksum;
92
93 unsigned int htable_size;
94 seqcount_t generation;
95 struct kmem_cache *nf_conntrack_cachep;
96 struct hlist_nulls_head *hash;
97 struct hlist_head *expect_hash;
98 struct ct_pcpu __percpu *pcpu_lists;
99 struct ip_conntrack_stat __percpu *stat;
100 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
101 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
102 struct nf_ip_net nf_ct_proto;
103#if defined(CONFIG_NF_CONNTRACK_LABELS)
104 unsigned int labels_used;
105 u8 label_words;
106#endif
107#ifdef CONFIG_NF_NAT_NEEDED
108 struct hlist_head *nat_bysource;
109 unsigned int nat_htable_size;
110#endif
111};
112#endif
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
18struct ctl_table_header;
19struct nf_conntrack_ecache;
20
21struct 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
29struct nf_generic_net {
30 struct nf_proto_net pn;
31 unsigned int timeout;
32};
33
34struct 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
42enum udp_conntrack {
43 UDP_CT_UNREPLIED,
44 UDP_CT_REPLIED,
45 UDP_CT_MAX
46};
47
48struct nf_udp_net {
49 struct nf_proto_net pn;
50 unsigned int timeouts[UDP_CT_MAX];
51};
52
53struct nf_icmp_net {
54 struct nf_proto_net pn;
55 unsigned int timeout;
56};
57
58#ifdef CONFIG_NF_CT_PROTO_DCCP
59struct 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
67struct nf_sctp_net {
68 struct nf_proto_net pn;
69 unsigned int timeouts[SCTP_CONNTRACK_MAX];
70};
71#endif
72
73struct nf_ip_net {
74 struct nf_generic_net generic;
75 struct nf_tcp_net tcp;
76 struct nf_udp_net udp;
77 struct nf_icmp_net icmp;
78 struct nf_icmp_net icmpv6;
79#ifdef CONFIG_NF_CT_PROTO_DCCP
80 struct nf_dccp_net dccp;
81#endif
82#ifdef CONFIG_NF_CT_PROTO_SCTP
83 struct nf_sctp_net sctp;
84#endif
85};
86
87struct ct_pcpu {
88 spinlock_t lock;
89 struct hlist_nulls_head unconfirmed;
90 struct hlist_nulls_head dying;
91};
92
93struct netns_ct {
94 atomic_t count;
95 unsigned int expect_count;
96#ifdef CONFIG_NF_CONNTRACK_EVENTS
97 struct delayed_work ecache_dwork;
98 bool ecache_dwork_pending;
99#endif
100#ifdef CONFIG_SYSCTL
101 struct ctl_table_header *sysctl_header;
102 struct ctl_table_header *acct_sysctl_header;
103 struct ctl_table_header *tstamp_sysctl_header;
104 struct ctl_table_header *event_sysctl_header;
105 struct ctl_table_header *helper_sysctl_header;
106#endif
107 unsigned int sysctl_log_invalid; /* Log invalid packets */
108 int sysctl_events;
109 int sysctl_acct;
110 int sysctl_auto_assign_helper;
111 bool auto_assign_helper_warned;
112 int sysctl_tstamp;
113 int sysctl_checksum;
114
115 struct ct_pcpu __percpu *pcpu_lists;
116 struct ip_conntrack_stat __percpu *stat;
117 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
118 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
119 struct nf_ip_net nf_ct_proto;
120#if defined(CONFIG_NF_CONNTRACK_LABELS)
121 unsigned int labels_used;
122#endif
123};
124#endif