From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BlKjnRQh; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id B59655A004E for ; Wed, 27 Nov 2024 16:05:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732719917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qIA3I03duCXm5/vYI5zUnUp7KCU2s4Vy02hEMekfCk8=; b=BlKjnRQho2xorI3zycFk6wh2S1eElu1KiLyYUDeoLYUPAXTRZkT5ckaxcGrFVsuhBECC1Q HVDJuZ9vRkU44mG+3jLvA6HdOQW7wHns92zy5DDGZOU2+R3I0QKDjOV7JnRjrzytedN06z q3Px/1yef2EXobFUDOXn9+V2PIrE4Iw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-389--2qld0uAPhSPgjVesnvkWA-1; Wed, 27 Nov 2024 10:05:16 -0500 X-MC-Unique: -2qld0uAPhSPgjVesnvkWA-1 X-Mimecast-MFC-AGG-ID: -2qld0uAPhSPgjVesnvkWA Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4349fd2965fso31797805e9.1 for ; Wed, 27 Nov 2024 07:05:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732719914; x=1733324714; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qIA3I03duCXm5/vYI5zUnUp7KCU2s4Vy02hEMekfCk8=; b=RVvdMqZxLp2Q5XmPZMBPD8HrJh+J2QK2+WZNsT1e5nfu5H5xvPZB7uP7KoTw/LJkma OgKIQ8N4itELAIT+prM/Rxb0CV85xC6Uuhh5n9872Xstgrph0L9KD2Mez2EeIqHxHSqz iR/TiIT3FGxIxpKFz2wuOSkI3+kvJ0/BezEz5H8UwG4s0AzDm+Lvt7i0ERfplKfUYvgY aOcnDCkjyR8HPyvx+mHwlbXL8mx+AI/8+Syhwrr+LOfZtja112/AWbXKG0x8Ouv2skEg A/NIl7gfj4k2KWepprK1hS0Pop9IwebLyukdYpPAbARTyMoZ0FSAa3ycOjnF/xcPt69q +mxA== X-Gm-Message-State: AOJu0YzvTc4FooZI1xQAI+Xb+Yf638sQDqMnGI+Ym+dPkjjisgoMUV6J 0Rxj/nPi4r0Zsiq4yZGGSwFpUX7ESNxAcLiyMFy6JVrBSqlwYlYGQ+ybbrBqLd2RhJSmwP2S4Zj ynRDP9jLsuNZAlzcisBBxxyL7KKZt58W529OS8eQjdqwZuGWyp83CIbBB3gyfAI0Wb3TWZS/9FS MwY5munv6ZqvI9jUbMc+9nOPcvanKkYwDB X-Gm-Gg: ASbGnctAeEOvt7e/jO3uUlGNdNJ4/qQIHifLLIHrVLGfhcV6KnxASUWTTIePSfWC/2J iUdeZeJWQOh1RUfijvg8XiEp9PlCa/GSFrIv2Qp3+FzfUyZA0oEPjkAb1GMr6KJwKdS8hyBiDgR q78bg+Yohfiec2X9B3fJxDhzWBnxY3UwjGsVDNGwi7QUGoxgGdlmPwcME0kYw46eCpYQ3r7mgS/ x/eRhcuwQp01VHfpxB/fNZT+Sbj32BYeBM/mcwpGRJcLkjEXACnEO6pw3CnmA== X-Received: by 2002:a05:6000:1865:b0:382:46ea:113f with SMTP id ffacd0b85a97d-385c6ccaeebmr2425811f8f.10.1732719913737; Wed, 27 Nov 2024 07:05:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7VWyFht+cjNr2Qe0gbfC7uqA/BDdJvHh5K6bVWTPRCqErDo1e6DmGq+Q1AwgJOOgpPw6c7w== X-Received: by 2002:a05:6000:1865:b0:382:46ea:113f with SMTP id ffacd0b85a97d-385c6ccaeebmr2425773f8f.10.1732719913246; Wed, 27 Nov 2024 07:05:13 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825fbed9a8sm16490540f8f.92.2024.11.27.07.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 07:05:12 -0800 (PST) Date: Wed, 27 Nov 2024 16:05:11 +0100 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH] musl: fix conflict on ethhdr definition Message-ID: <20241127160511.4474dc39@elisabeth> In-Reply-To: References: <20241127144130.3637798-1-lvivier@redhat.com> <20241127154809.2a49f2f8@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: FWGz9o9zaQgV42ymdTzvBwfO3z1diiNCnIFmMy8QYZQ_1732719915 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: EGBOZKAPXBKSPPUKJGUBGERTE77WWEVO X-Message-ID-Hash: EGBOZKAPXBKSPPUKJGUBGERTE77WWEVO X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed, 27 Nov 2024 15:55:00 +0100 Laurent Vivier wrote: > On 27/11/2024 15:48, Stefano Brivio wrote: > > On Wed, 27 Nov 2024 15:41:30 +0100 > > Laurent Vivier wrote: > > > >> 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 > >> --- > >> 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 > > > > Uh oh, I just solved this locally (I was about to push, but I stopped > > in time) by simply including instead of > > from passt.h. > > > > I'm not sure what's the best solution: mine is simpler, but I'm not > > really fond of including Linux-specific stuff if there's no need for > > it, so I'd slightly prefer yours. > > > > On the other hand, it's not just for musl. If somebody tries to build > > this against, say, uClibc-ng (no reports about that yet), they will > > probably run into trouble as well. > > In fact, in /usr/include/linux/if_ether.h they say: > > /* allow libcs like musl to deactivate this, glibc does not implement this. */ > > So I think musl should set the value and then I found: > > #define __UAPI_DEF_ETHHDR 0 > > in /usr/include/netinet/if_ether.h Ah, I hadn't checked that yet. > So I think the solution is to include netinet/if_ether.h before linux/if_ether.h Just in tcp_vu.c you mean? That's where we include now. Any advantage over simply including linux/if_ether.h in passt.h as I did? > > Or should we just unconditionally #define __UAPI_DEF_ETHHDR=0 just > > before including ? > > If you do that, I think it will not work anymore with glibc Right, discarded that option. -- Stefano