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
,
32 const struct sk_buff
*skb
)
34 struct nf_conn
*ct
= (struct nf_conn
*)skb
->nfct
;
35 struct nf_conntrack_ecache
*ecache
;
38 ecache
= &__get_cpu_var(nf_conntrack_ecache
);
40 __nf_ct_event_cache_init(ct
);
41 ecache
->events
|= event
;
45 static inline void nf_conntrack_event(enum ip_conntrack_events event
,
48 if (nf_ct_is_confirmed(ct
) && !nf_ct_is_dying(ct
))
49 atomic_notifier_call_chain(&nf_conntrack_chain
, event
, ct
);
52 extern struct atomic_notifier_head nf_ct_expect_chain
;
53 extern int nf_ct_expect_register_notifier(struct notifier_block
*nb
);
54 extern int nf_ct_expect_unregister_notifier(struct notifier_block
*nb
);
57 nf_ct_expect_event(enum ip_conntrack_expect_events event
,
58 struct nf_conntrack_expect
*exp
)
60 atomic_notifier_call_chain(&nf_ct_expect_chain
, event
, exp
);
63 #else /* CONFIG_NF_CONNTRACK_EVENTS */
65 static inline void nf_conntrack_event_cache(enum ip_conntrack_events event
,
66 const struct sk_buff
*skb
) {}
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(void) {}
73 #endif /* CONFIG_NF_CONNTRACK_EVENTS */
75 #endif /*_NF_CONNTRACK_ECACHE_H*/