From: Mistick Levi <gmistick@gmail.com>
To: Eric Leblond <eric@inl.fr>
Cc: "netfilter-devel@vger.kernel.org" <netfilter-devel@vger.kernel.org>
Subject: Re: libnetfilter_queue - remove packet from kernel buffer, and reinject later
Date: Wed, 20 Jan 2010 22:13:14 +0200 [thread overview]
Message-ID: <6c279bde1001201213h724a22cfvc9c8e51538156ec2@mail.gmail.com> (raw)
In-Reply-To: <1263941697.4571.46.camel@ice-age>
2010/1/20 Eric Leblond <eric@inl.fr>:
> Hello,
>
> Le mardi 19 janvier 2010 à 21:25 +0200, Mistick Levi a écrit :
>> Hi,
>> I've worked with libipq, and libnetfilter_queue, and i got to a place
>> where my userspace code can't get anymore packets( with the message:
>> netlink message: no buffer space available ) .
>>
>> Now what i want to do is this:
>> Read a packet from the queue, copy it to my own queue/location in my
>> program, and re injecting the packet later on with my verdict, after i
>> finished.
>
> This is how it works ;)
>
> In fact, the 'no buffer space available' message is due to your program
> not getting packets as fast as needed: The kernel is sending packet to a
> netlink socket and the internal buffer of the socket gets filled with
> the packets waiting to be read.
>
> What you need to do is:
> * read packet as fast as you can (your callback function has to be
> fast)
> * do the intensive or delay needing work outside of the callback
> (via a thread or something)
What do you mean by doing the delay needing work outside of the
callback? in the end of the callback i should give a verdict, no ?
>
> It last option is not possible, you can increase the netlink buffer size
> via the nfnl_rcvbufsiz function. "Standard" syntax is the following:
> nfnl_rcvbufsiz(nfq_nfnlh(my_nfq_handle), NFQ_NF_BUFSIZE);
>
I will try that. what i have tried so far is increasing the:
wmem_default, wmem_max, rmem_default and rmem_max.
> BR,
>
>>
>> but to my best of my understanding, until i send a verdict the packet
>> still takes place in the queue.
>> and i've read something about using NF_STOLEN and then reinject, but i
>> dont think that NF_STOLEN is a valid verdict.
>>
>> Any ideas on how i can do what it is i wish to do? ( Clear the kernel
>> queue by transferring the packets to my queue ).
>>
>> Kind regards
>> Levi Yechiel
>> --
>> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
> --
> Eric Leblond <eric@inl.fr>
> INL: http://www.inl.fr/
> NuFW: http://www.nufw.org/
>
Well, I have to do some logic before deciding if the packet ACCEPTED
or DROPPED. and the callback is the one that decide that(send the
verdict),
My original phrasing was bad so :
Question: is it possible to take the packet out from the internal
socket(as with nfq_handle packet or recv() ) and return some verdict
like: "NF_STOLEN" ,then do the delay needing work, and then re inject
the packet to continue its normal traversal.
Thanks in advance,
Levi Yechiel
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-01-20 20:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-19 19:25 libnetfilter_queue - remove packet from kernel buffer, and reinject later Mistick Levi
2010-01-19 22:54 ` Eric Leblond
2010-01-20 20:13 ` Mistick Levi [this message]
2010-01-21 7:08 ` Eric Leblond
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=6c279bde1001201213h724a22cfvc9c8e51538156ec2@mail.gmail.com \
--to=gmistick@gmail.com \
--cc=eric@inl.fr \
--cc=netfilter-devel@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).