All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Hainke <vincent@systemli.org>
To: netfilter-devel@vger.kernel.org
Cc: Nick Hainke <vincent@systemli.org>
Subject: [PATCH iptables 1/2] xtables: fix compilation with musl
Date: Sat, 14 May 2022 18:33:24 +0200	[thread overview]
Message-ID: <20220514163325.54266-1-vincent@systemli.org> (raw)

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@systemli.org>
---
 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


             reply	other threads:[~2022-05-14 16:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-14 16:33 Nick Hainke [this message]
2022-05-14 16:33 ` [PATCH iptables 2/2] xshared: fix compilation with musl Nick Hainke
2022-05-14 17:09   ` Phil Sutter
2022-05-16  6:47     ` [PATCH] treewide: use uint* instead of u_int* vincent
2022-05-16 10:28       ` Jan Engelhardt
2022-05-16 16:16         ` vincent
2022-05-17  8:10           ` Phil Sutter
2022-05-17  8:14             ` Jan Engelhardt
2022-05-18 13:21               ` Phil Sutter
2022-05-31 21:32                 ` Nick
2022-05-14 17:04 ` [PATCH iptables 1/2] xtables: fix compilation with musl Phil Sutter
2022-05-14 19:14   ` Maciej Żenczykowski
2022-05-15 12:05     ` Phil Sutter
2022-05-15 13:40       ` Maciej Żenczykowski
2022-05-17  8:17         ` Phil Sutter
2022-05-17  8:22           ` Maciej Żenczykowski
2022-05-15 14:09       ` Florian Westphal
2022-05-15 14:13         ` Maciej Żenczykowski
2022-05-17  8:14           ` Phil Sutter
2022-05-16  6:52       ` Nick
2022-05-16  7:12         ` Maciej Żenczykowski
2022-05-16 16:24           ` [PATCH] " vincent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220514163325.54266-1-vincent@systemli.org \
    --to=vincent@systemli.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.