public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: passt-dev@passt.top
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: [PATCH] musl: fix conflict on ethhdr definition
Date: Wed, 27 Nov 2024 15:41:30 +0100	[thread overview]
Message-ID: <20241127144130.3637798-1-lvivier@redhat.com> (raw)

there is a conflict between netinet/if_ether.h provided by musl and
linux/if_ether.h provided by the linux headers:

  In file included from passt.h:185,
                   from tcp_vu.c:21:
  /usr/include/netinet/if_ether.h:115:8: error: redefinition of 'struct ethhdr'
    115 | struct ethhdr {
        |        ^~~~~~
  In file included from /usr/include/linux/virtio_net.h:32,
                   from tcp_vu.c:17:
  /usr/include/linux/if_ether.h:173:8: note: originally defined here
    173 | struct ethhdr {
        |        ^~~~~~

The kernel headers provide a flag to disable the definition in this case,
__UAPI_DEF_ETHHDR (see /usr/include/linux/if_ether.h comment).

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index cb7448079de5..2aa56ada65fd 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,9 @@ FLAGS +=  $(FORTIFY_FLAG) -O2 -pie -fPIE
 FLAGS += -DPAGE_SIZE=$(shell getconf PAGE_SIZE)
 FLAGS += -DVERSION=\"$(VERSION)\"
 FLAGS += -DDUAL_STACK_SOCKETS=$(DUAL_STACK_SOCKETS)
+ifeq (musl, $(word 4,$(subst -, ,$(TARGET))))
+FLAGS += -D__UAPI_DEF_ETHHDR=0
+endif
 
 PASST_SRCS = arch.c arp.c checksum.c conf.c dhcp.c dhcpv6.c flow.c fwd.c \
 	icmp.c igmp.c inany.c iov.c ip.c isolation.c lineread.c log.c mld.c \
-- 
@@ -33,6 +33,9 @@ FLAGS +=  $(FORTIFY_FLAG) -O2 -pie -fPIE
 FLAGS += -DPAGE_SIZE=$(shell getconf PAGE_SIZE)
 FLAGS += -DVERSION=\"$(VERSION)\"
 FLAGS += -DDUAL_STACK_SOCKETS=$(DUAL_STACK_SOCKETS)
+ifeq (musl, $(word 4,$(subst -, ,$(TARGET))))
+FLAGS += -D__UAPI_DEF_ETHHDR=0
+endif
 
 PASST_SRCS = arch.c arp.c checksum.c conf.c dhcp.c dhcpv6.c flow.c fwd.c \
 	icmp.c igmp.c inany.c iov.c ip.c isolation.c lineread.c log.c mld.c \
-- 
2.47.0


             reply	other threads:[~2024-11-27 14:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27 14:41 Laurent Vivier [this message]
2024-11-27 14:48 ` [PATCH] musl: fix conflict on ethhdr definition Stefano Brivio
2024-11-27 14:55   ` Laurent Vivier
2024-11-27 15:05     ` Stefano Brivio
2024-11-27 15:37       ` Laurent Vivier
2024-11-27 15:45         ` Stefano Brivio

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=20241127144130.3637798-1-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).