1 From 181ff3439783c6920f5211730672685a210c318f Mon Sep 17 00:00:00 2001
2 From: Ross Burton <ross.burton@intel.com>
3 Date: Mon, 8 Oct 2018 22:12:56 +0200
4 Subject: [PATCH] Fix various issues which cause problems under musl
6 Instead of using #define _GNU_SOURCE in some source files which causes
7 problems when building with musl as more files need the define, simply
8 use AC_USE_SYSTEM_EXTENSIONS in configure.ac to get it defined globally.
10 Signed-off-by: Ross Burton <ross.burton@intel.com>
11 Upstream-Status: Backport [bd1326ba7d68df38c5ccaafd2403a5fb30bd452b]
15 gdhcp/common.h | 5 +++--
18 plugins/wifi.c | 3 +--
28 src/tethering.c | 2 --
30 tools/dhcp-test.c | 1 -
31 tools/dnsproxy-test.c | 1 +
32 tools/private-network-test.c | 2 +-
33 tools/stats-tool.c | 1 -
34 tools/tap-test.c | 3 +--
36 vpn/plugins/vpn.c | 1 -
37 24 files changed, 12 insertions(+), 25 deletions(-)
39 diff --git a/configure.ac b/configure.ac
40 index 39745f76..984126c2 100644
43 @@ -20,6 +20,7 @@ AC_SUBST(abs_top_srcdir)
44 AC_SUBST(abs_top_builddir)
47 +AC_USE_SYSTEM_EXTENSIONS
51 @@ -185,6 +186,8 @@ AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
52 AC_CHECK_HEADERS([execinfo.h])
53 AM_CONDITIONAL([BACKTRACE], [test "${ac_cv_header_execinfo_h}" = "yes"])
55 +AC_CHECK_MEMBERS([struct in6_pktinfo.ipi6_addr], [], [], [[#include <netinet/in.h>]])
57 AC_CHECK_FUNC(signalfd, dummy=yes,
58 AC_MSG_ERROR(signalfd support is required))
60 diff --git a/gdhcp/client.c b/gdhcp/client.c
61 index 67357782..c7db76f0 100644
72 diff --git a/gdhcp/common.h b/gdhcp/common.h
73 index 75abc183..6899499e 100644
81 #include <netinet/udp.h>
82 #include <netinet/ip.h>
84 @@ -170,8 +171,8 @@ static const uint8_t dhcp_option_lengths[] = {
88 -/* already defined within netinet/in.h if using GNU compiler */
90 +/* already defined within netinet/in.h if using glibc or musl */
91 +#ifndef HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR
93 struct in6_addr ipi6_addr; /* src/dst IPv6 address */
94 unsigned int ipi6_ifindex; /* send/recv interface index */
95 diff --git a/gweb/gresolv.c b/gweb/gresolv.c
96 index 81c79b6c..b06f8932 100644
104 #include <sys/types.h>
105 #include <sys/socket.h>
107 diff --git a/plugins/tist.c b/plugins/tist.c
108 index ad5ef79e..cc2800a1 100644
119 diff --git a/plugins/wifi.c b/plugins/wifi.c
120 index dc08c6af..46e4cca4 100644
125 #include <sys/ioctl.h>
126 #include <sys/socket.h>
127 -#include <linux/if_arp.h>
128 -#include <linux/wireless.h>
129 #include <net/ethernet.h>
130 +#include <linux/wireless.h>
133 #define IFF_LOWER_UP 0x10000
134 diff --git a/src/backtrace.c b/src/backtrace.c
135 index e8d7f432..bede6698 100644
136 --- a/src/backtrace.c
137 +++ b/src/backtrace.c
146 diff --git a/src/inet.c b/src/inet.c
147 index a31372b5..a58ce7c1 100644
158 diff --git a/src/ippool.c b/src/ippool.c
159 index cea1dccd..8a645da2 100644
166 -#include <sys/errno.h>
167 #include <sys/socket.h>
170 diff --git a/src/iptables.c b/src/iptables.c
171 index f3670e77..469effed 100644
178 -#include <sys/errno.h>
180 #include <sys/socket.h>
182 #include <inttypes.h>
183 diff --git a/src/log.c b/src/log.c
184 index 9bae4a3d..f7e82e5d 100644
195 diff --git a/src/ntp.c b/src/ntp.c
196 index 51ba9aac..724ca188 100644
207 diff --git a/src/resolver.c b/src/resolver.c
208 index 76f0a8e1..10121aa5 100644
219 diff --git a/src/rfkill.c b/src/rfkill.c
220 index d9bed4d2..b2514c41 100644
231 diff --git a/src/stats.c b/src/stats.c
232 index 663bc382..c9ddc2e8 100644
241 #include <sys/mman.h>
242 #include <sys/types.h>
243 diff --git a/src/tethering.c b/src/tethering.c
244 index 4b202369..f3cb36f4 100644
245 --- a/src/tethering.c
246 +++ b/src/tethering.c
250 #include <netinet/in.h>
251 -#include <linux/sockios.h>
252 -#include <linux/if_tun.h>
253 #include <linux/if_bridge.h>
256 diff --git a/src/timezone.c b/src/timezone.c
257 index e346b11a..8e912670 100644
268 diff --git a/tools/dhcp-test.c b/tools/dhcp-test.c
269 index c34e10a8..eae66fc2 100644
270 --- a/tools/dhcp-test.c
271 +++ b/tools/dhcp-test.c
273 #include <arpa/inet.h>
274 #include <net/route.h>
275 #include <net/ethernet.h>
276 -#include <linux/if_arp.h>
278 #include <gdhcp/gdhcp.h>
280 diff --git a/tools/dnsproxy-test.c b/tools/dnsproxy-test.c
281 index 551cae91..371e2e23 100644
282 --- a/tools/dnsproxy-test.c
283 +++ b/tools/dnsproxy-test.c
292 diff --git a/tools/private-network-test.c b/tools/private-network-test.c
293 index 3dd115ba..2828bb30 100644
294 --- a/tools/private-network-test.c
295 +++ b/tools/private-network-test.c
300 -#include <sys/poll.h>
302 #include <sys/signalfd.h>
305 diff --git a/tools/stats-tool.c b/tools/stats-tool.c
306 index efa39de2..5695048f 100644
307 --- a/tools/stats-tool.c
308 +++ b/tools/stats-tool.c
314 #include <sys/mman.h>
315 #include <sys/types.h>
316 #include <sys/stat.h>
317 diff --git a/tools/tap-test.c b/tools/tap-test.c
318 index fdc098aa..cb3ee622 100644
319 --- a/tools/tap-test.c
320 +++ b/tools/tap-test.c
331 -#include <sys/poll.h>
333 #include <sys/ioctl.h>
335 #include <netinet/in.h>
336 diff --git a/tools/wispr.c b/tools/wispr.c
337 index d5f9341f..e56dfc16 100644
348 diff --git a/vpn/plugins/vpn.c b/vpn/plugins/vpn.c
349 index 10548aaf..6e3f640c 100644
350 --- a/vpn/plugins/vpn.c
351 +++ b/vpn/plugins/vpn.c