List Info

Thread: How to pass arguments to a kernel module




How to pass arguments to a kernel module
user name
2007-05-30 23:11:33
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


Re: How to pass arguments to a kernel module
country flaguser name
Sweden
2007-05-31 21:36:16
ons 2007-05-30 klockan 21:11 -0700 skrev Tharanga
Abeyseela:
> 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.ht
ml

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_HOW
TO
http://www.l
inuxjournal.com/article/7356


Regards
Henrik
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )