[LEDE-DEV] [PATCH RFC firewall3] musl-compat: avoid kernel header conflicts

Jo-Philipp Wich jo at mein.io
Sun Nov 6 08:52:44 PST 2016


Hi Ralph,

unfortunately this breaks building on a glibc system for me:

-- 8< --
 $ make
[  7%] Building C object CMakeFiles/firewall3.dir/iptables.c.o
In file included from /usr/include/linux/netfilter_ipv4.h:8:0,
                 from /usr/include/linux/netfilter_ipv4/ip_tables.h:21,
                 from /usr/include/libiptc/libiptc.h:12,
                 from /home/jow/devel/firewall3.git/iptables.h:29,
                 from /home/jow/devel/firewall3.git/iptables.c:19:
/usr/include/linux/netfilter.h:75:18: error: field ‘in6’ has incomplete type
  struct in6_addr in6;
                  ^~~
In file included from /usr/include/libiptc/libip6tc.h:12:0,
                 from /home/jow/devel/firewall3.git/iptables.h:30,
                 from /home/jow/devel/firewall3.git/iptables.c:19:
/usr/include/linux/netfilter_ipv6/ip6_tables.h:63:18: error: field ‘src’
has incomplete type
  struct in6_addr src, dst;
                  ^~~
/usr/include/linux/netfilter_ipv6/ip6_tables.h:63:23: error: field ‘dst’
has incomplete type
  struct in6_addr src, dst;
                       ^~~
/usr/include/linux/netfilter_ipv6/ip6_tables.h:65:18: error: field
‘smsk’ has incomplete type
  struct in6_addr smsk, dmsk;
                  ^~~~
/usr/include/linux/netfilter_ipv6/ip6_tables.h:65:24: error: field
‘dmsk’ has incomplete type
  struct in6_addr smsk, dmsk;
                        ^~~~
In file included from /home/jow/devel/firewall3.git/iptables.h:38:0,
                 from /home/jow/devel/firewall3.git/iptables.c:19:
/home/jow/devel/firewall3.git/options.h:182:19: error: field ‘v6’ has
incomplete type
   struct in6_addr v6;
                   ^~
/home/jow/devel/firewall3.git/options.h:187:19: error: field ‘v6’ has
incomplete type
   struct in6_addr v6;
                   ^~
/home/jow/devel/firewall3.git/iptables.c: In function ‘rule_print6’:
/home/jow/devel/firewall3.git/iptables.c:1131:48: error: invalid
application of ‘sizeof’ to incomplete type ‘struct in6_addr’
  if (memcmp(&e->ipv6.src, &in6addr_any, sizeof(struct in6_addr)))
                                                ^~~~~~
/home/jow/devel/firewall3.git/iptables.c:1141:48: error: invalid
application of ‘sizeof’ to incomplete type ‘struct in6_addr’
  if (memcmp(&e->ipv6.dst, &in6addr_any, sizeof(struct in6_addr)))
                                                ^~~~~~
CMakeFiles/firewall3.dir/build.make:350: recipe for target
'CMakeFiles/firewall3.dir/iptables.c.o' failed
make[2]: *** [CMakeFiles/firewall3.dir/iptables.c.o] Error 1
CMakeFiles/Makefile2:67: recipe for target
'CMakeFiles/firewall3.dir/all' failed
make[1]: *** [CMakeFiles/firewall3.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
-- >8 --

It seems that glibc stops declaring "struct in6_addr" itself as soon as
one of "_UAPI_LINUX_IN6_H", "_UAPI_IPV6_H", "_LINUX_IN6_H" or "_IPV6_H"
is defined and the kernel obviously does not define that struct either
if its own guard is defined.

Will see if I find another solution...

~ Jo



More information about the Lede-dev mailing list