Test suite for iptables
I've been making some experimental modifications to the way that userspace queuing is done in netfilter, and in particular, iptables. As part of this, I completely re-wrote ipt_do_table() in net/ipv4/netfilter/ip_tables.c to make it easier to read and work with.
I've also made other changes all over the place, including some as far
down as net/netfilter/core.c. Actual functionality shouldn't have changed with what I've done so far. Right now, I want to make sure that I haven't broken anything before continuing on with my modifications.
I tried using what I understand to be your test suite, nfsim-testsuite, but it won't compile. When it tries to compile ip_tables.c, I get the following errors:
ip_tables.c: In function ‘ipmq_queue_pkt’:
ip_tables.c:194: warning: implicit declaration of function ‘NLMSG_NEW’ ip_tables.c:194: error: ‘NLMSG_MIN_TYPE’ undeclared (first use in this function)ip_tables.c:194: error: (Each undeclared identifier is reported only once
ip_tables.c:194: error: for each function it appears in.) ip_tables.c:194: warning: assignment makes pointer from integer without a cast
ip_tables.c:196: warning: implicit declaration of function ‘NLMSG_END’ ip_tables.c:204: error: ‘MSG_DONTWAIT’ undeclared (first use in this function)
ip_tables.c:216: warning: label ‘nlmsg_failure’ defined but not used ip_tables.c: In function ‘ipmq_nl_recv’:
ip_tables.c:236: warning: implicit declaration of function ‘skb_dequeue’ ip_tables.c:236: error: ‘struct sock’ has no member named ‘sk_receive_queue’ ip_tables.c:236: warning: assignment makes pointer from integer without a castip_tables.c: In function ‘do_match’:
ip_tables.c:379: warning: pointer targets in passing argument 7 of ‘m->u.kernel.match->match’ differ in signednessip_tables.c: In function ‘ipt_init_state’:
ip_tables.c:413: warning: passing argument 1 of ‘talloc_free’ discards qualifiers from pointer target typeip_tables.c: In function ‘init’:
ip_tables.c:1843: warning: implicit declaration of function ‘kcalloc’ ip_tables.c:1843: warning: assignment makes pointer from integer without a cast
ip_tables.c:1852: error: ‘NETLINK_MQUEUE’ undeclared (first use in this function)
ip_tables.c:1852: error: too many arguments to function ‘netlink_kernel_create’
ip_tables.c:1872: warning: implicit declaration of function ‘sock_release’ make[2]: *** [ip_tables.so] Error 1
The file compiles without errors using the kernel build system. Most of the errors and warnings have to do with test code that I've added to ip_tables.c; most of it will eventually be moved to another file somewhere. Much of the code in question isn't actually being used right now, and this could be disabled for the time being (but if it won't compile now in this file, it probably won't compile later in another file). Some of the symbols mentioned are from the standard kernel headers (NLMSG_NEW, NLMSG_MIN_TYPE, skb_dequeue, struct sock, etc), while others are from my modifications (ipmq_queue_pkt, NETLINK_MQUEUE, etc). However, some of the warnings refer to stuff that's central to my modifications, such as the warnings for lines 379 (I changed the type of the 7th parameter of match functions to unsigned int), 413 (the line contains a call to kfree()) and 1843 (a call to kcalloc()).
Do you have any suggestions on how I might get this to compile and run, or how I might otherwise verify that I haven't broken anything?
Thanks,
Rennie deGraaf