Skip to contentSkip to conversation

cthelper: don't pass up a 0 length queue

PATCH In review Chas Williams III 2 participants 2 messages May 20, 2015 – May 21, 2015 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cthelper: don't pass up a 0 length queue

If the user didn't specify a queue length in the configuration file it will have a length of 0. Allow the kernel's default to take precedence instead.

---
 src/cthelper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/cthelper.c +3 -1
index fec40fb..6ba731b 100644
@@ -469,7 +469,9 @@ static int cthelper_nfqueue_setup(struct ctd_helper_instance *cur)
 	nfq_nlmsg_cfg_put_params(nlh, NFQNL_COPY_PACKET, 0xffff);
 	mnl_attr_put_u32(nlh, NFQA_CFG_FLAGS, htonl(NFQA_CFG_F_CONNTRACK));
 	mnl_attr_put_u32(nlh, NFQA_CFG_MASK, htonl(0xffffffff));
-	mnl_attr_put_u32(nlh, NFQA_CFG_QUEUE_MAXLEN, htonl(cur->queue_len));
+	if (cur->queue_len > 0) {
+		mnl_attr_put_u32(nlh, NFQA_CFG_QUEUE_MAXLEN, htonl(cur->queue_len));
+	}
 
 	if (mnl_socket_sendto(STATE_CTH(nl), nlh, nlh->nlmsg_len) < 0) {
 		dlog(LOG_ERR, "failed to send configuration");
Signature · 1 line
1.9.1
#1 lore raw
Quoted 3 lines · Chas Williams III

If the user didn't specify a queue length in the configuration file it will have a length of 0. Allow the kernel's default to take precedence instead.

Thanks for addressing this. Applied.

BTW, I broke line at 80 chars. We stick to Linux kernel coding style in userspace as much as possible, no problem just for the next time.