I want to write a Linux
2.6 netfilter
module
, which can check the incoming IP
packet information, such as dest-ip, source-ip. After that pass these information to user space
app which (i.e Socket
app) will handle these information as soon as the packet reach the HOOKs.
I want to try two ways:
1 . Inside the netfilter
module, make a fifo
struct line, every time the packet reach the hook
, put the packet information to the fifo. and with the help of /proc/example
filesystem . every time the user space app read the /proc/example
file , will get a packet information from the fifo head .
I'm a newbie of kernel
program, this program crash my kernel several times. -_-!
I wonder is this way possible?
2 . Inside the netfilter module, make a char device, the user space app read packet information from this char device. But I still don't know how to make sure to get the packet as soon as possible, is there any way when the packet reach the netfilter hook, kernel will send some signal to info user space app, then the user space app come to pick the packet information?
Thank you very much.