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