conntrack: fix {nf, ip}_ct_iterate_cleanup endless loops
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / net / netfilter / nf_conntrack_core.h
blob85634e1865c31dca6356397e093698f18a9fd7fd
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.
6 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
7 * - generalize L3 protocol dependent part.
9 * Derived from include/linux/netfiter_ipv4/ip_conntrack_core.h
12 #ifndef _NF_CONNTRACK_CORE_H
13 #define _NF_CONNTRACK_CORE_H
15 #include <linux/netfilter.h>
16 #include <net/netfilter/nf_conntrack_l3proto.h>
17 #include <net/netfilter/nf_conntrack_l4proto.h>
18 #include <net/netfilter/nf_conntrack_ecache.h>
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. */
23 extern unsigned int nf_conntrack_in(int pf,
24 unsigned int hooknum,
25 struct sk_buff **pskb);
27 extern int nf_conntrack_init(void);
28 extern void nf_conntrack_cleanup(void);
30 struct nf_conntrack_l3proto;
31 extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf);
32 /* Like above, but you already have conntrack read lock. */
33 extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto);
35 struct nf_conntrack_l4proto;
37 extern int
38 nf_ct_get_tuple(const struct sk_buff *skb,
39 unsigned int nhoff,
40 unsigned int dataoff,
41 u_int16_t l3num,
42 u_int8_t protonum,
43 struct nf_conntrack_tuple *tuple,
44 const struct nf_conntrack_l3proto *l3proto,
45 const struct nf_conntrack_l4proto *l4proto);
47 extern int
48 nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
49 const struct nf_conntrack_tuple *orig,
50 const struct nf_conntrack_l3proto *l3proto,
51 const struct nf_conntrack_l4proto *l4proto);
53 /* Find a connection corresponding to a tuple. */
54 extern struct nf_conntrack_tuple_hash *
55 nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple,
56 const struct nf_conn *ignored_conntrack);
58 extern int __nf_conntrack_confirm(struct sk_buff **pskb);
60 /* Confirm a connection: returns NF_DROP if packet must be dropped. */
61 static inline int nf_conntrack_confirm(struct sk_buff **pskb)
63 struct nf_conn *ct = (struct nf_conn *)(*pskb)->nfct;
64 int ret = NF_ACCEPT;
66 if (ct) {
67 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
68 ret = __nf_conntrack_confirm(pskb);
69 nf_ct_deliver_cached_events(ct);
71 return ret;
74 extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb);
76 int
77 print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
78 struct nf_conntrack_l3proto *l3proto,
79 struct nf_conntrack_l4proto *proto);
81 extern struct list_head *nf_conntrack_hash;
82 extern struct list_head nf_conntrack_expect_list;
83 extern rwlock_t nf_conntrack_lock ;
84 extern struct list_head unconfirmed;
86 #endif /* _NF_CONNTRACK_CORE_H */