How to pass arguments to a kernel module
Dear all,
I have implemented a small firewall on linux as a kernel module (.ko) (using victor castros tutorial on netfilter programming) . and now i need to pass arguments such as source ip, dst ip, port..etc..from a remote machine to my firewall module. basically .ko module should accept that parameters and block the specific traffic. without unloading the kernel module how should i insert my firewall rules to kernel module.
can someone give me a sample code for that.
many thnaks,
Tharanga
ons 2007-05-30 klockan 21:11 -0700 skrev Tharanga Abeyseela:
Quoted 10 lines
Dear all,
I have implemented a small firewall on linux as a kernel module (.ko) (using victor castros tutorial on netfilter programming) . and now i need to pass arguments such as source ip, dst ip, port..etc..from a remote machine to my firewall module. basically .ko module should accept that parameters and block the specific traffic. without unloading the kernel module how should i insert my firewall rules to kernel module.
can someone give me a sample code for that.
You would preferably use a netlink socket
Used quite a lot by the netfilter modules, and there is a whole framework in netfilter for netlink, nfnetlink. Might be of use for you.
http://www.netfilter.org/projects/libnfnetlink/index.html
not sure if there is any documentation on how to add new nfnetlink subsystems other than the code.
For general information about Netlink see
http://linux-net.osdl.org/index.php/Generic_Netlink_HOWTO
http://www.linuxjournal.com/article/7356
Regards
Henrik