diff options
author | Michal Miroslaw <mirq-linux@rere.qmqm.pl> | 2007-03-23 14:11:05 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:27:37 -0400 |
commit | 55b5a91e1723280570957990a0c5ab8c3ec4090a (patch) | |
tree | 0a13befcbc97054a01c377917627347bb8c68b7a /net | |
parent | 09972d6f968d67dd82cbd403d5aa42c241a8d0cb (diff) |
[NETFILTER]: nfnetlink_log: kill duplicate code
Kill some duplicate code in nfulnl_log_packet().
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nfnetlink_log.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 3b849a72d7c9..d14cf514160f 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -660,19 +660,11 @@ nfulnl_log_packet(unsigned int pf, | |||
660 | break; | 660 | break; |
661 | 661 | ||
662 | default: | 662 | default: |
663 | spin_unlock_bh(&inst->lock); | 663 | goto unlock_and_release; |
664 | instance_put(inst); | ||
665 | return; | ||
666 | } | 664 | } |
667 | 665 | ||
668 | if (!inst->skb) { | 666 | if (inst->qlen >= qthreshold || |
669 | if (!(inst->skb = nfulnl_alloc_skb(inst->nlbufsiz, size))) { | 667 | (inst->skb && size > skb_tailroom(inst->skb))) { |
670 | UDEBUG("error in nfulnl_alloc_skb(%u, %u)\n", | ||
671 | inst->nlbufsiz, size); | ||
672 | goto alloc_failure; | ||
673 | } | ||
674 | } else if (inst->qlen >= qthreshold || | ||
675 | size > skb_tailroom(inst->skb)) { | ||
676 | /* either the queue len is too high or we don't have | 668 | /* either the queue len is too high or we don't have |
677 | * enough room in the skb left. flush to userspace. */ | 669 | * enough room in the skb left. flush to userspace. */ |
678 | UDEBUG("flushing old skb\n"); | 670 | UDEBUG("flushing old skb\n"); |
@@ -681,12 +673,12 @@ nfulnl_log_packet(unsigned int pf, | |||
681 | if (del_timer(&inst->timer)) | 673 | if (del_timer(&inst->timer)) |
682 | instance_put(inst); | 674 | instance_put(inst); |
683 | __nfulnl_send(inst); | 675 | __nfulnl_send(inst); |
676 | } | ||
684 | 677 | ||
685 | if (!(inst->skb = nfulnl_alloc_skb(inst->nlbufsiz, size))) { | 678 | if (!inst->skb) { |
686 | UDEBUG("error in nfulnl_alloc_skb(%u, %u)\n", | 679 | inst->skb = nfulnl_alloc_skb(inst->nlbufsiz, size); |
687 | inst->nlbufsiz, size); | 680 | if (!inst->skb) |
688 | goto alloc_failure; | 681 | goto alloc_failure; |
689 | } | ||
690 | } | 682 | } |
691 | 683 | ||
692 | UDEBUG("qlen %d, qthreshold %d\n", inst->qlen, qthreshold); | 684 | UDEBUG("qlen %d, qthreshold %d\n", inst->qlen, qthreshold); |