]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
9fb9cbb1 YK |
2 | /* |
3 | * This header is used to share core functionality between the | |
4 | * standalone connection tracking module, and the compatibility layer's use | |
5 | * of connection tracking. | |
6 | * | |
7 | * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
8 | * - generalize L3 protocol dependent part. | |
9 | * | |
10 | * Derived from include/linux/netfiter_ipv4/ip_conntrack_core.h | |
11 | */ | |
12 | ||
13 | #ifndef _NF_CONNTRACK_CORE_H | |
14 | #define _NF_CONNTRACK_CORE_H | |
15 | ||
16 | #include <linux/netfilter.h> | |
40d102cd | 17 | #include <net/netfilter/nf_conntrack.h> |
f6180121 | 18 | #include <net/netfilter/nf_conntrack_ecache.h> |
40d102cd | 19 | #include <net/netfilter/nf_conntrack_l4proto.h> |
9fb9cbb1 YK |
20 | |
21 | /* This header is used to share core functionality between the | |
22 | standalone connection tracking module, and the compatibility layer's use | |
23 | of connection tracking. */ | |
78458e3e | 24 | |
f19438bd JS |
25 | unsigned int nf_conntrack_in(struct sk_buff *skb, |
26 | const struct nf_hook_state *state); | |
4e77be46 JP |
27 | |
28 | int nf_conntrack_init_net(struct net *net); | |
29 | void nf_conntrack_cleanup_net(struct net *net); | |
30 | void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list); | |
31 | ||
4a60dc74 | 32 | void nf_conntrack_proto_pernet_init(struct net *net); |
4e77be46 JP |
33 | |
34 | int nf_conntrack_proto_init(void); | |
35 | void nf_conntrack_proto_fini(void); | |
36 | ||
37 | int nf_conntrack_init_start(void); | |
38 | void nf_conntrack_cleanup_start(void); | |
39 | ||
40 | void nf_conntrack_init_end(void); | |
41 | void nf_conntrack_cleanup_end(void); | |
42 | ||
4e77be46 | 43 | bool nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, |
303e0c55 | 44 | const struct nf_conntrack_tuple *orig); |
9fb9cbb1 YK |
45 | |
46 | /* Find a connection corresponding to a tuple. */ | |
4e77be46 | 47 | struct nf_conntrack_tuple_hash * |
308ac914 DB |
48 | nf_conntrack_find_get(struct net *net, |
49 | const struct nf_conntrack_zone *zone, | |
5d0aa2cc | 50 | const struct nf_conntrack_tuple *tuple); |
9fb9cbb1 | 51 | |
4e77be46 | 52 | int __nf_conntrack_confirm(struct sk_buff *skb); |
9fb9cbb1 YK |
53 | |
54 | /* Confirm a connection: returns NF_DROP if packet must be dropped. */ | |
3db05fea | 55 | static inline int nf_conntrack_confirm(struct sk_buff *skb) |
9fb9cbb1 | 56 | { |
cb9c6836 | 57 | struct nf_conn *ct = (struct nf_conn *)skb_nfct(skb); |
9fb9cbb1 YK |
58 | int ret = NF_ACCEPT; |
59 | ||
ab8bc7ed | 60 | if (ct) { |
fc350777 | 61 | if (!nf_ct_is_confirmed(ct)) |
3db05fea | 62 | ret = __nf_conntrack_confirm(skb); |
b1e93a68 PNA |
63 | if (likely(ret == NF_ACCEPT)) |
64 | nf_ct_deliver_cached_events(ct); | |
9fb9cbb1 YK |
65 | } |
66 | return ret; | |
67 | } | |
68 | ||
3c171f49 PNA |
69 | unsigned int nf_confirm(struct sk_buff *skb, unsigned int protoff, |
70 | struct nf_conn *ct, enum ip_conntrack_info ctinfo); | |
71 | ||
f957be9d FW |
72 | void print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, |
73 | const struct nf_conntrack_l4proto *proto); | |
77ab9cff | 74 | |
b16c2919 SL |
75 | #define CONNTRACK_LOCKS 1024 |
76 | ||
93bb0ceb | 77 | extern spinlock_t nf_conntrack_locks[CONNTRACK_LOCKS]; |
b16c2919 | 78 | void nf_conntrack_lock(spinlock_t *lock); |
7e5d03bb | 79 | |
ca7433df JDB |
80 | extern spinlock_t nf_conntrack_expect_lock; |
81 | ||
9fb9cbb1 | 82 | #endif /* _NF_CONNTRACK_CORE_H */ |