* Multiple nf_bind_pf to the same protocol
@ 2009-11-02 15:09 Mattias Rönnblom
2009-11-02 15:30 ` Patrick McHardy
0 siblings, 1 reply; 4+ messages in thread
From: Mattias Rönnblom @ 2009-11-02 15:09 UTC (permalink / raw)
To: netfilter
Hi,
with NFQUEUE and the libnetfilter_queue library, is it possible to
bind several applications to same protocol (for example, AF_INET)?
That would be useful if you want to do load balancing on a multicore
system, with a thread/process serving each NFQUEUE queue.
After having a brief look at the NFQUEUE/libnetfilter_queue code, it
looks like there's only single netlink fd for all queues, and the
library does the demultiplexing. Would that mean I have to have a
"front-end" thread distributing different servering threads?
Best regards,
Mattias
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Multiple nf_bind_pf to the same protocol
2009-11-02 15:09 Multiple nf_bind_pf to the same protocol Mattias Rönnblom
@ 2009-11-02 15:30 ` Patrick McHardy
2009-11-03 10:12 ` Mattias Rönnblom
0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2009-11-02 15:30 UTC (permalink / raw)
To: Mattias Rönnblom; +Cc: netfilter
Mattias Rönnblom wrote:
> Hi,
>
> with NFQUEUE and the libnetfilter_queue library, is it possible to
> bind several applications to same protocol (for example, AF_INET)?
>
> That would be useful if you want to do load balancing on a multicore
> system, with a thread/process serving each NFQUEUE queue.
>
> After having a brief look at the NFQUEUE/libnetfilter_queue code, it
> looks like there's only single netlink fd for all queues, and the
> library does the demultiplexing. Would that mean I have to have a
> "front-end" thread distributing different servering threads?
You can bind them to different group numbers for the same AF.
The latest version of the NFQUEUE target even supports automatic
balancing between those groups based on a simple flow hash.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Multiple nf_bind_pf to the same protocol
2009-11-02 15:30 ` Patrick McHardy
@ 2009-11-03 10:12 ` Mattias Rönnblom
2009-11-03 10:50 ` Patrick McHardy
0 siblings, 1 reply; 4+ messages in thread
From: Mattias Rönnblom @ 2009-11-03 10:12 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netfilter
Patrick McHardy <kaber@trash.net> writes:
> Mattias Rönnblom wrote:
>> Hi,
>>
>> with NFQUEUE and the libnetfilter_queue library, is it possible to
>> bind several applications to same protocol (for example, AF_INET)?
>>
>> That would be useful if you want to do load balancing on a multicore
>> system, with a thread/process serving each NFQUEUE queue.
>>
>> After having a brief look at the NFQUEUE/libnetfilter_queue code, it
>> looks like there's only single netlink fd for all queues, and the
>> library does the demultiplexing. Would that mean I have to have a
>> "front-end" thread distributing different servering threads?
>
> You can bind them to different group numbers for the same AF.
> The latest version of the NFQUEUE target even supports automatic
> balancing between those groups based on a simple flow hash.
Do you by "group number" mean NFQUEUE queue number? If so, how would I
do that? The data comes on a single netlink fd, which is serviced by
one thread, which is suppose to give the data chunk to
libnetfilter_queue (nfq_handle_packet). The libary executes a callback
(depending on queue number) in the context of that thread. At least
that is my understanding of NFQUEUE/libnetfilter_queue.
(Automatic load balancing sounds great btw.)
Best regards,
Mattias
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Multiple nf_bind_pf to the same protocol
2009-11-03 10:12 ` Mattias Rönnblom
@ 2009-11-03 10:50 ` Patrick McHardy
0 siblings, 0 replies; 4+ messages in thread
From: Patrick McHardy @ 2009-11-03 10:50 UTC (permalink / raw)
To: Mattias Rönnblom; +Cc: netfilter
Mattias Rönnblom wrote:
> Patrick McHardy <kaber@trash.net> writes:
>
>> Mattias Rönnblom wrote:
>>> Hi,
>>>
>>> with NFQUEUE and the libnetfilter_queue library, is it possible to
>>> bind several applications to same protocol (for example, AF_INET)?
>>>
>>> That would be useful if you want to do load balancing on a multicore
>>> system, with a thread/process serving each NFQUEUE queue.
>>>
>>> After having a brief look at the NFQUEUE/libnetfilter_queue code, it
>>> looks like there's only single netlink fd for all queues, and the
>>> library does the demultiplexing. Would that mean I have to have a
>>> "front-end" thread distributing different servering threads?
>> You can bind them to different group numbers for the same AF.
>> The latest version of the NFQUEUE target even supports automatic
>> balancing between those groups based on a simple flow hash.
>
> Do you by "group number" mean NFQUEUE queue number? If so, how would I
> do that?
Yes. You can specify the netlink group number in the nfq_create_queue()
call.
> The data comes on a single netlink fd, which is serviced by
> one thread, which is suppose to give the data chunk to
> libnetfilter_queue (nfq_handle_packet). The libary executes a callback
> (depending on queue number) in the context of that thread. At least
> that is my understanding of NFQUEUE/libnetfilter_queue.
You can start multiple processes and bind each one to a seperate queue.
Alternatively you can create multiple queue handles in a multithreaded
programm.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-03 10:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-02 15:09 Multiple nf_bind_pf to the same protocol Mattias Rönnblom
2009-11-02 15:30 ` Patrick McHardy
2009-11-03 10:12 ` Mattias Rönnblom
2009-11-03 10:50 ` Patrick McHardy
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.