| Message ID | 20251014121513.2606389-1-Qi.Chen@windriver.com |
|---|---|
| State | New |
| Headers | show |
| Series | [1/2] musl: avoid redefinition error on ethhdr | expand |
Sorry for the inconvenience. But please don't merge these two patches. I just got a clear message from musl community that the second patch is not appropriate. https://www.openwall.com/lists/musl/2025/10/14/2 I'll re-work on musl and systemd upgrade and send out V2. Regards, Qi On 10/14/25 20:15, Chen Qi via lists.openembedded.org wrote: > From: Chen Qi <Qi.Chen@windriver.com> > > This __UAPI_DEF_ETHHDR macro should be defined right after > the definition of 'struct ethhdr', otherwise, we'll get > re-definition error in some case. This is because the > lines under 'struct ethhdr' definition are header file inclusion > lines and those header files might also check __UAPI_DEF_ETHHDR > and define ethhdr, resulting in redefinition error. > > Another problem is that if_ether.h in musl should also consider > the possibility that other header files included before it also > defines struct ethhdr and __UAPI_DEF_ETHHDR. > > Signed-off-by: Chen Qi <Qi.Chen@windriver.com> > --- > ...if_ether.h-define-__UAPI_DEF_ETHHDR-.patch | 39 +++++++++++++++++++ > ...if_ether.h-guard-ethhdr-definition-t.patch | 39 +++++++++++++++++++ > meta/recipes-core/musl/musl_git.bb | 2 + > 3 files changed, 80 insertions(+) > create mode 100644 meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch > create mode 100644 meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch > > diff --git a/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch > new file mode 100644 > index 0000000000..800273612d > --- /dev/null > +++ b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch > @@ -0,0 +1,39 @@ > +From 5ab64f7e08ea0325d83d446dd4015f82b4c179dd Mon Sep 17 00:00:00 2001 > +From: Chen Qi <Qi.Chen@windriver.com> > +Date: Mon, 29 Sep 2025 21:39:01 +0800 > +Subject: [PATCH] include/netinet/if_ether.h: define __UAPI_DEF_ETHHDR early > + > +After 'struct ethhdr' is defined, we should immediately define > +__UAPI_DEF_ETHHDR. Because the following lines are header inclusion > +lines which might introduce header files checking __UAPI_DEF_ETHHDR. > +If we don't define this macro early, we will get redefinition error. > + > +Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2025/09/30/1] > + > +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> > +--- > + include/netinet/if_ether.h | 3 +-- > + 1 file changed, 1 insertion(+), 2 deletions(-) > + > +diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h > +index 3479f511..b1646f6f 100644 > +--- a/include/netinet/if_ether.h > ++++ b/include/netinet/if_ether.h > +@@ -117,6 +117,7 @@ struct ethhdr { > + uint8_t h_source[ETH_ALEN]; > + uint16_t h_proto; > + }; > ++#define __UAPI_DEF_ETHHDR 0 > + > + #include <net/ethernet.h> > + #include <net/if_arp.h> > +@@ -144,6 +145,4 @@ do { \ > + (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \ > + } while(0) > + > +-#define __UAPI_DEF_ETHHDR 0 > +- > + #endif > +-- > +2.34.1 > + > diff --git a/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch > new file mode 100644 > index 0000000000..343b0976ed > --- /dev/null > +++ b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch > @@ -0,0 +1,39 @@ > +From 67976391887c3c65138a3b6fc306f2f5b490aeb4 Mon Sep 17 00:00:00 2001 > +From: Chen Qi <Qi.Chen@windriver.com> > +Date: Tue, 30 Sep 2025 10:42:51 +0800 > +Subject: [PATCH] include/netinet/if_ether.h: guard ethhdr definition to better > + work with other header files > + > +The unconditional definition of 'struct ethhdr' has the implicit > +requirement on this header file, that is, it needs to be included > +before other header files defining ethhdr. > + > +Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2025/09/30/2] > + > +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> > +--- > + include/netinet/if_ether.h | 2 ++ > + 1 file changed, 2 insertions(+) > + > +diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h > +index b1646f6f..e5a1ebd0 100644 > +--- a/include/netinet/if_ether.h > ++++ b/include/netinet/if_ether.h > +@@ -112,12 +112,14 @@ > + #define ETH_P_XDSA 0x00F8 > + #define ETH_P_MAP 0x00F9 > + > ++#ifndef __UAPI_DEF_ETHHDR > + struct ethhdr { > + uint8_t h_dest[ETH_ALEN]; > + uint8_t h_source[ETH_ALEN]; > + uint16_t h_proto; > + }; > + #define __UAPI_DEF_ETHHDR 0 > ++#endif > + > + #include <net/ethernet.h> > + #include <net/if_arp.h> > +-- > +2.34.1 > + > diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb > index 3f5fa37fba..ab4655b378 100644 > --- a/meta/recipes-core/musl/musl_git.bb > +++ b/meta/recipes-core/musl/musl_git.bb > @@ -14,6 +14,8 @@ SRC_URI = "git://git.musl-libc.org/musl;branch=master \ > file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \ > file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \ > file://0001-Update-syscalls-for-r32-rv64-from-kernel-6.4-through.patch \ > + file://0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch \ > + file://0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch \ > " > > PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt" > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#224817): https://lists.openembedded.org/g/openembedded-core/message/224817 > Mute This Topic: https://lists.openembedded.org/mt/115751322/7304865 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Qi.Chen@eng.windriver.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch new file mode 100644 index 0000000000..800273612d --- /dev/null +++ b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch @@ -0,0 +1,39 @@ +From 5ab64f7e08ea0325d83d446dd4015f82b4c179dd Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 29 Sep 2025 21:39:01 +0800 +Subject: [PATCH] include/netinet/if_ether.h: define __UAPI_DEF_ETHHDR early + +After 'struct ethhdr' is defined, we should immediately define +__UAPI_DEF_ETHHDR. Because the following lines are header inclusion +lines which might introduce header files checking __UAPI_DEF_ETHHDR. +If we don't define this macro early, we will get redefinition error. + +Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2025/09/30/1] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + include/netinet/if_ether.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h +index 3479f511..b1646f6f 100644 +--- a/include/netinet/if_ether.h ++++ b/include/netinet/if_ether.h +@@ -117,6 +117,7 @@ struct ethhdr { + uint8_t h_source[ETH_ALEN]; + uint16_t h_proto; + }; ++#define __UAPI_DEF_ETHHDR 0 + + #include <net/ethernet.h> + #include <net/if_arp.h> +@@ -144,6 +145,4 @@ do { \ + (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \ + } while(0) + +-#define __UAPI_DEF_ETHHDR 0 +- + #endif +-- +2.34.1 + diff --git a/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch new file mode 100644 index 0000000000..343b0976ed --- /dev/null +++ b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch @@ -0,0 +1,39 @@ +From 67976391887c3c65138a3b6fc306f2f5b490aeb4 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 30 Sep 2025 10:42:51 +0800 +Subject: [PATCH] include/netinet/if_ether.h: guard ethhdr definition to better + work with other header files + +The unconditional definition of 'struct ethhdr' has the implicit +requirement on this header file, that is, it needs to be included +before other header files defining ethhdr. + +Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2025/09/30/2] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + include/netinet/if_ether.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h +index b1646f6f..e5a1ebd0 100644 +--- a/include/netinet/if_ether.h ++++ b/include/netinet/if_ether.h +@@ -112,12 +112,14 @@ + #define ETH_P_XDSA 0x00F8 + #define ETH_P_MAP 0x00F9 + ++#ifndef __UAPI_DEF_ETHHDR + struct ethhdr { + uint8_t h_dest[ETH_ALEN]; + uint8_t h_source[ETH_ALEN]; + uint16_t h_proto; + }; + #define __UAPI_DEF_ETHHDR 0 ++#endif + + #include <net/ethernet.h> + #include <net/if_arp.h> +-- +2.34.1 + diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb index 3f5fa37fba..ab4655b378 100644 --- a/meta/recipes-core/musl/musl_git.bb +++ b/meta/recipes-core/musl/musl_git.bb @@ -14,6 +14,8 @@ SRC_URI = "git://git.musl-libc.org/musl;branch=master \ file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \ file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \ file://0001-Update-syscalls-for-r32-rv64-from-kernel-6.4-through.patch \ + file://0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch \ + file://0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch \ " PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt"