All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nftables] include: fix for musl with iptables v1.8.11
@ 2024-12-19 23:10 Alyssa Ross
  2024-12-20 11:50 ` Phil Sutter
  0 siblings, 1 reply; 13+ messages in thread
From: Alyssa Ross @ 2024-12-19 23:10 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Phil Sutter, Joshua Lant

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.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
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.

 include/linux/netfilter_bridge.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 6187a558..78ec2cde 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -4,8 +4,9 @@
 /* bridge-specific defines for netfilter. 
  */
 
+#include <netinet/if_ether.h>
+
 #include <linux/netfilter.h>
-#include <linux/if_ether.h>
 #include <linux/if_vlan.h>
 #include <linux/if_pppox.h>
 

base-commit: 3271d78e70ec75246e8a61a6791fe22b8d89c2c1
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-02-11 20:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-19 23:10 [PATCH nftables] include: fix for musl with iptables v1.8.11 Alyssa Ross
2024-12-20 11:50 ` Phil Sutter
2024-12-20 12:07   ` Alyssa Ross
2024-12-20 12:33     ` Phil Sutter
2024-12-21 15:34       ` Alyssa Ross
2025-01-08 23:34       ` Pablo Neira Ayuso
2025-01-08 23:49         ` Phil Sutter
2025-01-09  0:03           ` Pablo Neira Ayuso
2025-01-09 10:02             ` Phil Sutter
2026-02-11 13:49               ` Florian Westphal
2026-02-11 18:59                 ` Phil Sutter
2026-02-11 19:09                   ` Florian Westphal
2026-02-11 20:19                     ` Phil Sutter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.