]>
Commit | Line | Data |
---|---|---|
9fb9cbb1 YK |
1 | /* |
2 | * This header is used to share core functionality between the | |
3 | * standalone connection tracking module, and the compatibility layer's use | |
4 | * of connection tracking. | |
5 | * | |
6 | * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
7 | * - generalize L3 protocol dependent part. | |
8 | * | |
9 | * Derived from include/linux/netfiter_ipv4/ip_conntrack_core.h | |
10 | */ | |
11 | ||
12 | #ifndef _NF_CONNTRACK_CORE_H | |
13 | #define _NF_CONNTRACK_CORE_H | |
14 | ||
15 | #include <linux/netfilter.h> | |
77ab9cff | 16 | #include <net/netfilter/nf_conntrack_l3proto.h> |
605dcad6 | 17 | #include <net/netfilter/nf_conntrack_l4proto.h> |
f6180121 | 18 | #include <net/netfilter/nf_conntrack_ecache.h> |
9fb9cbb1 YK |
19 | |
20 | /* This header is used to share core functionality between the | |
21 | standalone connection tracking module, and the compatibility layer's use | |
22 | of connection tracking. */ | |
a702a65f AD |
23 | extern unsigned int nf_conntrack_in(struct net *net, |
24 | u_int8_t pf, | |
9fb9cbb1 | 25 | unsigned int hooknum, |
3db05fea | 26 | struct sk_buff *skb); |
9fb9cbb1 | 27 | |
dfdb8d79 AD |
28 | extern int nf_conntrack_init(struct net *net); |
29 | extern void nf_conntrack_cleanup(struct net *net); | |
9fb9cbb1 | 30 | |
ac5357eb PM |
31 | extern int nf_conntrack_proto_init(void); |
32 | extern void nf_conntrack_proto_fini(void); | |
33 | ||
5f2b4c90 | 34 | extern bool |
9fb9cbb1 YK |
35 | nf_ct_get_tuple(const struct sk_buff *skb, |
36 | unsigned int nhoff, | |
37 | unsigned int dataoff, | |
38 | u_int16_t l3num, | |
39 | u_int8_t protonum, | |
40 | struct nf_conntrack_tuple *tuple, | |
41 | const struct nf_conntrack_l3proto *l3proto, | |
605dcad6 | 42 | const struct nf_conntrack_l4proto *l4proto); |
9fb9cbb1 | 43 | |
5f2b4c90 | 44 | extern bool |
9fb9cbb1 YK |
45 | nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, |
46 | const struct nf_conntrack_tuple *orig, | |
47 | const struct nf_conntrack_l3proto *l3proto, | |
605dcad6 | 48 | const struct nf_conntrack_l4proto *l4proto); |
9fb9cbb1 YK |
49 | |
50 | /* Find a connection corresponding to a tuple. */ | |
51 | extern struct nf_conntrack_tuple_hash * | |
400dad39 | 52 | nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); |
9fb9cbb1 | 53 | |
3db05fea | 54 | extern int __nf_conntrack_confirm(struct sk_buff *skb); |
9fb9cbb1 YK |
55 | |
56 | /* Confirm a connection: returns NF_DROP if packet must be dropped. */ | |
3db05fea | 57 | static inline int nf_conntrack_confirm(struct sk_buff *skb) |
9fb9cbb1 | 58 | { |
3db05fea | 59 | struct nf_conn *ct = (struct nf_conn *)skb->nfct; |
9fb9cbb1 YK |
60 | int ret = NF_ACCEPT; |
61 | ||
5962fc6d | 62 | if (ct && ct != &nf_conntrack_untracked) { |
ec68e97d | 63 | if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) |
3db05fea | 64 | ret = __nf_conntrack_confirm(skb); |
b1e93a68 PNA |
65 | if (likely(ret == NF_ACCEPT)) |
66 | nf_ct_deliver_cached_events(ct); | |
9fb9cbb1 YK |
67 | } |
68 | return ret; | |
69 | } | |
70 | ||
77ab9cff MJ |
71 | int |
72 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, | |
32948588 JE |
73 | const struct nf_conntrack_l3proto *l3proto, |
74 | const struct nf_conntrack_l4proto *proto); | |
77ab9cff | 75 | |
f8ba1aff | 76 | extern spinlock_t nf_conntrack_lock ; |
7e5d03bb | 77 | |
9fb9cbb1 | 78 | #endif /* _NF_CONNTRACK_CORE_H */ |