iproute2: update to 5.1.0
[openwrt/openwrt.git] / package / network / utils / iproute2 / patches / 001-devlink-fix-libc-and-kernel-headers-collision.patch
1 From d0272f5404773a60cbc17c2277affdbbf8d99c67 Mon Sep 17 00:00:00 2001
2 From: Baruch Siach <baruch@tkos.co.il>
3 Date: Thu, 27 Jun 2019 21:37:19 +0300
4 Subject: devlink: fix libc and kernel headers collision
5
6 Since commit 2f1242efe9d ("devlink: Add devlink health show command") we
7 use the sys/sysinfo.h header for the sysinfo(2) system call. But since
8 iproute2 carries a local version of the kernel struct sysinfo, this
9 causes a collision with libc that do not rely on kernel defined sysinfo
10 like musl libc:
11
12 In file included from devlink.c:25:0:
13 .../sysroot/usr/include/sys/sysinfo.h:10:8: error: redefinition of 'struct sysinfo'
14 struct sysinfo {
15 ^~~~~~~
16 In file included from ../include/uapi/linux/kernel.h:5:0,
17 from ../include/uapi/linux/netlink.h:5,
18 from ../include/uapi/linux/genetlink.h:6,
19 from devlink.c:21:
20 ../include/uapi/linux/sysinfo.h:8:8: note: originally defined here
21 struct sysinfo {
22 ^~~~~~~
23
24 Move the sys/sysinfo.h userspace header before kernel headers, and
25 suppress the indirect include of linux/sysinfo.h.
26
27 Cc: Aya Levin <ayal@mellanox.com>
28 Cc: Moshe Shemesh <moshe@mellanox.com>
29 Signed-off-by: Baruch Siach <baruch@tkos.co.il>
30 Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
31 ---
32 devlink/devlink.c | 3 ++-
33 1 file changed, 2 insertions(+), 1 deletion(-)
34
35 diff --git a/devlink/devlink.c b/devlink/devlink.c
36 index 97b9373..5618ba2 100644
37 --- a/devlink/devlink.c
38 +++ b/devlink/devlink.c
39 @@ -18,11 +18,12 @@
40 #include <limits.h>
41 #include <errno.h>
42 #include <inttypes.h>
43 +#include <sys/sysinfo.h>
44 +#define _LINUX_SYSINFO_H /* avoid collision with musl header */
45 #include <linux/genetlink.h>
46 #include <linux/devlink.h>
47 #include <libmnl/libmnl.h>
48 #include <netinet/ether.h>
49 -#include <sys/sysinfo.h>
50 #include <sys/queue.h>
51
52 #include "SNAPSHOT.h"