12 #include <linux/types.h>
13 #include <linux/netfilter.h>
16 #include <linux/stddef.h>
19 #include <linux/kernel.h>
20 #include <linux/netdevice.h>
21 #include <linux/slab.h>
22 #include <linux/export.h>
34 struct net *
net = nf_ct_net(ct);
35 unsigned long events, missed;
36 struct nf_ct_event_notifier *
notify;
38 struct nf_ct_event item;
46 e = nf_ct_ecache_find(ct);
52 if (!nf_ct_is_confirmed(ct) || nf_ct_is_dying(ct) || !events)
60 if (!((events | missed) & e->
ctmask))
67 ret = notify->fcn(events | missed, &item);
69 if (
likely(ret >= 0 && !missed))
72 spin_lock_bh(&ct->
lock);
77 spin_unlock_bh(&ct->
lock);
85 struct nf_ct_event_notifier *
new)
88 struct nf_ct_event_notifier *
notify;
92 lockdep_is_held(&nf_ct_ecache_mutex));
107 struct nf_ct_event_notifier *
new)
109 struct nf_ct_event_notifier *
notify;
113 lockdep_is_held(&nf_ct_ecache_mutex));
121 struct nf_exp_event_notifier *
new)
124 struct nf_exp_event_notifier *
notify;
128 lockdep_is_held(&nf_ct_ecache_mutex));
129 if (notify !=
NULL) {
143 struct nf_exp_event_notifier *
new)
145 struct nf_exp_event_notifier *
notify;
149 lockdep_is_held(&nf_ct_ecache_mutex));
156 #define NF_CT_EVENTS_DEFAULT 1
161 static struct ctl_table event_sysctl_table[] = {
165 .maxlen =
sizeof(
unsigned int),
170 .procname =
"nf_conntrack_events_retry_timeout",
171 .data = &
init_net.ct.sysctl_events_retry_timeout,
172 .maxlen =
sizeof(
unsigned int),
183 .id = NF_CT_EXT_ECACHE,
187 static int nf_conntrack_event_init_sysctl(
struct net *
net)
191 table =
kmemdup(event_sysctl_table,
sizeof(event_sysctl_table),
196 table[0].
data = &net->ct.sysctl_events;
197 table[1].
data = &net->ct.sysctl_events_retry_timeout;
199 net->ct.event_sysctl_header =
201 if (!net->ct.event_sysctl_header) {
213 static void nf_conntrack_event_fini_sysctl(
struct net *net)
217 table = net->ct.event_sysctl_header->ctl_table_arg;
222 static int nf_conntrack_event_init_sysctl(
struct net *net)
227 static void nf_conntrack_event_fini_sysctl(
struct net *net)
236 net->ct.sysctl_events = nf_ct_events;
237 net->ct.sysctl_events_retry_timeout = nf_ct_events_retry_timeout;
243 "event extension.\n");
244 goto out_extend_register;
248 ret = nf_conntrack_event_init_sysctl(net);
263 nf_conntrack_event_fini_sysctl(net);