How can I get these packets in the user space application?

Maarten Wijnants maarten.wijnants at pandora.be
Thu Dec 9 14:24:42 CET 2004


Hello Srinivas G,

> My doubt is: How the user application can get the packet from the 'hook'
> function? What APIs are used in the user space application to access the
> packet from the hook function?

I am trying to understand your current situation. So you have a kernel 
module that is subscribed to a certain netfilter hook and as a result starts 
receiving packets; and now you want to pass these packets from your kernel 
module to a userspace application? Is this correct?

If this is your current situation, you should issue a NF_QUEUE verdict for 
arriving packets in your kernel module to queue the packets to userspace. 
Subsequently, you will need to create a userspace application to receive the 
queued packets and run it. You can use libipq to write a userspace 
application that will accept queued packets. See the man page of libipq for 
more information on how to do this (the man page contains a fully working 
example).

I hope this helps you. Regards,
Maarten 




More information about the netfilter-devel mailing list