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/net_namespace.h>
12 #include <net/netfilter/nf_conntrack_expect.h>
14 #ifdef CONFIG_NF_CONNTRACK_EVENTS
15 struct nf_conntrack_ecache {
20 extern struct atomic_notifier_head nf_conntrack_chain;
21 extern int nf_conntrack_register_notifier(struct notifier_block *nb);
22 extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
24 extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
25 extern void __nf_ct_event_cache_init(struct nf_conn *ct);
26 extern void nf_ct_event_cache_flush(struct net *net);
29 nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
31 struct net *net = nf_ct_net(ct);
32 struct nf_conntrack_ecache *ecache;
35 ecache = per_cpu_ptr(net->ct.ecache, raw_smp_processor_id());
37 __nf_ct_event_cache_init(ct);
38 ecache->events |= event;
42 static inline void nf_conntrack_event(enum ip_conntrack_events event,
45 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
46 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
49 extern struct atomic_notifier_head nf_ct_expect_chain;
50 extern int nf_ct_expect_register_notifier(struct notifier_block *nb);
51 extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb);
54 nf_ct_expect_event(enum ip_conntrack_expect_events event,
55 struct nf_conntrack_expect *exp)
57 atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp);
60 extern int nf_conntrack_ecache_init(struct net *net);
61 extern void nf_conntrack_ecache_fini(struct net *net);
63 #else /* CONFIG_NF_CONNTRACK_EVENTS */
65 static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
66 struct nf_conn *ct) {}
67 static inline void nf_conntrack_event(enum ip_conntrack_events event,
68 struct nf_conn *ct) {}
69 static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
70 static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
71 struct nf_conntrack_expect *exp) {}
72 static inline void nf_ct_event_cache_flush(struct net *net) {}
74 static inline int nf_conntrack_ecache_init(struct net *net)
79 static inline void nf_conntrack_ecache_fini(struct net *net)
82 #endif /* CONFIG_NF_CONNTRACK_EVENTS */
84 #endif /*_NF_CONNTRACK_ECACHE_H*/