From: Alessandro Vesely <vesely@tana.it>
To: netfilter@vger.kernel.org
Subject: Re: libnetfilter_queue exiting on big tcp sessions
Date: Fri, 05 Nov 2010 12:09:15 +0100 [thread overview]
Message-ID: <4CD3E5DB.2000704@tana.it> (raw)
In-Reply-To: <4CD1AB54.5080603@netfilter.org>
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
On 03/Nov/10 19:35, Pablo Neira Ayuso wrote:
> On 02/11/10 16:46, Rajkumar S wrote:
>> I am using utils/nfqnl_test.c as my test program
>
> Please, see:
>
> http://git.netfilter.org/cgi-bin/gitweb.cgi?p=libnetfilter_queue.git;a=commitdiff;h=37791b0eb98c00098a6410f6dedfdce92fc88f3e;hp=c4692e02d4fc804f7aa31f407d7d2f31861753bc
Thanks for the improved docs!
For older kernels, would it also help setting something like
-A INPUT -m limit --limit 10/second -j NFQUEUE --queue-num 0?
Would you please also amend nfqnl_test.c? From this thread I grasp
that packets that overflowed the queue are still received/
transmitted, but am unable to do better than the attached (untested)
patch.
[-- Attachment #2: nfqnl_test.patch.txt --]
[-- Type: text/plain, Size: 935 bytes --]
--- nfqnl_test.original.c 2009-02-17 20:27:28.000000000 +0100
+++ nfqnl_test.c 2010-11-05 11:24:26.000000000 +0100
@@ -8,6 +8,8 @@
#include <libnetfilter_queue/libnetfilter_queue.h>
+#include <errno.h>
+
/* returns packet id */
static u_int32_t print_pkt (struct nfq_data *tb)
{
@@ -115,9 +117,21 @@
fd = nfq_fd(h);
- while ((rv = recv(fd, buf, sizeof(buf), 0)) && rv >= 0) {
- printf("pkt received\n");
- nfq_handle_packet(h, buf, rv);
+ for (;;) {
+ if ((rv = recv(fd, buf, sizeof(buf), 0)) >= 0) {
+ printf("pkt received\n");
+ nfq_handle_packet(h, buf, rv);
+ continue;
+ }
+ /* if the computer is slower than the network the buffer
+ * may fill up. Depending on the application, this error
+ * may be ignored */
+ if (errno == ENOBUFS) {
+ printf("pkt lost!!\n");
+ continue;
+ }
+ printf("recv failed: errno=%d (%s)\n",
+ errno, strerror(errno));
}
printf("unbinding from queue 0\n");
next prev parent reply other threads:[~2010-11-05 11:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-02 15:46 libnetfilter_queue exiting on big tcp sessions Rajkumar S
[not found] ` <AANLkTin_ZFeXkzJ6zELpX3pP3782YfLjHcPzHrjDt1Ae@mail.gmail.com>
[not found] ` <AANLkTikV4_MD0JZzbvKhSXjL-abMDY7Af_3FTbbTzP33@mail.gmail.com>
2010-11-02 17:51 ` Mistick Levi
2010-11-03 1:53 ` Justin Yaple
2010-11-03 5:06 ` Mistick Levi
2010-11-03 18:42 ` Justin Yaple
2010-11-03 18:55 ` Eric Dumazet
2010-11-03 19:51 ` Justin Yaple
2010-11-03 18:35 ` Pablo Neira Ayuso
2010-11-05 11:09 ` Alessandro Vesely [this message]
2010-11-07 20:44 ` Pablo Neira Ayuso
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=4CD3E5DB.2000704@tana.it \
--to=vesely@tana.it \
--cc=netfilter@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).