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=QZEimkQ5; 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 9FF0A5A004E for ; Wed, 27 Nov 2024 16:45:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732722307; 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=77RQ+TLOmzjVgSd2Rcv8GevwphWFJ2q5oMciARYsG5o=; b=QZEimkQ53v2hdkz8xOEtduRdx5/x6QoMvWI5mmdqrEVh/e/kdFni+Hcayuwb0vfHmWZXui wn+jYmXDWoTTToMlpqI0Ko0x+C8yh+rTgVNu8g7Ar1PyQOiy6bf72UG75JsC1xr6ZNh1/O WdNY8/dOV0nsnbO4nwu9xsQCCR+fCng= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-353-YeTeKorIM1eF-r12gW44jg-1; Wed, 27 Nov 2024 10:45:06 -0500 X-MC-Unique: YeTeKorIM1eF-r12gW44jg-1 X-Mimecast-MFC-AGG-ID: YeTeKorIM1eF-r12gW44jg Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-434996c1aa7so30716055e9.2 for ; Wed, 27 Nov 2024 07:45:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732722303; x=1733327103; 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=77RQ+TLOmzjVgSd2Rcv8GevwphWFJ2q5oMciARYsG5o=; b=IW2HcaRznTQjYPl45Idk/XzK4on2FpvSGnx2nMdV22Z4PZ9rLeENBIN+o8TJLRSDzo C/uvJB0Zl+Wx9Q/qSO5TzI6Q7lygoC9xicC96Jdov00IKv+yM9T4S19CMGzqbV2eN+F2 o60zZXjyQf8Jz/XZInn8xKtJLMhm10cuXAnACHgC26ppqHGSwFH/P+U0iuefIMYwUhTR Q0D2sqXcISlQf3QOaJJU0DSm3tvc308SX+PsC9RE4kDCwdX/I1G7YldkQ3wr9LaF4BcF fPxADVHTFbcHDrJN5tzYk0MlivsMbg/xAHcwawN1mWeO2tDQfh9nAf78u0kO0SkvWu4X fp+Q== X-Gm-Message-State: AOJu0YwEnjwFO7T//tP0k0H8OeP4UxJMUGatY1vpUg27gEv+8IuP+Xnt JlNCiSA+dQ/k2VCvOE17ZheujTiqVYV2cXtlI3UKU7Yy42gh8y1PnabPRfqo71mQpa4YJgEGJSZ EWZXIfJESVmMw6I4uOUYLb5pzfyOaJxNmbNHf+X7ZdbkTWRaR5mRgi7VeYa+aCfsOfOYJdIzOwt y2MQCPNyt1wNqa0dSDkQ8yDWPyyPRIvbN3 X-Gm-Gg: ASbGncuAE/P0j0VtgycoAs6tfAZFwagCuQMeWI9f0JaO0vqbXdgmwg9Q/CKDvrFjG40 qTR5U8B5/JJOy9Uv6NPFGBfV5rPysTxZ/s48Xgs8niUgSHAw1UbXXUO957t9RXYH13A6Vr0o1MX tm9R+x+oLRzkJrw1hz4YOys+PQ7AuiyRduvhErMu0HsdaqcAIZ3ytdl3/lfvabdqAH22SUL6LVh oKIUSRZwlp8TpyUJK6sBCk00/5VXpMpARHmNPUDB8iOOKFy0pQUz5KhTVrxz55Xy8lVPgl3r5fd W+g= X-Received: by 2002:a05:600c:1e06:b0:42c:b187:bde9 with SMTP id 5b1f17b1804b1-434a9e0bc3fmr34660735e9.30.1732722302744; Wed, 27 Nov 2024 07:45:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3K8GaegzaC84yP3BfrkyAutPHkQBW3rkg3w4tJ8itf5+AHbuWdXjspr7EOuLzD8Ldk/ZTOw== X-Received: by 2002:a05:600c:1e06:b0:42c:b187:bde9 with SMTP id 5b1f17b1804b1-434a9e0bc3fmr34660555e9.30.1732722302407; Wed, 27 Nov 2024 07:45:02 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa763a59sm24687115e9.11.2024.11.27.07.45.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 07:45:01 -0800 (PST) Date: Wed, 27 Nov 2024 16:45:00 +0100 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH] musl: fix conflict on ethhdr definition Message-ID: <20241127164500.76360427@elisabeth> In-Reply-To: <87dba7ff-861d-4d62-adc4-6414b89cdf34@redhat.com> References: <20241127144130.3637798-1-lvivier@redhat.com> <20241127154809.2a49f2f8@elisabeth> <20241127160511.4474dc39@elisabeth> <87dba7ff-861d-4d62-adc4-6414b89cdf34@redhat.com> 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: wHbqty-ttsgtU8A3VquzRfiFiVJsUaA80i9zFGnsmrk_1732722304 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: EA6CFUGOV54EKYPJ2OMQZYYZEYXUSCNN X-Message-ID-Hash: EA6CFUGOV54EKYPJ2OMQZYYZEYXUSCNN 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 16:37:05 +0100 Laurent Vivier wrote: > On 27/11/2024 16:05, Stefano Brivio wrote: > > 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? > > passt.h remains generic by not including linux specific headers. > > Something like that: > > diff --git a/tcp_vu.c b/tcp_vu.c > index 05e2d1d..943b6d9 100644 > --- a/tcp_vu.c > +++ b/tcp_vu.c > @@ -13,7 +13,7 @@ > #include > > #include > - > +#include > #include > > #include "util.h" > diff --git a/vu_common.c b/vu_common.c > index 0763ec0..299b5a3 100644 > --- a/vu_common.c > +++ b/vu_common.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > > #include "util.h" > Okay, that works as well, just tested on glibc and musl. I'll simply fold it in 7/9 so that we don't break bisection with musl. -- Stefano