aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Miroslaw <mirq-linux@rere.qmqm.pl>2007-09-28 17:44:21 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:53:38 -0400
commite35670614d10588fb9c6ed32ecd55b8242e98872 (patch)
tree76d828dd2f3a046d674753e0e722caefef866fde
parent5faa1f4cb5a1f124f76172d775467f4a9db5b452 (diff)
[NETFILTER]: nfnetlink_log: kill duplicate code
Kill some cut'n'paste effect. Just after __nfulnl_send() returning, inst->skb is always NULL. Signed-off-by: Michal Miroslaw <mirq-linux@rere.qmqm.pl> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/netfilter/nfnetlink_log.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index a90a26bd618b..512741afca9f 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -188,7 +188,7 @@ out_unlock:
188 return NULL; 188 return NULL;
189} 189}
190 190
191static int __nfulnl_send(struct nfulnl_instance *inst); 191static void __nfulnl_flush(struct nfulnl_instance *inst);
192 192
193static void 193static void
194__instance_destroy(struct nfulnl_instance *inst) 194__instance_destroy(struct nfulnl_instance *inst)
@@ -202,17 +202,8 @@ __instance_destroy(struct nfulnl_instance *inst)
202 /* then flush all pending packets from skb */ 202 /* then flush all pending packets from skb */
203 203
204 spin_lock_bh(&inst->lock); 204 spin_lock_bh(&inst->lock);
205 if (inst->skb) { 205 if (inst->skb)
206 /* timer "holds" one reference (we have one more) */ 206 __nfulnl_flush(inst);
207 if (del_timer(&inst->timer))
208 instance_put(inst);
209 if (inst->qlen)
210 __nfulnl_send(inst);
211 if (inst->skb) {
212 kfree_skb(inst->skb);
213 inst->skb = NULL;
214 }
215 }
216 spin_unlock_bh(&inst->lock); 207 spin_unlock_bh(&inst->lock);
217 208
218 /* and finally put the refcount */ 209 /* and finally put the refcount */
@@ -364,6 +355,16 @@ nlmsg_failure:
364 return status; 355 return status;
365} 356}
366 357
358static void
359__nfulnl_flush(struct nfulnl_instance *inst)
360{
361 /* timer holds a reference */
362 if (del_timer(&inst->timer))
363 instance_put(inst);
364 if (inst->skb)
365 __nfulnl_send(inst);
366}
367
367static void nfulnl_timer(unsigned long data) 368static void nfulnl_timer(unsigned long data)
368{ 369{
369 struct nfulnl_instance *inst = (struct nfulnl_instance *)data; 370 struct nfulnl_instance *inst = (struct nfulnl_instance *)data;
@@ -650,10 +651,7 @@ nfulnl_log_packet(unsigned int pf,
650 * enough room in the skb left. flush to userspace. */ 651 * enough room in the skb left. flush to userspace. */
651 UDEBUG("flushing old skb\n"); 652 UDEBUG("flushing old skb\n");
652 653
653 /* timer "holds" one reference (we have another one) */ 654 __nfulnl_flush(inst);
654 if (del_timer(&inst->timer))
655 instance_put(inst);
656 __nfulnl_send(inst);
657 } 655 }
658 656
659 if (!inst->skb) { 657 if (!inst->skb) {