Skip to contentSkip to conversation

Help on compiling iptables targets

DISCUSSION Juan Pablo Nelson 2 participants 2 messages Jul 4, 2008 1 message not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi all
I m trying to write new tables, targets and matches for iptables. I have compiled a new table (mytable) and get a .ko file; then insmod in the kernel and finally used it from iptables command without problems.
The script i used is:

obj -m := mytable.o
all:
make -C /lib/modules/$(shell uname -r)/build SUBDIRS=$(PWD) modules

Then i compiled the TTL target (just to see if thinghs go wrong) with the same script, getting the .ko file.
When i tried to use TTL target, i got the following:

#iptables -t mangle -A PREROUTING -i eth0 -j TTL --ttl-set 64 /usr/local/libexec/xtables/libipt_TTL.so:
/usr/local/libexec/xtables/libipt_TTL.so: only ET_DYN and ET_EXEC can be loaded
iptables v1.4.1.rc2:Unknown arg '--ttl-set'

What is the correct script to generate libipt_TTL.so?
What is the reason that iptables accept .ko tables and don accept .ko targets?

Thanks,
Juan Pablo

#2 lore raw
Quoted 15 lines · Juan Pablo Nelson

Hi all
I m trying to write new tables, targets and matches for iptables. I have compiled a new table (mytable) and get a .ko file; then insmod in the kernel and finally used it from iptables command without problems.
The script i used is:

obj -m := mytable.o
all:
make -C /lib/modules/$(shell uname -r)/build SUBDIRS=$(PWD) modules

Then i compiled the TTL target (just to see if thinghs go wrong) with the same script, getting the .ko file.
When i tried to use TTL target, i got the following:

Quoted 5 lines

#iptables -t mangle -A PREROUTING -i eth0 -j TTL --ttl-set 64 /usr/local/libexec/xtables/libipt_TTL.so:
/usr/local/libexec/xtables/libipt_TTL.so: only ET_DYN and ET_EXEC can be loaded
iptables v1.4.1.rc2:Unknown arg '--ttl-set'

Who knows what you did to that file...

Quoted 2 lines

What is the correct script to generate libipt_TTL.so?
What is the reason that iptables accept .ko tables and don accept .ko targets?

iptables (usersapce) does not accept .ko files (ET_REL) at all, because they are kernel files.