netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* netfilter_queue : use --queue-balance in multithreaded environment
@ 2012-03-02  9:38 Arif Hossain
  2012-03-06 21:45 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: Arif Hossain @ 2012-03-02  9:38 UTC (permalink / raw)
  To: netfilter, netfilter-devel

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-06 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-02  9:38 netfilter_queue : use --queue-balance in multithreaded environment Arif Hossain
2012-03-06 21:45 ` Florian Westphal

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).