Error compiling with musl-libc: The commit hash 810f8568f44f5863c2350a39f4f5c8d60f762958 introduces the netinet/ether.h header into xtables.h, which causes an error due to the redefinition of the ethhdr struct, defined in linux/if_ether.h and netinet/ether.h. This is is a known issue with musl-libc, with kernel headers providing guards against this happening when glibc is used: https://wiki.musl-libc.org/faq (Q: Why am I getting “error: redefinition of struct ethhdr/tcphdr/etc”?) The only value used from netinet/ether.h is ETH_ALEN, which is already set manually in libxtables/xtables.c. Move this definition to the header and eliminate the inclusion of netinet/if_ether.h. Signed-off-by: Joshua Lant joshualant@xxxxxxxxx --- include/xtables.h | 5 ++++- libxtables/xtables.c | 4 ---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/xtables.h b/include/xtables.h index ab856ebc..e80d0a8e 100644 --- a/include/xtables.h +++ b/include/xtables.h @@ -12,13 +12,16 @@ #include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include <netinet/ether.h> #include <netinet/in.h> #include <net/if.h> #include <linux/types.h> #include <linux/netfilter.h> #include <linux/netfilter/x_tables.h> +#ifndef ETH_ALEN +#define ETH_ALEN 6 +#endif + #ifndef IPPROTO_SCTP #define IPPROTO_SCTP 132 #endif diff --git a/libxtables/xtables.c b/libxtables/xtables.c index 7b370d48..b3219751 100644 --- a/libxtables/xtables.c +++ b/libxtables/xtables.c @@ -71,10 +71,6 @@ #define PROC_SYS_MODPROBE "/proc/sys/kernel/modprobe" #endif -#ifndef ETH_ALEN -#define ETH_ALEN 6 -#endif - /* we need this for ip6?tables-restore. ip6?tables-restore.c sets line to the * current line of the input file, in order to give a more precise error * message. ip6?tables itself doesn't need this, so it is initialized to the -- 2.25.1