b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | From 6a77abab92516e65f07f8657fc4e384c4541ce0e Mon Sep 17 00:00:00 2001 |
| 2 | From: Dario Binacchi <dario.binacchi@amarulasolutions.com> |
| 3 | Date: Sun, 22 Sep 2024 16:50:10 +0200 |
| 4 | Subject: bridge: mst: fix a musl build issue |
| 5 | |
| 6 | This patch fixes a compilation error raised by the bump to version 6.11.0 |
| 7 | in Buildroot using musl as the C library for the cross-compilation |
| 8 | toolchain. |
| 9 | |
| 10 | After setting the CFLGAS |
| 11 | |
| 12 | ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) |
| 13 | IPROUTE2_CFLAGS += -D__UAPI_DEF_IN6_ADDR=0 -D__UAPI_DEF_SOCKADDR_IN6=0 \ |
| 14 | -D__UAPI_DEF_IPV6_MREQ=0 |
| 15 | endif |
| 16 | |
| 17 | to fix the following errors: |
| 18 | |
| 19 | In file included from ../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/arpa/inet.h:9, |
| 20 | from ../include/libnetlink.h:14, |
| 21 | from mst.c:10: |
| 22 | ../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:23:8: error: redefinition of 'struct in6_addr' |
| 23 | 23 | struct in6_addr { |
| 24 | | ^~~~~~~~ |
| 25 | In file included from ../include/uapi/linux/if_bridge.h:19, |
| 26 | from mst.c:7: |
| 27 | ../include/uapi/linux/in6.h:33:8: note: originally defined here |
| 28 | 33 | struct in6_addr { |
| 29 | | ^~~~~~~~ |
| 30 | ../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:34:8: error: redefinition of 'struct sockaddr_in6' |
| 31 | 34 | struct sockaddr_in6 { |
| 32 | | ^~~~~~~~~~~~ |
| 33 | ../include/uapi/linux/in6.h:50:8: note: originally defined here |
| 34 | 50 | struct sockaddr_in6 { |
| 35 | | ^~~~~~~~~~~~ |
| 36 | ../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:42:8: error: redefinition of 'struct ipv6_mreq' |
| 37 | 42 | struct ipv6_mreq { |
| 38 | | ^~~~~~~~~ |
| 39 | ../include/uapi/linux/in6.h:60:8: note: originally defined here |
| 40 | 60 | struct ipv6_mreq { |
| 41 | |
| 42 | I got this further errors |
| 43 | |
| 44 | ../include/uapi/linux/in6.h:72:25: error: field 'flr_dst' has incomplete type |
| 45 | 72 | struct in6_addr flr_dst; |
| 46 | | ^~~~~~~ |
| 47 | ../include/uapi/linux/if_bridge.h:711:41: error: field 'ip6' has incomplete type |
| 48 | 711 | struct in6_addr ip6; |
| 49 | | ^~~ |
| 50 | |
| 51 | fixed by including the netinet/in.h header. |
| 52 | |
| 53 | Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> |
| 54 | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> |
| 55 | --- |
| 56 | bridge/mst.c | 1 + |
| 57 | 1 file changed, 1 insertion(+) |
| 58 | |
| 59 | --- a/bridge/mst.c |
| 60 | +++ b/bridge/mst.c |
| 61 | @@ -4,6 +4,7 @@ |
| 62 | */ |
| 63 | |
| 64 | #include <stdio.h> |
| 65 | +#include <netinet/in.h> |
| 66 | #include <linux/if_bridge.h> |
| 67 | #include <net/if.h> |
| 68 | |