libs/libnl: Update to 3.3.0
[openwrt/staging/stintel.git] / package / libs / libnl / patches / 101-add-musl-workaround-to-the-libc-compat.h-copy.patch
1 diff -Naur libnl-3.3.0_rc1.orig/include/linux-private/linux/if_ether.h libnl-3.3.0_rc1/include/linux-private/linux/if_ether.h
2 --- /include/linux-private/linux/if_ether.h 2017-03-08 19:56:31.824516933 -0800
3 +++ /include/linux-private/linux/if_ether.h 2017-03-08 20:07:01.938237767 -0800
4 @@ -22,6 +22,7 @@
5 #define _LINUX_IF_ETHER_H
6
7 #include <linux/types.h>
8 +#include <linux/libc-compat.h>
9
10 /*
11 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
12 @@ -117,10 +118,12 @@
13 * This is an Ethernet frame header.
14 */
15
16 +#if __UAPI_DEF_ETHHDR
17 struct ethhdr {
18 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
19 unsigned char h_source[ETH_ALEN]; /* source ether addr */
20 __be16 h_proto; /* packet type ID field */
21 } __attribute__((packed));
22 +#endif
23
24 #endif /* _LINUX_IF_ETHER_H */
25 diff -Naur libnl-3.3.0_rc1.orig/include/linux-private/linux/libc-compat.h libnl-3.3.0_rc1/include/linux-private/linux/libc-compat.h
26 --- /include/linux-private/linux/libc-compat.h 2017-03-08 19:56:31.823516923 -0800
27 +++ /include/linux-private/linux/libc-compat.h 2017-03-08 20:12:30.376843489 -0800
28 @@ -48,10 +48,18 @@
29 #ifndef _LIBC_COMPAT_H
30 #define _LIBC_COMPAT_H
31
32 -/* We have included glibc headers... */
33 -#if defined(__GLIBC__)
34 +/* We're used from userspace... */
35 +#if !defined(__KERNEL__)
36
37 -/* Coordinate with glibc netinet/in.h header. */
38 +/* Coordinate with libc netinet/if_ether.h */
39 +#ifdef _NETINET_IF_ETHER_H /* musl */
40 +#define __UAPI_DEF_ETHHDR 0
41 +#else
42 +/* glibc uses __NETINET_IF_ETHER_H, and uses the uapi header. */
43 +#define __UAPI_DEF_ETHHDR 1
44 +#endif
45 +
46 +/* Coordinate with libc netinet/in.h header. */
47 #if defined(_NETINET_IN_H)
48
49 /* GLIBC headers included first so don't define anything
50 @@ -64,15 +72,7 @@
51 #define __UAPI_DEF_IN_CLASS 0
52
53 #define __UAPI_DEF_IN6_ADDR 0
54 -/* The exception is the in6_addr macros which must be defined
55 - * if the glibc code didn't define them. This guard matches
56 - * the guard in glibc/inet/netinet/in.h which defines the
57 - * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
58 -#if defined(__USE_MISC) || defined (__USE_GNU)
59 #define __UAPI_DEF_IN6_ADDR_ALT 0
60 -#else
61 -#define __UAPI_DEF_IN6_ADDR_ALT 1
62 -#endif
63 #define __UAPI_DEF_SOCKADDR_IN6 0
64 #define __UAPI_DEF_IPV6_MREQ 0
65 #define __UAPI_DEF_IPPROTO_V6 0
66 @@ -83,7 +83,7 @@
67 #else
68
69 /* Linux headers included first, and we must define everything
70 - * we need. The expectation is that glibc will check the
71 + * we need. The expectation is that libc will check the
72 * __UAPI_DEF_* defines and adjust appropriately. */
73 #define __UAPI_DEF_IN_ADDR 1
74 #define __UAPI_DEF_IN_IPPROTO 1
75 @@ -93,7 +93,7 @@
76 #define __UAPI_DEF_IN_CLASS 1
77
78 #define __UAPI_DEF_IN6_ADDR 1
79 -/* We unconditionally define the in6_addr macros and glibc must
80 +/* We unconditionally define the in6_addr macros and libc must
81 * coordinate. */
82 #define __UAPI_DEF_IN6_ADDR_ALT 1
83 #define __UAPI_DEF_SOCKADDR_IN6 1
84 @@ -115,7 +115,10 @@
85 /* If we did not see any headers from any supported C libraries,
86 * or we are being included in the kernel, then define everything
87 * that we need. */
88 -#else /* !defined(__GLIBC__) */
89 +#else /* defined(__KERNEL__) */
90 +
91 +/* Definitions for if/ether.h */
92 +#define __UAPI_DEF_ETHHDR 1
93
94 /* Definitions for in.h */
95 #define __UAPI_DEF_IN_ADDR 1
96 @@ -138,6 +141,6 @@
97 /* Definitions for xattr.h */
98 #define __UAPI_DEF_XATTR 1
99
100 -#endif /* __GLIBC__ */
101 +#endif /* defined(__KERNEL__) */
102
103 #endif /* _LIBC_COMPAT_H */