Just like bug #159371, but for arptables. Patch coming as soon as I'm assigned a bug number.
Created attachment 107503 [details, diff] include linux/config.h only when __KERNEL__ defined arptables doesn't need linux/config.h anyway, make #include conditional on __KERNEL__ as with ebtables
Created attachment 107504 [details] fixed ebuild, place in portage overlay Proposed updated ebuild
Patch tested and fixes merge on both uclibc and glibc. Actually, removing the reference to linux/config.h instead of using conditional might be better, I just didn't know whether arptables would create a patch for 2.4 kernels. It doesn't look like it.
Looks like linux/config.h is totally gone from netfilter_arp.h in kernel 2.6.19, so probably next release of arptables won't suffer this problem.
really, the build system shouldnt be using those included headers i'd just as soon do: rm -rf include/linux
That's a nice idea, but the files provided by linux-headers don't work... cc -O2 -Wall -Wunused -Iinclude/linux/include/ -Iinclude/ -DARPTABLES_VERSION=\"0.0.3\" -DIPT_LIB_DIR=\"\" -c -o libarptc/libarptc.o libarptc/libarptc.c cc -O2 -Wall -Wunused -Iinclude/linux/include/ -Iinclude/ -DARPTABLES_VERSION=\"0.0.3\" -c -o extensions/arpt_standard.o extensions/arpt_standard.c In file included from libarptc/libarptc.c:29: include/libarptc/libarptc.h:55: warning: 'struct arpt_counters' declared inside parameter list include/libarptc/libarptc.h:55: warning: its scope is only this definition or declaration, which is probably not what you want include/libarptc/libarptc.h:122: warning: 'struct arpt_counters' declared inside parameter list In file included from libarptc/libarptc.c:105: libarptc/libarptc_incl.c: In function 'entry2index': libarptc/libarptc_incl.c:125: warning: format '%i' expects type 'int', but argument 3 has type 'long int' libarptc/libarptc_incl.c: In function 'arptc_init': libarptc/libarptc_incl.c:288: warning: pointer targets in passing argument 5 of 'getsockopt' differ in signedness libarptc/libarptc_incl.c: At top level: In file included from include/arptables.h:5, from arptables-standalone.c:38: include/libarptc/libarptc.h:55: warning: 'struct arpt_counters' declared inside parameter list include/libarptc/libarptc.h:55: warning: its scope is only this definition or declaration, which is probably not what you want include/libarptc/libarptc.h:122: warning: 'struct arpt_counters' declared inside parameter list In file included from arptables-standalone.c:38: include/arptables.h:118: error: expected identifier or '(' before numeric constant In file included from include/arptables.h:5, from extensions/arpt_standard.c:8: include/libarptc/libarptc.h:55: warning: 'struct arpt_counters' declared inside parameter listlibarptc/libarptc_incl.c:650: error: conflicting types for 'arptc_get_policy' include/libarptc/libarptc.h:55: error: previous declaration of 'arptc_get_policy' was here libarptc/libarptc_incl.c: In function 'arptc_get_policy': libarptc/libarptc_incl.c:662: error: dereferencing pointer to incomplete type libarptc/libarptc_incl.c: In function 'arptc_read_counter': libarptc/libarptc_incl.c:1242: warning: return from incompatible pointer type libarptc/libarptc_incl.c: In function 'arptc_set_counter': libarptc/libarptc_incl.c:1314: error: invalid application of 'sizeof' to incomplete type 'struct arpt_counters' libarptc/libarptc_incl.c: At top level: include/libarptc/libarptc.h:55: warning: its scope is only this definition or declaration, which is probably not what you want include/libarptc/libarptc.h:122: warning: 'struct arpt_counters' declared inside parameter list In file included from extensions/arpt_standard.c:8: include/arptables.h:118: error: expected identifier or '(' before numeric constant libarptc/libarptc_incl.c:1511: error: conflicting types for 'arptc_set_policy' include/libarptc/libarptc.h:122: error: previous declaration of 'arptc_set_policy' was here libarptc/libarptc_incl.c: In function 'arptc_set_policy': libarptc/libarptc_incl.c:1549: error: invalid application of 'sizeof' to incomplete type 'struct arpt_counters' libarptc/libarptc_incl.c: In function 'subtract_counters': libarptc/libarptc_incl.c:1575: error: dereferencing pointer to incomplete type libarptc/libarptc_incl.c:1575: error: dereferencing pointer to incomplete type libarptc/libarptc_incl.c:1575: error: dereferencing pointer to incomplete type libarptc/libarptc_incl.c:1576: error: dereferencing pointer to incomplete type libarptc/libarptc_incl.c:1576: error: dereferencing pointer to incomplete type libarptc/libarptc_incl.c:1576: error: dereferencing pointer to incomplete type libarptc/libarptc_incl.c: In function 'arptc_commit': libarptc/libarptc_incl.c:1588: error: invalid application of 'sizeof' to incomplete type 'struct arpt_counters' libarptc/libarptc_incl.c:1609: error: invalid application of 'sizeof' to incomplete type 'struct arpt_counters' libarptc/libarptc_incl.c:1668: warning: excess elements in struct initializer libarptc/libarptc_incl.c:1668: warning: (near initialization for '(anonymous)') libarptc/libarptc_incl.c:1668: warning: excess elements in struct initializer libarptc/libarptc_incl.c:1668: warning: (near initialization for '(anonymous)') libarptc/libarptc_incl.c:1692: warning: passing argument 1 of 'subtract_counters' from incompatible pointer type libarptc/libarptc_incl.c:1692: warning: passing argument 2 of 'subtract_counters' from incompatible pointer type libarptc/libarptc_incl.c:1692: warning: passing argument 3 of 'subtract_counters' from incompatible pointer type libarptc/libarptc_incl.c:1700: error: invalid application of 'sizeof' to incomplete type 'struct arpt_counters' In file included from include/arptables.h:5, from arptables.c:42: include/libarptc/libarptc.h:55: warning: 'struct arpt_counters' declared inside parameter list include/libarptc/libarptc.h:55: warning: its scope is only this definition or declaration, which is probably not what you want include/libarptc/libarptc.h:122: warning: 'struct arpt_counters' declared inside parameter list In file included from arptables.c:42: include/arptables.h:118: error: expected identifier or '(' before numeric constant libarptc/libarptc.c: In function 'dump_entry': libarptc/libarptc.c:136: warning: format '%llu' expects type 'long long unsigned int', but argument 2 has type 'u_int64_t' libarptc/libarptc.c:136: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type 'u_int64_t' arptables.c:157: error: expected identifier or '(' before numeric constant arptables.c: In function 'parse_target': arptables.c:878: warning: format '%i' expects type 'int', but argument 4 has type 'long unsigned int' make: *** [libarptc/libarptc.o] Error 1 make: *** Waiting for unfinished jobs.... make: *** [extensions/arpt_standard.o] Error 1 make: *** [arptables-standalone.o] Error 1 arptables.c: In function 'register_match': arptables.c:1066: warning: format '%u' expects type 'unsigned int', but argument 5 has type 'size_t' arptables.c: In function 'register_target': arptables.c:1096: warning: format '%u' expects type 'unsigned int', but argument 5 has type 'size_t' arptables.c: In function 'print_num': [snip scanf warnings] arptables.c: In function 'print_header': arptables.c:1136: error: storage size of 'counters' isn't known arptables.c:1136: warning: unused variable 'counters' arptables.c: In function 'print_firewall': [snip signedness warnings] arptables.c:1374: warning: format '%u' expects type 'unsigned int', but argument 2 has type 'long unsigned int' arptables.c: In function 'do_command': arptables.c:1788: error: invalid lvalue in assignment [snip signedness warnings] arptables.c:2162: warning: format '%llu' expects type 'long long unsigned int *', but argument 3 has type 'u_int64_t *' arptables.c:2167: warning: format '%llu' expects type 'long long unsigned int *', but argument 3 has type 'u_int64_t *' make: *** [arptables.o] Error 1
then you fix that, you dont hack at local cruft that bitrots
I had the same problem, also applicable to net-firewall/ebtables-2.0.6-r1 , i filed bug #188774 incl. hack-ish solution which I done successfuly for arptables too.
Jakub, I already posted a patch when I first filed this bug. Just seems that the maintainer isn't interested in making the e-build compile if using my short patch is required.
Richard, Jakub, sorry for delay. I'm just about to fix the issue. Current CVS version compiles fine and has solution very similar to what SpanKY suggested and this solution seem much better for me. Upstream is responsive, so I mailed them so may be they'll roll out new release, together with patches for build system I've sent them. So now I'm going to wait for their answer not longer for one week and either take CVS version or receive some information from upstream and then depends on answer. In any case this bug will resolved very soon.
And finally arptables-0.0.3.3 is in portage and it fixes this issue.