Skip to contentSkip to conversation

queue_maxlen

PATCH In review robert 3 participants 6 messages Oct 17, 2006 – Oct 23, 2006

Subsystems (2)
lore
Share & tools
lore

robert

author
#0 lore raw

Does NFQUEUE use the value in /proc/sys/net/ip_queue_maxlen? If not, is it possible to modify the maximum queue length for NFQUEUE?

cheers,
robert

#1 lore raw

Hi,

Quoted 2 lines · robert

Does NFQUEUE use the value in /proc/sys/net/ip_queue_maxlen? If not, is it possible to modify the maximum queue length for NFQUEUE?

Not with vanilla tree.

I've post a patch to enable it some times ago but It has not been incorporated into main tree :

http://patchwork.netfilter.org/netfilter-devel/patch.pl?id=3628
http://patchwork.netfilter.org/netfilter-devel/patch.pl?id=3629

With that patch it is possible to do so on a per-queue basis by using the new function nfq_set_queue_maxlen.

BR,
--
Eric Leblond

#2 lore raw
Quoted 10 lines · Eric Leblond

Hi,

Quoted 2 lines · robert

Does NFQUEUE use the value in /proc/sys/net/ip_queue_maxlen? If not, is it possible to modify the maximum queue length for NFQUEUE?

Not with vanilla tree.

Quoted 8 lines

I've post a patch to enable it some times ago but It has not been incorporated into main tree :

http://patchwork.netfilter.org/netfilter-devel/patch.pl?id=3628
http://patchwork.netfilter.org/netfilter-devel/patch.pl?id=3629

With that patch it is possible to do so on a per-queue basis by using the new function nfq_set_queue_maxlen.

Please resend, I probably missed it.

#3 lore raw

PATCH 1/2 queue_maxlen

Hi,

Here's the kernel patch for queue_maxlen settings.

BR,

Quoted 14 lines · Patrick McHardy
Quoted 13 lines · Eric Leblond

Hi,

Quoted 2 lines · robert

Does NFQUEUE use the value in /proc/sys/net/ip_queue_maxlen? If not, is it possible to modify the maximum queue length for NFQUEUE?

Not with vanilla tree.

I've post a patch to enable it some times ago but It has not been incorporated into main tree :

Quoted 9 lines
Quoted 5 lines

http://patchwork.netfilter.org/netfilter-devel/patch.pl?id=3628
http://patchwork.netfilter.org/netfilter-devel/patch.pl?id=3629

With that patch it is possible to do so on a per-queue basis by using the new function nfq_set_queue_maxlen.

Please resend, I probably missed it.

------------------------------------------------------------------------

---

include/linux/netfilter/nfnetlink_queue.h +1 -0
index 9e77437..22ffac0 100644
@@ -82,6 +82,7 @@ enum nfqnl_attr_config {
 	NFQA_CFG_UNSPEC,
 	NFQA_CFG_CMD,			/* nfqnl_msg_config_cmd */
 	NFQA_CFG_PARAMS,		/* nfqnl_msg_config_params */
+	NFQA_CFG_QUEUE_MAXLEN,		/* u_int32_t */
 	__NFQA_CFG_MAX
 };
 #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
net/netfilter/nfnetlink_queue.c +8 -0
index 86a4ac3..936c86b 100644
@@ -939,6 +939,14 @@ nfqnl_recv_config(struct sock *ctnl, str
 				ntohl(params->copy_range));
 	}
 
+	if (nfqa[NFQA_CFG_QUEUE_MAXLEN-1]) {
+		u_int32_t *queue_maxlen;
+		queue_maxlen = NFA_DATA(nfqa[NFQA_CFG_QUEUE_MAXLEN-1]);
+		spin_lock_bh(&queue->lock);
+		queue->queue_maxlen = ntohl(*queue_maxlen);
+		spin_unlock_bh(&queue->lock);
+	}
+
 out_put:
 	instance_put(queue);
 	return ret;
#4 lore raw
Quoted 1 line · Eric Leblond

Here's the kernel patch for queue_maxlen settings.

This looks fine, but the merge window for 2.6.19 is closed. I'm going to queue this in my inbox for 2.6.20 until Dave opens his net-2.6.20 tree, but I might ask for a resend if it stops applying for some reason.

#5 lore raw

PATCH 2/2 queue_maxlen

In reply to Patrick McHardy

Hi,

Here's the userspace patch against libnetfilter_queue.

BR,

Quoted 14 lines · Patrick McHardy
Quoted 13 lines · Eric Leblond

Hi,

Quoted 2 lines · robert

Does NFQUEUE use the value in /proc/sys/net/ip_queue_maxlen? If not, is it possible to modify the maximum queue length for NFQUEUE?

Not with vanilla tree.

I've post a patch to enable it some times ago but It has not been incorporated into main tree :

Quoted 9 lines
Quoted 5 lines

http://patchwork.netfilter.org/netfilter-devel/patch.pl?id=3628
http://patchwork.netfilter.org/netfilter-devel/patch.pl?id=3629

With that patch it is possible to do so on a per-queue basis by using the new function nfq_set_queue_maxlen.

Please resend, I probably missed it.

------------------------------------------------------------------------

---

libnetfilter_queue/linux_nfnetlink_queue.h +4 -3
Index: include/libnetfilter_queue/linux_nfnetlink_queue.h
===================================================================
@@ -1,13 +1,13 @@
 #ifndef _NFNETLINK_QUEUE_H
 #define _NFNETLINK_QUEUE_H
 
-#include <linux/types.h>
-#include <libnfnetlink/linux_nfnetlink.h>
-
 #ifndef aligned_u64
 #define aligned_u64 unsigned long long __attribute__((aligned(8)))
 #endif
 
+#include <linux/types.h>
+#include <libnfnetlink/linux_nfnetlink.h>
+
 enum nfqnl_msg_types {
 	NFQNL_MSG_PACKET,		/* packet from kernel to userspace */
 	NFQNL_MSG_VERDICT,		/* verdict from userspace to kernel */
@@ -86,6 +86,7 @@
 	NFQA_CFG_UNSPEC,
 	NFQA_CFG_CMD,			/* nfqnl_msg_config_cmd */
 	NFQA_CFG_PARAMS,		/* nfqnl_msg_config_params */
+	NFQA_CFG_QUEUE_MAXLEN,		/* u_int32_t */
 	__NFQA_CFG_MAX
 };
 #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
libnetfilter_queue/libnetfilter_queue.h +3 -0
Index: include/libnetfilter_queue/libnetfilter_queue.h
===================================================================
@@ -49,6 +49,9 @@
 extern int nfq_set_mode(struct nfq_q_handle *qh,
 			  u_int8_t mode, unsigned int len);
 
+int nfq_set_queue_maxlen(struct nfq_q_handle *qh,
+			u_int32_t queuelen);
+
 extern int nfq_set_verdict(struct nfq_q_handle *qh,
 			     u_int32_t id,
 			     u_int32_t verdict,
libnetfilter_queue.c +17 -0
Index: src/libnetfilter_queue.c
===================================================================
@@ -288,6 +288,23 @@
 	return nfnl_talk(qh->h->nfnlh, nmh, 0, 0, NULL, NULL, NULL);
 }
 
+int nfq_set_queue_maxlen(struct nfq_q_handle *qh,
+				u_int32_t queuelen)
+{
+	char buf[NFNL_HEADER_LEN
+		+NFA_LENGTH(sizeof(struct nfqnl_msg_config_params))];
+	u_int32_t queue_maxlen = htonl(queuelen);
+	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;
+
+	nfnl_fill_hdr(qh->h->nfnlssh, nmh, 0, AF_UNSPEC, qh->id,
+			NFQNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
+
+	nfnl_addattr_l(nmh, sizeof(buf), NFQA_CFG_QUEUE_MAXLEN, &queue_maxlen,
+			sizeof(queue_maxlen));
+
+	return nfnl_talk(qh->h->nfnlh, nmh, 0, 0, NULL, NULL, NULL);
+}
+
 static int __set_verdict(struct nfq_q_handle *qh, u_int32_t id,
 		u_int32_t verdict, u_int32_t mark, int set_mark,
 		u_int32_t data_len, unsigned char *data)