Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Alexey Dobriyan | dfdb8d7 | 2008-10-08 11:35:02 +0200 | [diff] [blame] | 2 | #ifndef __NETNS_CONNTRACK_H |
| 3 | #define __NETNS_CONNTRACK_H |
| 4 | |
Alexey Dobriyan | 63c9a26 | 2008-10-08 11:35:04 +0200 | [diff] [blame] | 5 | #include <linux/list.h> |
Eric Dumazet | ea781f1 | 2009-03-25 21:05:46 +0100 | [diff] [blame] | 6 | #include <linux/list_nulls.h> |
Arun Sharma | 60063497 | 2011-07-26 16:09:06 -0700 | [diff] [blame] | 7 | #include <linux/atomic.h> |
Florian Westphal | 9500507 | 2014-06-10 23:12:56 +0200 | [diff] [blame] | 8 | #include <linux/workqueue.h> |
Gao feng | d2ba1fde | 2012-05-28 21:04:12 +0000 | [diff] [blame] | 9 | #include <linux/netfilter/nf_conntrack_tcp.h> |
Davide Caratti | c51d390 | 2016-11-15 15:08:25 +0100 | [diff] [blame] | 10 | #ifdef CONFIG_NF_CT_PROTO_DCCP |
| 11 | #include <linux/netfilter/nf_conntrack_dccp.h> |
| 12 | #endif |
Davide Caratti | a85406a | 2016-11-15 15:08:26 +0100 | [diff] [blame] | 13 | #ifdef CONFIG_NF_CT_PROTO_SCTP |
| 14 | #include <linux/netfilter/nf_conntrack_sctp.h> |
| 15 | #endif |
Jesper Dangaard Brouer | 93bb0ce | 2014-03-03 14:46:13 +0100 | [diff] [blame] | 16 | #include <linux/seqlock.h> |
Alexey Dobriyan | 49ac871 | 2008-10-08 11:35:03 +0200 | [diff] [blame] | 17 | |
Alexey Dobriyan | 8025070 | 2008-10-08 11:35:08 +0200 | [diff] [blame] | 18 | struct ctl_table_header; |
Alexey Dobriyan | 6058fa6 | 2008-10-08 11:35:07 +0200 | [diff] [blame] | 19 | struct nf_conntrack_ecache; |
| 20 | |
Gao feng | 15f585b | 2012-05-28 21:04:11 +0000 | [diff] [blame] | 21 | struct nf_generic_net { |
Gao feng | 15f585b | 2012-05-28 21:04:11 +0000 | [diff] [blame] | 22 | unsigned int timeout; |
| 23 | }; |
| 24 | |
Gao feng | d2ba1fde | 2012-05-28 21:04:12 +0000 | [diff] [blame] | 25 | struct nf_tcp_net { |
Gao feng | d2ba1fde | 2012-05-28 21:04:12 +0000 | [diff] [blame] | 26 | unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX]; |
Tonghao Zhang | 8f14c99 | 2019-04-07 08:14:20 -0700 | [diff] [blame] | 27 | int tcp_loose; |
| 28 | int tcp_be_liberal; |
| 29 | int tcp_max_retrans; |
Gao feng | d2ba1fde | 2012-05-28 21:04:12 +0000 | [diff] [blame] | 30 | }; |
| 31 | |
Gao feng | 0ce490a | 2012-05-28 21:04:13 +0000 | [diff] [blame] | 32 | enum udp_conntrack { |
| 33 | UDP_CT_UNREPLIED, |
| 34 | UDP_CT_REPLIED, |
| 35 | UDP_CT_MAX |
| 36 | }; |
| 37 | |
| 38 | struct nf_udp_net { |
Gao feng | 0ce490a | 2012-05-28 21:04:13 +0000 | [diff] [blame] | 39 | unsigned int timeouts[UDP_CT_MAX]; |
| 40 | }; |
| 41 | |
Gao feng | 4b626b9 | 2012-05-28 21:04:14 +0000 | [diff] [blame] | 42 | struct nf_icmp_net { |
Gao feng | 4b626b9 | 2012-05-28 21:04:14 +0000 | [diff] [blame] | 43 | unsigned int timeout; |
| 44 | }; |
| 45 | |
Davide Caratti | c51d390 | 2016-11-15 15:08:25 +0100 | [diff] [blame] | 46 | #ifdef CONFIG_NF_CT_PROTO_DCCP |
| 47 | struct nf_dccp_net { |
Davide Caratti | c51d390 | 2016-11-15 15:08:25 +0100 | [diff] [blame] | 48 | int dccp_loose; |
| 49 | unsigned int dccp_timeout[CT_DCCP_MAX + 1]; |
| 50 | }; |
| 51 | #endif |
| 52 | |
Davide Caratti | a85406a | 2016-11-15 15:08:26 +0100 | [diff] [blame] | 53 | #ifdef CONFIG_NF_CT_PROTO_SCTP |
| 54 | struct nf_sctp_net { |
Davide Caratti | a85406a | 2016-11-15 15:08:26 +0100 | [diff] [blame] | 55 | unsigned int timeouts[SCTP_CONNTRACK_MAX]; |
| 56 | }; |
| 57 | #endif |
| 58 | |
Florian Westphal | 22fc4c4 | 2019-01-15 22:03:35 +0100 | [diff] [blame] | 59 | #ifdef CONFIG_NF_CT_PROTO_GRE |
| 60 | enum gre_conntrack { |
| 61 | GRE_CT_UNREPLIED, |
| 62 | GRE_CT_REPLIED, |
| 63 | GRE_CT_MAX |
| 64 | }; |
| 65 | |
| 66 | struct nf_gre_net { |
Florian Westphal | 22fc4c4 | 2019-01-15 22:03:35 +0100 | [diff] [blame] | 67 | struct list_head keymap_list; |
| 68 | unsigned int timeouts[GRE_CT_MAX]; |
| 69 | }; |
| 70 | #endif |
| 71 | |
Gao feng | 524a53e | 2012-05-28 21:04:10 +0000 | [diff] [blame] | 72 | struct nf_ip_net { |
Gao feng | 15f585b | 2012-05-28 21:04:11 +0000 | [diff] [blame] | 73 | struct nf_generic_net generic; |
Gao feng | d2ba1fde | 2012-05-28 21:04:12 +0000 | [diff] [blame] | 74 | struct nf_tcp_net tcp; |
Gao feng | 0ce490a | 2012-05-28 21:04:13 +0000 | [diff] [blame] | 75 | struct nf_udp_net udp; |
Gao feng | 4b626b9 | 2012-05-28 21:04:14 +0000 | [diff] [blame] | 76 | struct nf_icmp_net icmp; |
Gao feng | 7080ba0 | 2012-05-28 21:04:15 +0000 | [diff] [blame] | 77 | struct nf_icmp_net icmpv6; |
Davide Caratti | c51d390 | 2016-11-15 15:08:25 +0100 | [diff] [blame] | 78 | #ifdef CONFIG_NF_CT_PROTO_DCCP |
| 79 | struct nf_dccp_net dccp; |
| 80 | #endif |
Davide Caratti | a85406a | 2016-11-15 15:08:26 +0100 | [diff] [blame] | 81 | #ifdef CONFIG_NF_CT_PROTO_SCTP |
| 82 | struct nf_sctp_net sctp; |
| 83 | #endif |
Florian Westphal | 22fc4c4 | 2019-01-15 22:03:35 +0100 | [diff] [blame] | 84 | #ifdef CONFIG_NF_CT_PROTO_GRE |
| 85 | struct nf_gre_net gre; |
| 86 | #endif |
Gao feng | 524a53e | 2012-05-28 21:04:10 +0000 | [diff] [blame] | 87 | }; |
| 88 | |
Jesper Dangaard Brouer | b7779d0 | 2014-03-03 14:45:20 +0100 | [diff] [blame] | 89 | struct ct_pcpu { |
| 90 | spinlock_t lock; |
| 91 | struct hlist_nulls_head unconfirmed; |
| 92 | struct hlist_nulls_head dying; |
Jesper Dangaard Brouer | b7779d0 | 2014-03-03 14:45:20 +0100 | [diff] [blame] | 93 | }; |
| 94 | |
Alexey Dobriyan | dfdb8d7 | 2008-10-08 11:35:02 +0200 | [diff] [blame] | 95 | struct netns_ct { |
Alexey Dobriyan | 49ac871 | 2008-10-08 11:35:03 +0200 | [diff] [blame] | 96 | atomic_t count; |
Alexey Dobriyan | 9b03f38 | 2008-10-08 11:35:03 +0200 | [diff] [blame] | 97 | unsigned int expect_count; |
Florian Westphal | 9500507 | 2014-06-10 23:12:56 +0200 | [diff] [blame] | 98 | #ifdef CONFIG_NF_CONNTRACK_EVENTS |
| 99 | struct delayed_work ecache_dwork; |
| 100 | bool ecache_dwork_pending; |
| 101 | #endif |
Florian Westphal | 8527f9d | 2018-12-18 23:04:50 +0100 | [diff] [blame] | 102 | bool auto_assign_helper_warned; |
Jesper Dangaard Brouer | 8cf4d6a | 2013-11-15 15:57:53 +0100 | [diff] [blame] | 103 | #ifdef CONFIG_SYSCTL |
| 104 | struct ctl_table_header *sysctl_header; |
Jesper Dangaard Brouer | 8cf4d6a | 2013-11-15 15:57:53 +0100 | [diff] [blame] | 105 | #endif |
Jesper Dangaard Brouer | 8cf4d6a | 2013-11-15 15:57:53 +0100 | [diff] [blame] | 106 | unsigned int sysctl_log_invalid; /* Log invalid packets */ |
Jesper Dangaard Brouer | 8cf4d6a | 2013-11-15 15:57:53 +0100 | [diff] [blame] | 107 | int sysctl_events; |
| 108 | int sysctl_acct; |
| 109 | int sysctl_auto_assign_helper; |
Jesper Dangaard Brouer | 8cf4d6a | 2013-11-15 15:57:53 +0100 | [diff] [blame] | 110 | int sysctl_tstamp; |
| 111 | int sysctl_checksum; |
| 112 | |
Jesper Dangaard Brouer | b7779d0 | 2014-03-03 14:45:20 +0100 | [diff] [blame] | 113 | struct ct_pcpu __percpu *pcpu_lists; |
Tejun Heo | 7d720c3 | 2010-02-16 15:20:26 +0000 | [diff] [blame] | 114 | struct ip_conntrack_stat __percpu *stat; |
Pablo Neira Ayuso | 70e9942 | 2011-11-22 00:16:51 +0100 | [diff] [blame] | 115 | struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; |
| 116 | struct nf_exp_event_notifier __rcu *nf_expect_event_cb; |
Gao feng | 524a53e | 2012-05-28 21:04:10 +0000 | [diff] [blame] | 117 | struct nf_ip_net nf_ct_proto; |
Florian Westphal | c539f01 | 2013-01-11 06:30:44 +0000 | [diff] [blame] | 118 | #if defined(CONFIG_NF_CONNTRACK_LABELS) |
| 119 | unsigned int labels_used; |
Florian Westphal | c539f01 | 2013-01-11 06:30:44 +0000 | [diff] [blame] | 120 | #endif |
Alexey Dobriyan | dfdb8d7 | 2008-10-08 11:35:02 +0200 | [diff] [blame] | 121 | }; |
| 122 | #endif |