diff options
Diffstat (limited to 'net/netfilter/nf_conntrack_ecache.c')
-rw-r--r-- | net/netfilter/nf_conntrack_ecache.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c index 6b368be937c..b62c4148b92 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c | |||
@@ -27,22 +27,17 @@ | |||
27 | 27 | ||
28 | static DEFINE_MUTEX(nf_ct_ecache_mutex); | 28 | static DEFINE_MUTEX(nf_ct_ecache_mutex); |
29 | 29 | ||
30 | struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb __read_mostly; | ||
31 | EXPORT_SYMBOL_GPL(nf_conntrack_event_cb); | ||
32 | |||
33 | struct nf_exp_event_notifier __rcu *nf_expect_event_cb __read_mostly; | ||
34 | EXPORT_SYMBOL_GPL(nf_expect_event_cb); | ||
35 | |||
36 | /* deliver cached events and clear cache entry - must be called with locally | 30 | /* deliver cached events and clear cache entry - must be called with locally |
37 | * disabled softirqs */ | 31 | * disabled softirqs */ |
38 | void nf_ct_deliver_cached_events(struct nf_conn *ct) | 32 | void nf_ct_deliver_cached_events(struct nf_conn *ct) |
39 | { | 33 | { |
34 | struct net *net = nf_ct_net(ct); | ||
40 | unsigned long events; | 35 | unsigned long events; |
41 | struct nf_ct_event_notifier *notify; | 36 | struct nf_ct_event_notifier *notify; |
42 | struct nf_conntrack_ecache *e; | 37 | struct nf_conntrack_ecache *e; |
43 | 38 | ||
44 | rcu_read_lock(); | 39 | rcu_read_lock(); |
45 | notify = rcu_dereference(nf_conntrack_event_cb); | 40 | notify = rcu_dereference(net->ct.nf_conntrack_event_cb); |
46 | if (notify == NULL) | 41 | if (notify == NULL) |
47 | goto out_unlock; | 42 | goto out_unlock; |
48 | 43 | ||
@@ -83,19 +78,20 @@ out_unlock: | |||
83 | } | 78 | } |
84 | EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); | 79 | EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); |
85 | 80 | ||
86 | int nf_conntrack_register_notifier(struct nf_ct_event_notifier *new) | 81 | int nf_conntrack_register_notifier(struct net *net, |
82 | struct nf_ct_event_notifier *new) | ||
87 | { | 83 | { |
88 | int ret = 0; | 84 | int ret = 0; |
89 | struct nf_ct_event_notifier *notify; | 85 | struct nf_ct_event_notifier *notify; |
90 | 86 | ||
91 | mutex_lock(&nf_ct_ecache_mutex); | 87 | mutex_lock(&nf_ct_ecache_mutex); |
92 | notify = rcu_dereference_protected(nf_conntrack_event_cb, | 88 | notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb, |
93 | lockdep_is_held(&nf_ct_ecache_mutex)); | 89 | lockdep_is_held(&nf_ct_ecache_mutex)); |
94 | if (notify != NULL) { | 90 | if (notify != NULL) { |
95 | ret = -EBUSY; | 91 | ret = -EBUSY; |
96 | goto out_unlock; | 92 | goto out_unlock; |
97 | } | 93 | } |
98 | RCU_INIT_POINTER(nf_conntrack_event_cb, new); | 94 | RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, new); |
99 | mutex_unlock(&nf_ct_ecache_mutex); | 95 | mutex_unlock(&nf_ct_ecache_mutex); |
100 | return ret; | 96 | return ret; |
101 | 97 | ||
@@ -105,32 +101,34 @@ out_unlock: | |||
105 | } | 101 | } |
106 | EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); | 102 | EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); |
107 | 103 | ||
108 | void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *new) | 104 | void nf_conntrack_unregister_notifier(struct net *net, |
105 | struct nf_ct_event_notifier *new) | ||
109 | { | 106 | { |
110 | struct nf_ct_event_notifier *notify; | 107 | struct nf_ct_event_notifier *notify; |
111 | 108 | ||
112 | mutex_lock(&nf_ct_ecache_mutex); | 109 | mutex_lock(&nf_ct_ecache_mutex); |
113 | notify = rcu_dereference_protected(nf_conntrack_event_cb, | 110 | notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb, |
114 | lockdep_is_held(&nf_ct_ecache_mutex)); | 111 | lockdep_is_held(&nf_ct_ecache_mutex)); |
115 | BUG_ON(notify != new); | 112 | BUG_ON(notify != new); |
116 | RCU_INIT_POINTER(nf_conntrack_event_cb, NULL); | 113 | RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL); |
117 | mutex_unlock(&nf_ct_ecache_mutex); | 114 | mutex_unlock(&nf_ct_ecache_mutex); |
118 | } | 115 | } |
119 | EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); | 116 | EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); |
120 | 117 | ||
121 | int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *new) | 118 | int nf_ct_expect_register_notifier(struct net *net, |
119 | struct nf_exp_event_notifier *new) | ||
122 | { | 120 | { |
123 | int ret = 0; | 121 | int ret = 0; |
124 | struct nf_exp_event_notifier *notify; | 122 | struct nf_exp_event_notifier *notify; |
125 | 123 | ||
126 | mutex_lock(&nf_ct_ecache_mutex); | 124 | mutex_lock(&nf_ct_ecache_mutex); |
127 | notify = rcu_dereference_protected(nf_expect_event_cb, | 125 | notify = rcu_dereference_protected(net->ct.nf_expect_event_cb, |
128 | lockdep_is_held(&nf_ct_ecache_mutex)); | 126 | lockdep_is_held(&nf_ct_ecache_mutex)); |
129 | if (notify != NULL) { | 127 | if (notify != NULL) { |
130 | ret = -EBUSY; | 128 | ret = -EBUSY; |
131 | goto out_unlock; | 129 | goto out_unlock; |
132 | } | 130 | } |
133 | RCU_INIT_POINTER(nf_expect_event_cb, new); | 131 | RCU_INIT_POINTER(net->ct.nf_expect_event_cb, new); |
134 | mutex_unlock(&nf_ct_ecache_mutex); | 132 | mutex_unlock(&nf_ct_ecache_mutex); |
135 | return ret; | 133 | return ret; |
136 | 134 | ||
@@ -140,15 +138,16 @@ out_unlock: | |||
140 | } | 138 | } |
141 | EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier); | 139 | EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier); |
142 | 140 | ||
143 | void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *new) | 141 | void nf_ct_expect_unregister_notifier(struct net *net, |
142 | struct nf_exp_event_notifier *new) | ||
144 | { | 143 | { |
145 | struct nf_exp_event_notifier *notify; | 144 | struct nf_exp_event_notifier *notify; |
146 | 145 | ||
147 | mutex_lock(&nf_ct_ecache_mutex); | 146 | mutex_lock(&nf_ct_ecache_mutex); |
148 | notify = rcu_dereference_protected(nf_expect_event_cb, | 147 | notify = rcu_dereference_protected(net->ct.nf_expect_event_cb, |
149 | lockdep_is_held(&nf_ct_ecache_mutex)); | 148 | lockdep_is_held(&nf_ct_ecache_mutex)); |
150 | BUG_ON(notify != new); | 149 | BUG_ON(notify != new); |
151 | RCU_INIT_POINTER(nf_expect_event_cb, NULL); | 150 | RCU_INIT_POINTER(net->ct.nf_expect_event_cb, NULL); |
152 | mutex_unlock(&nf_ct_ecache_mutex); | 151 | mutex_unlock(&nf_ct_ecache_mutex); |
153 | } | 152 | } |
154 | EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier); | 153 | EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier); |