Preroute selection order
Hello,
When writing (for example) a new table, can someone please tell me how netfilter orders the tables that register to listen on a particular hook such as PREROUTE? I assume that there is a defined pecking order to which tables get accessed first?
Thanks,
Andrew.
Hi,
Quoted 4 lines
When writing (for example) a new table, can someone please tell me how netfilter orders the tables that register to listen on a particular hook such as PREROUTE? I assume that there is a defined pecking order to which tables get accessed first?
When writing a new table, you will eventually call nf_register_hook() with a 'struct nf_hook_ops' that you populate. One of the fields of that struct is called X, and if you grep for 'nf_hook_ops' in the existing table implementations, you will find that this field is usually initialized by a macro starting with NF_IP_PRI_*. Finally, grepping for those macros, you will find an include file with all the real values.
The hook functions are called in priority order, from numerically lowest to numerically highest.
best regards
Patrick
bof@cdr:~/src/linux-2.5-current$ find . -name '*.c' | xargs grep -l NF_IP_PRI ./net/bridge/br_netfilter.c ./net/ipv4/netfilter/ip_conntrack_standalone.c ./net/ipv4/netfilter/ip_fw_compat.c ./net/ipv4/netfilter/ip_nat_standalone.c ./net/ipv4/netfilter/iptable_filter.c ./net/ipv4/netfilter/iptable_mangle.c ./net/sched/sch_ingress.c bof@cdr:~/src/linux-2.5-current$ find . -name '*.h' | xargs grep -l NF_IP_PRI ./include/linux/netfilter_ipv4.h
Bug in patch-o-matic-20030107 with tcp-window-tracking patch?
I have been trying to apply the tcp-window-tracking patch to 2.2.20 from the 20030107 POM. It fails with no error but only that it didn't successfully apply the patch.
When I manually apply the patch to the kernel including the makefile changes it fails to compile with the errors below. The objects should be defined as I placed the changes from tcp-window-tracking.makefile into linux/net/ipv4/netfilter/Makefile. This should be all that is required? The tcp-windows-tracking module isn't broken is it?
Thanks,
Andrew.
gcc -D__KERNEL__ -I/iso/2.4.20/linux-2.4.20/include -Wall -Wstrict-prototype s -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -
pipe -mpreferred-stack-boundary=2 -march=i686 -nostdinc -iwithprefix
include -DKBUILD_BASENAME=ip_conntrack_proto_tcp -c -o ip_conntrack_proto_tcp.o ip_conntrack_proto_tcp.c ip_conntrack_proto_tcp.c:715: parse error before "this_object_must_be_defined_as_export_objs_in_the_Makefile" ip_conntrack_proto_tcp.c:715: warning: type defaults to int' in declaration of this_object_must_be_defined_as_export_objs_in_the_Makefile' ip_conntrack_proto_tcp.c:715: warning: data definition has no type or storage class
make[3]: *** [ip_conntrack_proto_tcp.o] Error 1
make[3]: Leaving directory `/iso/2.4.20/linux-2.4.20/net/ipv4/netfilter' make[2]: *** [first_rule] Error 2
make[2]: Leaving directory `/iso/2.4.20/linux-2.4.20/net/ipv4/netfilter' make[1]: *** [_subdir_ipv4/netfilter] Error 2
make[1]: Leaving directory `/iso/2.4.20/linux-2.4.20/net'
make: *** [_dir_net] Error 2