stages/*: change license to Apache 2.0
[dragora.git] / patches / iproute2 / musl-fixes.patch
blob62c176e2ddbb2f12d8443bc4800191a8634fb51e
1 --- include/uapi/linux/if_ether.h 2017-07-06 11:09:53.305214044 -0700
2 +++ include/uapi/linux/if_ether.h 2017-07-06 16:30:06.651369931 -0700
3 @@ -22,6 +22,7 @@
4 #define _LINUX_IF_ETHER_H
6 #include <linux/types.h>
7 +#include <linux/libc-compat.h>
9 /*
10 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
11 @@ -142,11 +143,13 @@
12 * This is an Ethernet frame header.
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
24 #endif /* _LINUX_IF_ETHER_H */
25 --- include/uapi/linux/if_tunnel.h 2017-07-06 11:09:53.305214044 -0700
26 +++ include/uapi/linux/if_tunnel.h 2017-07-06 16:32:23.814172660 -0700
27 @@ -2,7 +2,6 @@
28 #define _IF_TUNNEL_H_
30 #include <linux/types.h>
31 -#include <linux/if.h>
32 #include <linux/ip.h>
33 #include <linux/in6.h>
34 #include <asm/byteorder.h>
35 --- include/uapi/linux/ip6_tunnel.h 2017-07-06 11:09:53.303214021 -0700
36 +++ include/uapi/linux/ip6_tunnel.h 2017-07-06 16:33:41.630158864 -0700
37 @@ -2,7 +2,6 @@
38 #define _IP6_TUNNEL_H
40 #include <linux/types.h>
41 -#include <linux/if.h> /* For IFNAMSIZ. */
42 #include <linux/in6.h> /* For struct in6_addr. */
44 #define IPV6_TLV_TNL_ENCAP_LIMIT 4
45 --- include/uapi/linux/kernel.h 2017-07-06 11:09:53.303214021 -0700
46 +++ include/uapi/linux/kernel.h 2017-07-06 16:30:06.650369918 -0700
47 @@ -1,7 +1,9 @@
48 #ifndef _LINUX_KERNEL_H
49 #define _LINUX_KERNEL_H
51 +#ifdef __GLIBC__
52 #include <linux/sysinfo.h>
53 +#endif
56 * 'kernel.h' contains some often-used function prototypes etc
57 --- include/uapi/linux/libc-compat.h 2017-07-06 11:09:53.302214010 -0700
58 +++ include/uapi/linux/libc-compat.h 2017-07-06 16:30:06.650369918 -0700
59 @@ -48,47 +48,57 @@
60 #ifndef _LIBC_COMPAT_H
61 #define _LIBC_COMPAT_H
63 -/* We have included glibc headers... */
64 -#if defined(__GLIBC__)
65 +/* We're used from userspace... */
66 +#if !defined(__KERNEL__)
68 -/* Coordinate with glibc net/if.h header. */
69 +/* Coordinate with libc net/if.h header. */
70 #if defined(_NET_IF_H) && defined(__USE_MISC)
72 -/* GLIBC headers included first so don't define anything
73 +/* libc headers included first so don't define anything
74 * that would already be defined. */
76 #define __UAPI_DEF_IF_IFCONF 0
77 #define __UAPI_DEF_IF_IFMAP 0
78 #define __UAPI_DEF_IF_IFNAMSIZ 0
79 #define __UAPI_DEF_IF_IFREQ 0
80 -/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
81 #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
82 -/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
83 +/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
84 +#if !defined(__GLIBC__)
85 +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
86 +#else
87 #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
88 #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
89 #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
90 +#endif /* !defined(__GLIBC__) */
92 #else /* _NET_IF_H */
94 /* Linux headers included first, and we must define everything
95 - * we need. The expectation is that glibc will check the
96 + * we need. The expectation is that libc will check the
97 * __UAPI_DEF_* defines and adjust appropriately. */
99 #define __UAPI_DEF_IF_IFCONF 1
100 #define __UAPI_DEF_IF_IFMAP 1
101 #define __UAPI_DEF_IF_IFNAMSIZ 1
102 #define __UAPI_DEF_IF_IFREQ 1
103 -/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
104 #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
105 -/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
106 +/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
107 #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
109 #endif /* _NET_IF_H */
111 -/* Coordinate with glibc netinet/in.h header. */
112 +/* Coordinate with libc netinet/if_ether.h */
113 +#ifdef _NETINET_IF_ETHER_H
114 +#define __UAPI_DEF_ETHHDR 0
115 +#else
116 +/* glibc uses __NETINET_IF_ETHER_H and uses the uapi header */
117 +#define __UAPI_DEF_ETHHDR 1
118 +#endif /* _NETINET_IF_ETHER_H */
120 +/* Coordinate with libc netinet/in.h header. */
121 #if defined(_NETINET_IN_H)
123 -/* GLIBC headers included first so don't define anything
124 +/* libc headers included first so don't define anything
125 * that would already be defined. */
126 #define __UAPI_DEF_IN_ADDR 0
127 #define __UAPI_DEF_IN_IPPROTO 0
128 @@ -98,15 +108,7 @@
129 #define __UAPI_DEF_IN_CLASS 0
131 #define __UAPI_DEF_IN6_ADDR 0
132 -/* The exception is the in6_addr macros which must be defined
133 - * if the glibc code didn't define them. This guard matches
134 - * the guard in glibc/inet/netinet/in.h which defines the
135 - * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
136 -#if defined(__USE_MISC) || defined (__USE_GNU)
137 #define __UAPI_DEF_IN6_ADDR_ALT 0
138 -#else
139 -#define __UAPI_DEF_IN6_ADDR_ALT 1
140 -#endif
141 #define __UAPI_DEF_SOCKADDR_IN6 0
142 #define __UAPI_DEF_IPV6_MREQ 0
143 #define __UAPI_DEF_IPPROTO_V6 0
144 @@ -117,7 +119,7 @@
145 #else
147 /* Linux headers included first, and we must define everything
148 - * we need. The expectation is that glibc will check the
149 + * we need. The expectation is that libc will check the
150 * __UAPI_DEF_* defines and adjust appropriately. */
151 #define __UAPI_DEF_IN_ADDR 1
152 #define __UAPI_DEF_IN_IPPROTO 1
153 @@ -127,7 +129,7 @@
154 #define __UAPI_DEF_IN_CLASS 1
156 #define __UAPI_DEF_IN6_ADDR 1
157 -/* We unconditionally define the in6_addr macros and glibc must
158 +/* We unconditionally define the in6_addr macros and libc must
159 * coordinate. */
160 #define __UAPI_DEF_IN6_ADDR_ALT 1
161 #define __UAPI_DEF_SOCKADDR_IN6 1
162 @@ -168,18 +170,20 @@
163 /* If we did not see any headers from any supported C libraries,
164 * or we are being included in the kernel, then define everything
165 * that we need. */
166 -#else /* !defined(__GLIBC__) */
167 +#else /* defined(__KERNEL__) */
169 /* Definitions for if.h */
170 #define __UAPI_DEF_IF_IFCONF 1
171 #define __UAPI_DEF_IF_IFMAP 1
172 #define __UAPI_DEF_IF_IFNAMSIZ 1
173 #define __UAPI_DEF_IF_IFREQ 1
174 -/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
175 #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
176 -/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
177 +/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
178 #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
180 +/* Definitions for if/ether.h */
181 +#define __UAPI_DEF_ETHHDR 1
183 /* Definitions for in.h */
184 #define __UAPI_DEF_IN_ADDR 1
185 #define __UAPI_DEF_IN_IPPROTO 1
186 @@ -208,6 +212,6 @@
187 /* Definitions for xattr.h */
188 #define __UAPI_DEF_XATTR 1
190 -#endif /* __GLIBC__ */
191 +#endif /* defined(__KERNEL__) */
193 #endif /* _LIBC_COMPAT_H */
194 --- include/uapi/linux/netfilter_ipv4/ip_tables.h 2017-07-06 11:09:53.310214100 -0700
195 +++ include/uapi/linux/netfilter_ipv4/ip_tables.h 2017-07-06 16:38:57.526211238 -0700
196 @@ -17,7 +17,6 @@
198 #include <linux/types.h>
200 -#include <linux/if.h>
201 #include <linux/netfilter_ipv4.h>
203 #include <linux/netfilter/x_tables.h>
204 --- tc/f_flower.c 2017-07-06 11:09:53.289213865 -0700
205 +++ tc/f_flower.c 2017-07-06 16:36:04.967030780 -0700
206 @@ -15,7 +15,7 @@
207 #include <syslog.h>
208 #include <string.h>
209 #include <net/if.h>
210 -#include <linux/if_arp.h>
211 +#include <net/if_arp.h>
212 #include <linux/if_ether.h>
213 #include <linux/ip.h>
214 #include <linux/tc_act/tc_vlan.h>