2 * connection tracking event cache.
5 #ifndef _NF_CONNTRACK_ECACHE_H
6 #define _NF_CONNTRACK_ECACHE_H
7 #include <net/netfilter/nf_conntrack.h>
9 #include <linux/notifier.h>
10 #include <linux/interrupt.h>
11 #include <net/netfilter/nf_conntrack_expect.h>
13 #ifdef CONFIG_NF_CONNTRACK_EVENTS
14 struct nf_conntrack_ecache {
18 DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
20 #define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
22 extern struct atomic_notifier_head nf_conntrack_chain;
23 extern int nf_conntrack_register_notifier(struct notifier_block *nb);
24 extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
26 extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
27 extern void __nf_ct_event_cache_init(struct nf_conn *ct);
28 extern void nf_ct_event_cache_flush(void);
31 nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
33 struct nf_conntrack_ecache *ecache;
36 ecache = &__get_cpu_var(nf_conntrack_ecache);
38 __nf_ct_event_cache_init(ct);
39 ecache->events |= event;
43 static inline void nf_conntrack_event(enum ip_conntrack_events event,
46 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
47 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
50 extern struct atomic_notifier_head nf_ct_expect_chain;
51 extern int nf_ct_expect_register_notifier(struct notifier_block *nb);
52 extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb);
55 nf_ct_expect_event(enum ip_conntrack_expect_events event,
56 struct nf_conntrack_expect *exp)
58 atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp);
61 #else /* CONFIG_NF_CONNTRACK_EVENTS */
63 static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
64 const struct sk_buff *skb) {}
65 static inline void nf_conntrack_event(enum ip_conntrack_events event,
66 struct nf_conn *ct) {}
67 static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
68 static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
69 struct nf_conntrack_expect *exp) {}
70 static inline void nf_ct_event_cache_flush(void) {}
71 #endif /* CONFIG_NF_CONNTRACK_EVENTS */
73 #endif /*_NF_CONNTRACK_ECACHE_H*/