Skip to contentSkip to conversation

NF_QUEUE examples

DISCUSSION Ulysses Almeida 4 participants 4 messages Apr 15, 2004 – Apr 16, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

I alredy googled for this topic, but couldn't find any nice text
about.

I want to understand more about NF_QUEUE return, and possibly use
it. So, where can i find simple examples of using it? Or a text explaining about it.

What I understand, is: with NF_QUEUE, I can queue some packet to be
manipulated on userspace. After this, can this packet be dequeued back to kernel space, and continue with it's journey? How can I write a userspace code, to handle with packetd queued bu NF_QUEUE? Or I didn't understand nothing about it?

Thanks for any help in advance!

Signature · 4 lines
    .~.  Ulysses Almeida
   / V \  [email protected]
 / (   ) \  Seja livre, use GNU/Linux! 
   ^^-^^
#1 lore raw

On Thu, Apr 15, 2004 at 12:22:20PM -0400, Ulysses Almeida told us:

Quoted 7 lines

I alredy googled for this topic, but couldn't find any nice text
about.

I want to understand more about NF_QUEUE return, and possibly use
it. So, where can i find simple examples of using it? Or a text explaining about it.

Quoted 5 lines

What I understand, is: with NF_QUEUE, I can queue some packet to be
manipulated on userspace. After this, can this packet be dequeued back to kernel space, and continue with it's journey? How can I write a userspace code, to handle with packetd queued bu NF_QUEUE? Or I didn't understand nothing about it?

You might want to take a look at net/ipv4/netfilter/ip_queue.c. This registers a queue handler, delivers packets to user space via netlink and reinjects them into netfilter when the packet is send back from userspace.

HTH

Sven

Quoted 8 lines

Thanks for any help in advance!

Signature · 4 lines
    .~.  Ulysses Almeida
   / V \  [email protected]
 / (   ) \  Seja livre, use GNU/Linux! 
   ^^-^^
Signature · 2 lines
Linux zion 2.6.5 #1 Sun Apr 4 19:56:55 CEST 2004 i686 athlon i386 GNU/Linux
 19:20:35  up 10 days, 20:04,  2 users,  load average: 0.06, 0.03, 0.00
#2 lore raw
In reply to Ulysses Almeida

Hi Ulysses,

Quoted 2 lines · Ulysses Almeida

where can i find simple examples of using it?

http://cvs.netfilter.org/netfilter/testsuite/tools/intercept.c

it hasn't been modified for quite some time but it works.

Quoted 4 lines

What I understand, is: with NF_QUEUE, I can queue some packet to be
manipulated on userspace. After this, can this packet be dequeued back to kernel space, and continue with it's journey?

exactly

Quoted 5 lines

How can I write a
userspace code, to handle with packetd queued bu NF_QUEUE? Or I didn't understand nothing about it?

as Sven pointed out, if you are interested you could have a look at ip_queue.c in kernel side.

regards,
Pablo

#3 lore raw
In reply to Ulysses Almeida
Quoted 2 lines · Ulysses Almeida

I alredy googled for this topic, but couldn't find any nice text
about.

See libipq (part of iptables). Includes documentation and samples.

Regards
Henrik