netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arif Hossain <freefall1986@gmail.com>
To: netfilter@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: netfilter_queue : use --queue-balance in multithreaded environment
Date: Fri, 02 Mar 2012 15:38:40 +0600	[thread overview]
Message-ID: <1330681120.2106.14.camel@arifLaptop> (raw)

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

Hi,

I'm using libnetfilter_queue for userspace modification of
incoming/outgoing packets. I have been using a single threaded model.
But i've found out that from 2.6.31 kernel, its possible to have
different queues for different connection. so i was wandering if its
possible to manage each queues in different threads.

normally i set up the queue handling like bellow:

struct nfq_handle * h = nfq_open();
nfq_unbind_pf(h, AF_NET);
nfq_bind_pf(h,m AF_NET);
struct nfq_q_handle(h, 0, &cb, NULL);
nfq_set_mode(qh, NFQNL_COPY_PACKET, 0xffff);

now if i want to manage like 100 queues, i will pack h,qh and que_num in
a structure and loop over it to initialize.

now my question is :

if i initialize above in the main thread and want to run the callbacks
in threads, is it enough to run infinite loop in a function which will
be given to pthread_create()? Will it run the callbacks in threads? 

i'm not sure, but my understanding tells me, a packet is popped from the
queues when nfq_set_verdict is returned. so i need to run
nfq_set_verdict in separate threads so that i packets can be popped from
queues parallel. 
-- 
"You have a voice"
                                        ----The King's Speech

Public Key : $ gpg --keyserver keyserver.ubuntu.com --recv-key C88CFC23

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

             reply	other threads:[~2012-03-02  9:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02  9:38 Arif Hossain [this message]
2012-03-06 21:45 ` netfilter_queue : use --queue-balance in multithreaded environment Florian Westphal

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=1330681120.2106.14.camel@arifLaptop \
    --to=freefall1986@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --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).