Commit a6e13e00 authored by Harald Welte's avatar Harald Welte Committed by David S. Miller

[NETFILTER]: ipt_ULOG fix for last packet delay

The ULOG target used to delay the last packet until another one was received.
This patch fixes the issue.
Signed-off-by: default avatarRuby Joker <ruby.joker@op.pl>
Signed-off-by: default avatarHarald Welte <laforge@netfilter.org>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent 0a80568f
...@@ -97,7 +97,6 @@ typedef struct { ...@@ -97,7 +97,6 @@ typedef struct {
static ulog_buff_t ulog_buffers[ULOG_MAXNLGROUPS]; /* array of buffers */ static ulog_buff_t ulog_buffers[ULOG_MAXNLGROUPS]; /* array of buffers */
static struct sock *nflognl; /* our socket */ static struct sock *nflognl; /* our socket */
static size_t qlen; /* current length of multipart-nlmsg */
DECLARE_LOCK(ulog_lock); /* spinlock */ DECLARE_LOCK(ulog_lock); /* spinlock */
/* send one ulog_buff_t to userspace */ /* send one ulog_buff_t to userspace */
...@@ -116,7 +115,7 @@ static void ulog_send(unsigned int nlgroupnum) ...@@ -116,7 +115,7 @@ static void ulog_send(unsigned int nlgroupnum)
NETLINK_CB(ub->skb).dst_groups = (1 << nlgroupnum); NETLINK_CB(ub->skb).dst_groups = (1 << nlgroupnum);
DEBUGP("ipt_ULOG: throwing %d packets to netlink mask %u\n", DEBUGP("ipt_ULOG: throwing %d packets to netlink mask %u\n",
ub->qlen, nlgroup); ub->qlen, nlgroupnum);
netlink_broadcast(nflognl, ub->skb, 0, (1 << nlgroupnum), GFP_ATOMIC); netlink_broadcast(nflognl, ub->skb, 0, (1 << nlgroupnum), GFP_ATOMIC);
ub->qlen = 0; ub->qlen = 0;
...@@ -126,7 +125,7 @@ static void ulog_send(unsigned int nlgroupnum) ...@@ -126,7 +125,7 @@ static void ulog_send(unsigned int nlgroupnum)
} }
/* timer function to flush queue in ULOG_FLUSH_INTERVAL time */ /* timer function to flush queue in flushtimeout time */
static void ulog_timer(unsigned long data) static void ulog_timer(unsigned long data)
{ {
DEBUGP("ipt_ULOG: timer function called, calling ulog_send\n"); DEBUGP("ipt_ULOG: timer function called, calling ulog_send\n");
...@@ -261,12 +260,6 @@ static void ipt_ulog_packet(unsigned int hooknum, ...@@ -261,12 +260,6 @@ static void ipt_ulog_packet(unsigned int hooknum,
ub->lastnlh->nlmsg_flags |= NLM_F_MULTI; ub->lastnlh->nlmsg_flags |= NLM_F_MULTI;
} }
/* if threshold is reached, send message to userspace */
if (qlen >= loginfo->qthreshold) {
if (loginfo->qthreshold > 1)
nlh->nlmsg_type = NLMSG_DONE;
}
ub->lastnlh = nlh; ub->lastnlh = nlh;
/* if timer isn't already running, start it */ /* if timer isn't already running, start it */
...@@ -275,6 +268,13 @@ static void ipt_ulog_packet(unsigned int hooknum, ...@@ -275,6 +268,13 @@ static void ipt_ulog_packet(unsigned int hooknum,
add_timer(&ub->timer); add_timer(&ub->timer);
} }
/* if threshold is reached, send message to userspace */
if (ub->qlen >= loginfo->qthreshold) {
if (loginfo->qthreshold > 1)
nlh->nlmsg_type = NLMSG_DONE;
ulog_send(groupnum);
}
UNLOCK_BH(&ulog_lock); UNLOCK_BH(&ulog_lock);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment