提交 55b5a91e 编写于 作者: M Michal Miroslaw 提交者: David S. Miller

[NETFILTER]: nfnetlink_log: kill duplicate code

Kill some duplicate code in nfulnl_log_packet().
Signed-off-by: NMichal Miroslaw <mirq-linux@rere.qmqm.pl>
Signed-off-by: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 09972d6f
...@@ -660,19 +660,11 @@ nfulnl_log_packet(unsigned int pf, ...@@ -660,19 +660,11 @@ nfulnl_log_packet(unsigned int pf,
break; break;
default: default:
spin_unlock_bh(&inst->lock); goto unlock_and_release;
instance_put(inst);
return;
} }
if (!inst->skb) { if (inst->qlen >= qthreshold ||
if (!(inst->skb = nfulnl_alloc_skb(inst->nlbufsiz, size))) { (inst->skb && size > skb_tailroom(inst->skb))) {
UDEBUG("error in nfulnl_alloc_skb(%u, %u)\n",
inst->nlbufsiz, size);
goto alloc_failure;
}
} else if (inst->qlen >= qthreshold ||
size > skb_tailroom(inst->skb)) {
/* either the queue len is too high or we don't have /* either the queue len is too high or we don't have
* enough room in the skb left. flush to userspace. */ * enough room in the skb left. flush to userspace. */
UDEBUG("flushing old skb\n"); UDEBUG("flushing old skb\n");
...@@ -681,13 +673,13 @@ nfulnl_log_packet(unsigned int pf, ...@@ -681,13 +673,13 @@ nfulnl_log_packet(unsigned int pf,
if (del_timer(&inst->timer)) if (del_timer(&inst->timer))
instance_put(inst); instance_put(inst);
__nfulnl_send(inst); __nfulnl_send(inst);
}
if (!(inst->skb = nfulnl_alloc_skb(inst->nlbufsiz, size))) { if (!inst->skb) {
UDEBUG("error in nfulnl_alloc_skb(%u, %u)\n", inst->skb = nfulnl_alloc_skb(inst->nlbufsiz, size);
inst->nlbufsiz, size); if (!inst->skb)
goto alloc_failure; goto alloc_failure;
} }
}
UDEBUG("qlen %d, qthreshold %d\n", inst->qlen, qthreshold); UDEBUG("qlen %d, qthreshold %d\n", inst->qlen, qthreshold);
inst->qlen++; inst->qlen++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册