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