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 /* This structure is passed to event handler */
27 extern struct atomic_notifier_head nf_conntrack_chain
;
28 extern int nf_conntrack_register_notifier(struct notifier_block
*nb
);
29 extern int nf_conntrack_unregister_notifier(struct notifier_block
*nb
);
31 extern void nf_ct_deliver_cached_events(const struct nf_conn
*ct
);
32 extern void __nf_ct_event_cache_init(struct nf_conn
*ct
);
33 extern void nf_ct_event_cache_flush(struct net
*net
);
36 nf_conntrack_event_cache(enum ip_conntrack_events event
, struct nf_conn
*ct
)
38 struct net
*net
= nf_ct_net(ct
);
39 struct nf_conntrack_ecache
*ecache
;
42 ecache
= per_cpu_ptr(net
->ct
.ecache
, raw_smp_processor_id());
44 __nf_ct_event_cache_init(ct
);
45 ecache
->events
|= event
;
50 nf_conntrack_event_report(enum ip_conntrack_events event
,
55 struct nf_ct_event item
= {
60 if (nf_ct_is_confirmed(ct
) && !nf_ct_is_dying(ct
))
61 atomic_notifier_call_chain(&nf_conntrack_chain
, event
, &item
);
65 nf_conntrack_event(enum ip_conntrack_events event
, struct nf_conn
*ct
)
67 nf_conntrack_event_report(event
, ct
, 0, 0);
71 struct nf_conntrack_expect
*exp
;
76 extern struct atomic_notifier_head nf_ct_expect_chain
;
77 extern int nf_ct_expect_register_notifier(struct notifier_block
*nb
);
78 extern int nf_ct_expect_unregister_notifier(struct notifier_block
*nb
);
81 nf_ct_expect_event_report(enum ip_conntrack_expect_events event
,
82 struct nf_conntrack_expect
*exp
,
86 struct nf_exp_event item
= {
91 atomic_notifier_call_chain(&nf_ct_expect_chain
, event
, &item
);
95 nf_ct_expect_event(enum ip_conntrack_expect_events event
,
96 struct nf_conntrack_expect
*exp
)
98 nf_ct_expect_event_report(event
, exp
, 0, 0);
101 extern int nf_conntrack_ecache_init(struct net
*net
);
102 extern void nf_conntrack_ecache_fini(struct net
*net
);
104 #else /* CONFIG_NF_CONNTRACK_EVENTS */
106 static inline void nf_conntrack_event_cache(enum ip_conntrack_events event
,
107 struct nf_conn
*ct
) {}
108 static inline void nf_conntrack_event(enum ip_conntrack_events event
,
109 struct nf_conn
*ct
) {}
110 static inline void nf_conntrack_event_report(enum ip_conntrack_events event
,
114 static inline void nf_ct_deliver_cached_events(const struct nf_conn
*ct
) {}
115 static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event
,
116 struct nf_conntrack_expect
*exp
) {}
117 static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e
,
118 struct nf_conntrack_expect
*exp
,
121 static inline void nf_ct_event_cache_flush(struct net
*net
) {}
123 static inline int nf_conntrack_ecache_init(struct net
*net
)
128 static inline void nf_conntrack_ecache_fini(struct net
*net
)
131 #endif /* CONFIG_NF_CONNTRACK_EVENTS */
133 #endif /*_NF_CONNTRACK_ECACHE_H*/