[PATCH iptables 1/2] xtables: fix compilation with musl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Only include <linux/if_ether.h> if glibc is used.

Fixes errors in the form of:
In file included from /home/nick/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-11.2.0_musl/include/netinet/ether.h:8,
                 from xtables.c:2238:
/home/nick/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-11.2.0_musl/include/netinet/if_ether.h:115:8: error: redefinition of 'struct ethhdr'
  115 | struct ethhdr {
      |        ^~~~~~
In file included from xtables.c:48:
/home/nick/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-5.15.38/user_headers/include/linux/if_ether.h:168:8: note: originally defined here
  168 | struct ethhdr {
      |        ^~~~~~
make[5]: *** [Makefile:471: libxtables_la-xtables.lo] Error 1

Signed-off-by: Nick Hainke <vincent@xxxxxxxxxxxx>
---
 libxtables/xtables.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libxtables/xtables.c b/libxtables/xtables.c
index 96fd783a..1eb22209 100644
--- a/libxtables/xtables.c
+++ b/libxtables/xtables.c
@@ -45,7 +45,9 @@
 
 #include <xtables.h>
 #include <limits.h> /* INT_MAX in ip_tables.h/ip6_tables.h */
+#if defined(__GLIBC__)
 #include <linux/if_ether.h> /* ETH_ALEN */
+#endif
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include <linux/netfilter_ipv6/ip6_tables.h>
 #include <libiptc/libxtc.h>
-- 
2.36.1




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux