standalone target module??
Hello Netfilter Developers!!
1. Thank you for writing some great software.
2. Please help me with a couple of questions; I am trying to write a netfilter extension.
I need to write a netfilter extension for a research project; there are a number of special requirements, specifically wrt. latency which can only be met by running this in kernel space.
I would like, if possible, to write this as a loadable standalone kernel module. For simplicity, I would prefer to be able to build and test my module without having to patch the kernel source. Is this feasible?
So far I have tried to copy the ipt_MIRROR.c code, change a couple of things, compile as a ipt_MYTARGET.o, insmod ipt_MYTARGET.o. Netfilter does not seem to find the new target. 'iptables -A INPUT -i eth1 -j MYTARGET' causes iptables to look for /lib/iptables/libipt_MYTARGET.so.
The next thing I tried was to run 'ld -shared -o /lib/iptables/libipt_MYTARGET.so ipt_MYTARGET.o'. This generates a number of undefined symbols for any of the kernel functions; which makes me think that the .so files in /lib/iptables are not actually kernel modules... unfortunately the files there have been strip'd so I have no idea what is in them.
What I am really seeking is an example Makefile for building a standalone netfilter target as a module. Does such a thing exist? I have already google'd my eyes out trying to solve this problem with no luck so far.
Thanks for your time,
Andy.
---
Andy W. Schmeder
andy @ a 2 h d . com
Quoted 3 lines · Andy Schmeder
I would like, if possible, to write this as a loadable standalone kernel module. For simplicity, I would prefer to be able to build and test my module without having to patch the kernel source. Is this feasible?
Yes, it is.
Quoted 4 lines
So far I have tried to copy the
ipt_MIRROR.ccode, change a couple of things, compile as a ipt_MYTARGET.o, insmod ipt_MYTARGET.o. Netfilter does not seem to find the new target. 'iptables -A INPUT -i eth1 -j MYTARGET' causes iptables to look for/lib/iptables/libipt_MYTARGET.so.
of course.
Quoted 6 lines
The next thing I tried was to run 'ld -shared -o
/lib/iptables/libipt_MYTARGET.soipt_MYTARGET.o'. This generates a number of undefined symbols for any of the kernel functions; which makes me think that the .so files in/lib/iptablesare not actually kernel modules... unfortunately the files there have been strip'd so I have no idea what is in them.
You seem to have misunderstood how iptables extensions are working. There are always two parts, one in userspace and one in the kernel. Please look at the source of libipt_MIRROR.c in the 'userspace/extensions' directory of the netfilter CVS tree. This is the userspace counterpart to ipt_MIRROR.c inside the kernel.
Quoted 3 lines
What I am really seeking is an example
Makefilefor building a standalone netfilter target as a module. Does such a thing exist? I have already google'd my eyes out trying to solve this problem with no luck so far.
No. But it shouldn't be any different than creating a makefile for any other out-of-kernel compilation (like pcmcia-cs, linux-wlan-ng, etc.). Please look for examples there, in order to see how to get the compile-options right, etc.
Quoted 2 lines
Thanks for your time,
Andy.
Signature · 4 lines
- Harald Welte / [email protected] http://www.gnumonks.org/ ============================================================================ "If this were a dictatorship, it'd be a heck of a lot easier, just so long as I'm the dictator." -- George W. Bush Dec 18, 2000
<quote who="Harald Welte">
Quoted 5 lines
You seem to have misunderstood how iptables extensions are working. There are always two parts, one in userspace and one in the kernel. Please look at the source of
libipt_MIRROR.cin the 'userspace/extensions' directory of the netfilter CVS tree. This is the userspace counterpart toipt_MIRROR.cinside the kernel.
Yup, that's it exactly. I've got it working now, thanks. I looked at the code for ULOG in CVS and that helped a lot.
Andy.