All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Leblond <eric@inl.fr>
To: Patrick McHardy <kaber@trash.net>
Cc: robert <rbscott@cadvium.net>, netfilter-devel@lists.netfilter.org
Subject: [Patch 2/2] queue_maxlen
Date: Fri, 20 Oct 2006 18:41:35 +0200	[thread overview]
Message-ID: <1161362495.7529.4.camel@localhost.localdomain> (raw)
In-Reply-To: <45389F0E.6000000@trash.net>

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

Hi,

Here's the userspace patch against libnetfilter_queue.

BR,

Le vendredi 20 octobre 2006 à 12:03 +0200, Patrick McHardy a écrit :
> Eric Leblond wrote:
> > Hi,
> > 
> > Le mardi 17 octobre 2006 à 15:43 -0700, robert a écrit :
> > 
> >>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.
> 
> Please resend, I probably missed it.
> 
> 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: libnetfilter_queue-specify-queue-max-length-from-userspace.patch --]
[-- Type: text/x-vhdl; name=libnetfilter_queue-specify-queue-max-length-from-userspace.patch; charset=us-ascii, Size: 2712 bytes --]

------------------------------------------------------------------------
 
Signed-off-by: Eric Leblond <eric@inl.fr>
 
 
---


Index: include/libnetfilter_queue/linux_nfnetlink_queue.h
===================================================================
--- include/libnetfilter_queue/linux_nfnetlink_queue.h	(révision 6470)
+++ include/libnetfilter_queue/linux_nfnetlink_queue.h	(copie de travail)
@@ -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)
Index: include/libnetfilter_queue/libnetfilter_queue.h
===================================================================
--- include/libnetfilter_queue/libnetfilter_queue.h	(révision 6470)
+++ include/libnetfilter_queue/libnetfilter_queue.h	(copie de travail)
@@ -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,
Index: src/libnetfilter_queue.c
===================================================================
--- src/libnetfilter_queue.c	(révision 6470)
+++ src/libnetfilter_queue.c	(copie de travail)
@@ -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)

      parent reply	other threads:[~2006-10-20 16:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-17 22:43 queue_maxlen robert
2006-10-17 22:54 ` queue_maxlen Eric Leblond
2006-10-20 10:03   ` queue_maxlen Patrick McHardy
2006-10-20 16:40     ` [Patch 1/2] queue_maxlen Eric Leblond
2006-10-23 22:39       ` Patrick McHardy
2006-10-20 16:41     ` Eric Leblond [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1161362495.7529.4.camel@localhost.localdomain \
    --to=eric@inl.fr \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=rbscott@cadvium.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.