xref: /OK3568_Linux_fs/buildroot/package/iperf/0001-Fix-build-with-musl-libc.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunFrom 6766ab322a9eb8c73f8276be9cdea356eb124de0 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Baruch Siach <baruch@tkos.co.il>
3*4882a593SmuzhiyunDate: Thu, 11 Nov 2021 07:58:10 +0200
4*4882a593SmuzhiyunSubject: [PATCH] Fix build with musl libc
5*4882a593SmuzhiyunMIME-Version: 1.0
6*4882a593SmuzhiyunContent-Type: text/plain; charset=UTF-8
7*4882a593SmuzhiyunContent-Transfer-Encoding: 8bit
8*4882a593Smuzhiyun
9*4882a593Smuzhiyunmusl libc defines its own struct ethhdr that conflicts with the kernel
10*4882a593Smuzhiyundefine one. The kernel headers provide a way to suppress its struct
11*4882a593Smuzhiyunethhdr. For that to work the libc headers must precede the kernel. Move
12*4882a593Smuzhiyunthe kernel linux/if_tun.h include below libc net/ethernet.h. That fixes
13*4882a593Smuzhiyunthe following build failure:
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunIn file included from .../arm-buildroot-linux-musleabihf/sysroot/usr/include/net/ethernet.h:10,
16*4882a593Smuzhiyun                 from ../include/headers.h:117,
17*4882a593Smuzhiyun                 from Thread.c:72:
18*4882a593Smuzhiyun.../arm-buildroot-linux-musleabihf/sysroot/usr/include/netinet/if_ether.h:116:8: error: redefinition of ‘struct ethhdr’
19*4882a593Smuzhiyun  116 | struct ethhdr {
20*4882a593Smuzhiyun      |        ^~~~~~
21*4882a593SmuzhiyunIn file included from .../arm-buildroot-linux-musleabihf/sysroot/usr/include/linux/if_tun.h:20,
22*4882a593Smuzhiyun                 from ../include/headers.h:110,
23*4882a593Smuzhiyun                 from Thread.c:72:
24*4882a593Smuzhiyun.../arm-buildroot-linux-musleabihf/sysroot/usr/include/linux/if_ether.h:148:8: note: originally defined here
25*4882a593Smuzhiyun  148 | struct ethhdr {
26*4882a593Smuzhiyun      |        ^~~~~~
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunFixes bug #157.
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunSigned-off-by: Baruch Siach <baruch@tkos.co.il>
31*4882a593Smuzhiyun---
32*4882a593SmuzhiyunUpstream status: sent to Robert McMahon <rjmcmahon@rjmcmahon.com>
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun include/headers.h | 10 +++++-----
35*4882a593Smuzhiyun 1 file changed, 5 insertions(+), 5 deletions(-)
36*4882a593Smuzhiyun
37*4882a593Smuzhiyundiff --git a/include/headers.h b/include/headers.h
38*4882a593Smuzhiyunindex 00e0ea0dba42..887490475381 100644
39*4882a593Smuzhiyun--- a/include/headers.h
40*4882a593Smuzhiyun+++ b/include/headers.h
41*4882a593Smuzhiyun@@ -106,11 +106,6 @@ typedef bool _Bool;
42*4882a593Smuzhiyun #include <net/if.h>
43*4882a593Smuzhiyun #endif
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun-#if ((HAVE_TUNTAP_TAP) || (HAVE_TUNTAP_TUN))
46*4882a593Smuzhiyun-#include <linux/if_tun.h>
47*4882a593Smuzhiyun-#include <sys/ioctl.h>
48*4882a593Smuzhiyun-#endif
49*4882a593Smuzhiyun-
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun // AF_PACKET HEADERS
52*4882a593Smuzhiyun #if defined(HAVE_LINUX_FILTER_H) && defined(HAVE_AF_PACKET)
53*4882a593Smuzhiyun@@ -146,6 +141,11 @@ typedef bool _Bool;
54*4882a593Smuzhiyun #define  IPV6HDRLEN 40
55*4882a593Smuzhiyun #endif // HAVE_AF_PACKET
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun+#if ((HAVE_TUNTAP_TAP) || (HAVE_TUNTAP_TUN))
58*4882a593Smuzhiyun+#include <linux/if_tun.h>
59*4882a593Smuzhiyun+#include <sys/ioctl.h>
60*4882a593Smuzhiyun+#endif
61*4882a593Smuzhiyun+
62*4882a593Smuzhiyun #ifdef WIN32
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun /* Windows config file */
65*4882a593Smuzhiyun--
66*4882a593Smuzhiyun2.33.0
67*4882a593Smuzhiyun
68