Hi Alyssa, On Fri, Dec 20, 2024 at 12:10:02AM +0100, Alyssa Ross wrote: > Since iptables commit 810f8568 (libxtables: xtoptions: Implement > XTTYPE_ETHERMACMASK), nftables failed to build for musl libc: > > In file included from /nix/store/bvffdqfhyxvx66bqlqqdmjmkyklkafv6-musl-1.2.5-dev/include/netinet/et… > from /nix/store/kz6fymqpgbrj6330s6wv4idcf9pwsqs4-iptables-1.8.10-de… > from src/xt.c:30: > /nix/store/bvffdqfhyxvx66bqlqqdmjmkyklkafv6-musl-1.2.5-dev/include/netinet/if_ether.h:115:8: error: redefinition of 'struct ethhdr' > 115 | struct ethhdr { > | ^~~~~~ > In file included from ./include/linux/netfilter_bridge.h:8, > from ./include/linux/netfilter_bridge/ebtables.h:1, > from src/xt.c:27: > /nix/store/bvffdqfhyxvx66bqlqqdmjmkyklkafv6-musl-1.2.5-dev/include/linux/if_ether.h:173:8: note: originally defined here > 173 | struct ethhdr { > | ^~~~~~ > > The fix is to use libc's version of if_ether.h before any kernel > headers, which takes care of conflicts with the kernel's struct ethhdr > definition by defining __UAPI_DEF_ETHHDR, which will tell the kernel's > header not to define its own version. What I don't like about this is how musl tries to force projects to not include linux/if_ether.h directly. From the project's view, this is a workaround not a fix. > Signed-off-by: Alyssa Ross <hi@xxxxxxxxx> > --- > A similar fix would solve the problem properly in iptables, which was > worked around with 76fce228 ("configure: Determine if musl is used for build"). > The __UAPI_DEF_ETHHDR is supposed to be set by netinet/if_ether.h, > rather than manually by users. Why does 76fce228 not work for you? Cheers, Phil