aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMichal Miroslaw <mirq-linux@rere.qmqm.pl>2007-09-28 17:44:44 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:53:38 -0400
commitd63b043d955c261f4f413eecf6e0488d7459acd4 (patch)
tree02849155a2625f06dbdd004c0a1baeb719c3b979 /net
parente35670614d10588fb9c6ed32ecd55b8242e98872 (diff)
[NETFILTER]: nfnetlink_log: flush queue early
If queue is filled to its threshold, then flush it right away instead of waiting for timer or next 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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 512741afca9f..0fa17421bbc6 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -644,9 +644,8 @@ nfulnl_log_packet(unsigned int pf,
644 goto unlock_and_release; 644 goto unlock_and_release;
645 } 645 }
646 646
647 if (inst->qlen >= qthreshold || 647 if (inst->skb &&
648 (inst->skb && size > 648 size > skb_tailroom(inst->skb) - sizeof(struct nfgenmsg)) {
649 skb_tailroom(inst->skb) - sizeof(struct nfgenmsg))) {
650 /* either the queue len is too high or we don't have 649 /* either the queue len is too high or we don't have
651 * enough room in the skb left. flush to userspace. */ 650 * enough room in the skb left. flush to userspace. */
652 UDEBUG("flushing old skb\n"); 651 UDEBUG("flushing old skb\n");
@@ -666,9 +665,11 @@ nfulnl_log_packet(unsigned int pf,
666 __build_packet_message(inst, skb, data_len, pf, 665 __build_packet_message(inst, skb, data_len, pf,
667 hooknum, in, out, li, prefix, plen); 666 hooknum, in, out, li, prefix, plen);
668 667
668 if (inst->qlen >= qthreshold)
669 __nfulnl_flush(inst);
669 /* timer_pending always called within inst->lock, so there 670 /* timer_pending always called within inst->lock, so there
670 * is no chance of a race here */ 671 * is no chance of a race here */
671 if (!timer_pending(&inst->timer)) { 672 else if (!timer_pending(&inst->timer)) {
672 instance_get(inst); 673 instance_get(inst);
673 inst->timer.expires = jiffies + (inst->flushtimeout*HZ/100); 674 inst->timer.expires = jiffies + (inst->flushtimeout*HZ/100);
674 add_timer(&inst->timer); 675 add_timer(&inst->timer);