Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 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 |
| 5 | |
| 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. |
| 9 | |
| 10 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 11 | Upstream-Status: Backport [bd1326ba7d68df38c5ccaafd2403a5fb30bd452b] |
| 12 | --- |
| 13 | configure.ac | 3 +++ |
| 14 | gdhcp/client.c | 1 - |
| 15 | gdhcp/common.h | 5 +++-- |
| 16 | gweb/gresolv.c | 1 + |
| 17 | plugins/tist.c | 1 - |
| 18 | plugins/wifi.c | 3 +-- |
| 19 | src/backtrace.c | 1 - |
| 20 | src/inet.c | 1 - |
| 21 | src/ippool.c | 1 - |
| 22 | src/iptables.c | 2 +- |
| 23 | src/log.c | 1 - |
| 24 | src/ntp.c | 1 - |
| 25 | src/resolver.c | 1 - |
| 26 | src/rfkill.c | 1 - |
| 27 | src/stats.c | 1 - |
| 28 | src/tethering.c | 2 -- |
| 29 | src/timezone.c | 1 - |
| 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 +-- |
| 35 | tools/wispr.c | 1 - |
| 36 | vpn/plugins/vpn.c | 1 - |
| 37 | 24 files changed, 12 insertions(+), 25 deletions(-) |
| 38 | |
| 39 | diff --git a/configure.ac b/configure.ac |
| 40 | index 39745f76..984126c2 100644 |
| 41 | --- a/configure.ac |
| 42 | +++ b/configure.ac |
| 43 | @@ -20,6 +20,7 @@ AC_SUBST(abs_top_srcdir) |
| 44 | AC_SUBST(abs_top_builddir) |
| 45 | |
| 46 | AC_LANG_C |
| 47 | +AC_USE_SYSTEM_EXTENSIONS |
| 48 | |
| 49 | AC_PROG_CC |
| 50 | AM_PROG_CC_C_O |
| 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"]) |
| 54 | |
| 55 | +AC_CHECK_MEMBERS([struct in6_pktinfo.ipi6_addr], [], [], [[#include <netinet/in.h>]]) |
| 56 | + |
| 57 | AC_CHECK_FUNC(signalfd, dummy=yes, |
| 58 | AC_MSG_ERROR(signalfd support is required)) |
| 59 | |
| 60 | diff --git a/gdhcp/client.c b/gdhcp/client.c |
| 61 | index 67357782..c7db76f0 100644 |
| 62 | --- a/gdhcp/client.c |
| 63 | +++ b/gdhcp/client.c |
| 64 | @@ -23,7 +23,6 @@ |
| 65 | #include <config.h> |
| 66 | #endif |
| 67 | |
| 68 | -#define _GNU_SOURCE |
| 69 | #include <stdio.h> |
| 70 | #include <errno.h> |
| 71 | #include <unistd.h> |
| 72 | diff --git a/gdhcp/common.h b/gdhcp/common.h |
| 73 | index 75abc183..6899499e 100644 |
| 74 | --- a/gdhcp/common.h |
| 75 | +++ b/gdhcp/common.h |
| 76 | @@ -19,6 +19,7 @@ |
| 77 | * |
| 78 | */ |
| 79 | |
| 80 | +#include <config.h> |
| 81 | #include <netinet/udp.h> |
| 82 | #include <netinet/ip.h> |
| 83 | |
| 84 | @@ -170,8 +171,8 @@ static const uint8_t dhcp_option_lengths[] = { |
| 85 | [OPTION_U32] = 4, |
| 86 | }; |
| 87 | |
| 88 | -/* already defined within netinet/in.h if using GNU compiler */ |
| 89 | -#ifndef __USE_GNU |
| 90 | +/* already defined within netinet/in.h if using glibc or musl */ |
| 91 | +#ifndef HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR |
| 92 | struct in6_pktinfo { |
| 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 |
| 97 | --- a/gweb/gresolv.c |
| 98 | +++ b/gweb/gresolv.c |
| 99 | @@ -29,6 +29,7 @@ |
| 100 | #include <string.h> |
| 101 | #include <stdlib.h> |
| 102 | #include <resolv.h> |
| 103 | +#include <stdio.h> |
| 104 | #include <sys/types.h> |
| 105 | #include <sys/socket.h> |
| 106 | #include <netdb.h> |
| 107 | diff --git a/plugins/tist.c b/plugins/tist.c |
| 108 | index ad5ef79e..cc2800a1 100644 |
| 109 | --- a/plugins/tist.c |
| 110 | +++ b/plugins/tist.c |
| 111 | @@ -23,7 +23,6 @@ |
| 112 | #include <config.h> |
| 113 | #endif |
| 114 | |
| 115 | -#define _GNU_SOURCE |
| 116 | #include <stdio.h> |
| 117 | #include <stdbool.h> |
| 118 | #include <stdlib.h> |
| 119 | diff --git a/plugins/wifi.c b/plugins/wifi.c |
| 120 | index dc08c6af..46e4cca4 100644 |
| 121 | --- a/plugins/wifi.c |
| 122 | +++ b/plugins/wifi.c |
| 123 | @@ -30,9 +30,8 @@ |
| 124 | #include <string.h> |
| 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> |
| 131 | |
| 132 | #ifndef IFF_LOWER_UP |
| 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 |
| 138 | @@ -24,7 +24,6 @@ |
| 139 | #include <config.h> |
| 140 | #endif |
| 141 | |
| 142 | -#define _GNU_SOURCE |
| 143 | #include <stdio.h> |
| 144 | #include <unistd.h> |
| 145 | #include <stdlib.h> |
| 146 | diff --git a/src/inet.c b/src/inet.c |
| 147 | index a31372b5..a58ce7c1 100644 |
| 148 | --- a/src/inet.c |
| 149 | +++ b/src/inet.c |
| 150 | @@ -25,7 +25,6 @@ |
| 151 | #include <config.h> |
| 152 | #endif |
| 153 | |
| 154 | -#define _GNU_SOURCE |
| 155 | #include <stdio.h> |
| 156 | #include <errno.h> |
| 157 | #include <unistd.h> |
| 158 | diff --git a/src/ippool.c b/src/ippool.c |
| 159 | index cea1dccd..8a645da2 100644 |
| 160 | --- a/src/ippool.c |
| 161 | +++ b/src/ippool.c |
| 162 | @@ -28,7 +28,6 @@ |
| 163 | #include <stdio.h> |
| 164 | #include <string.h> |
| 165 | #include <unistd.h> |
| 166 | -#include <sys/errno.h> |
| 167 | #include <sys/socket.h> |
| 168 | |
| 169 | #include "connman.h" |
| 170 | diff --git a/src/iptables.c b/src/iptables.c |
| 171 | index f3670e77..469effed 100644 |
| 172 | --- a/src/iptables.c |
| 173 | +++ b/src/iptables.c |
| 174 | @@ -28,7 +28,7 @@ |
| 175 | #include <stdio.h> |
| 176 | #include <string.h> |
| 177 | #include <unistd.h> |
| 178 | -#include <sys/errno.h> |
| 179 | +#include <errno.h> |
| 180 | #include <sys/socket.h> |
| 181 | #include <xtables.h> |
| 182 | #include <inttypes.h> |
| 183 | diff --git a/src/log.c b/src/log.c |
| 184 | index 9bae4a3d..f7e82e5d 100644 |
| 185 | --- a/src/log.c |
| 186 | +++ b/src/log.c |
| 187 | @@ -23,7 +23,6 @@ |
| 188 | #include <config.h> |
| 189 | #endif |
| 190 | |
| 191 | -#define _GNU_SOURCE |
| 192 | #include <stdio.h> |
| 193 | #include <unistd.h> |
| 194 | #include <stdarg.h> |
| 195 | diff --git a/src/ntp.c b/src/ntp.c |
| 196 | index 51ba9aac..724ca188 100644 |
| 197 | --- a/src/ntp.c |
| 198 | +++ b/src/ntp.c |
| 199 | @@ -23,7 +23,6 @@ |
| 200 | #include <config.h> |
| 201 | #endif |
| 202 | |
| 203 | -#define _GNU_SOURCE |
| 204 | #include <errno.h> |
| 205 | #include <fcntl.h> |
| 206 | #include <unistd.h> |
| 207 | diff --git a/src/resolver.c b/src/resolver.c |
| 208 | index 76f0a8e1..10121aa5 100644 |
| 209 | --- a/src/resolver.c |
| 210 | +++ b/src/resolver.c |
| 211 | @@ -23,7 +23,6 @@ |
| 212 | #include <config.h> |
| 213 | #endif |
| 214 | |
| 215 | -#define _GNU_SOURCE |
| 216 | #include <stdio.h> |
| 217 | #include <errno.h> |
| 218 | #include <fcntl.h> |
| 219 | diff --git a/src/rfkill.c b/src/rfkill.c |
| 220 | index d9bed4d2..b2514c41 100644 |
| 221 | --- a/src/rfkill.c |
| 222 | +++ b/src/rfkill.c |
| 223 | @@ -23,7 +23,6 @@ |
| 224 | #include <config.h> |
| 225 | #endif |
| 226 | |
| 227 | -#define _GNU_SOURCE |
| 228 | #include <stdio.h> |
| 229 | #include <errno.h> |
| 230 | #include <fcntl.h> |
| 231 | diff --git a/src/stats.c b/src/stats.c |
| 232 | index 663bc382..c9ddc2e8 100644 |
| 233 | --- a/src/stats.c |
| 234 | +++ b/src/stats.c |
| 235 | @@ -23,7 +23,6 @@ |
| 236 | #include <config.h> |
| 237 | #endif |
| 238 | |
| 239 | -#define _GNU_SOURCE |
| 240 | #include <errno.h> |
| 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 |
| 247 | @@ -34,8 +34,6 @@ |
| 248 | #include <string.h> |
| 249 | #include <fcntl.h> |
| 250 | #include <netinet/in.h> |
| 251 | -#include <linux/sockios.h> |
| 252 | -#include <linux/if_tun.h> |
| 253 | #include <linux/if_bridge.h> |
| 254 | |
| 255 | #include "connman.h" |
| 256 | diff --git a/src/timezone.c b/src/timezone.c |
| 257 | index e346b11a..8e912670 100644 |
| 258 | --- a/src/timezone.c |
| 259 | +++ b/src/timezone.c |
| 260 | @@ -23,7 +23,6 @@ |
| 261 | #include <config.h> |
| 262 | #endif |
| 263 | |
| 264 | -#define _GNU_SOURCE |
| 265 | #include <errno.h> |
| 266 | #include <stdio.h> |
| 267 | #include <fcntl.h> |
| 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 |
| 272 | @@ -33,7 +33,6 @@ |
| 273 | #include <arpa/inet.h> |
| 274 | #include <net/route.h> |
| 275 | #include <net/ethernet.h> |
| 276 | -#include <linux/if_arp.h> |
| 277 | |
| 278 | #include <gdhcp/gdhcp.h> |
| 279 | |
| 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 |
| 284 | @@ -24,6 +24,7 @@ |
| 285 | #endif |
| 286 | |
| 287 | #include <errno.h> |
| 288 | +#include <stdio.h> |
| 289 | #include <stdlib.h> |
| 290 | #include <string.h> |
| 291 | #include <unistd.h> |
| 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 |
| 296 | @@ -32,7 +32,7 @@ |
| 297 | #include <stdlib.h> |
| 298 | #include <string.h> |
| 299 | #include <signal.h> |
| 300 | -#include <sys/poll.h> |
| 301 | +#include <poll.h> |
| 302 | #include <sys/signalfd.h> |
| 303 | #include <unistd.h> |
| 304 | |
| 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 |
| 309 | @@ -22,7 +22,6 @@ |
| 310 | #include <config.h> |
| 311 | #endif |
| 312 | |
| 313 | -#define _GNU_SOURCE |
| 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 |
| 321 | @@ -23,13 +23,12 @@ |
| 322 | #include <config.h> |
| 323 | #endif |
| 324 | |
| 325 | -#define _GNU_SOURCE |
| 326 | #include <stdio.h> |
| 327 | #include <errno.h> |
| 328 | #include <fcntl.h> |
| 329 | #include <unistd.h> |
| 330 | #include <string.h> |
| 331 | -#include <sys/poll.h> |
| 332 | +#include <poll.h> |
| 333 | #include <sys/ioctl.h> |
| 334 | |
| 335 | #include <netinet/in.h> |
| 336 | diff --git a/tools/wispr.c b/tools/wispr.c |
| 337 | index d5f9341f..e56dfc16 100644 |
| 338 | --- a/tools/wispr.c |
| 339 | +++ b/tools/wispr.c |
| 340 | @@ -23,7 +23,6 @@ |
| 341 | #include <config.h> |
| 342 | #endif |
| 343 | |
| 344 | -#define _GNU_SOURCE |
| 345 | #include <stdio.h> |
| 346 | #include <fcntl.h> |
| 347 | #include <unistd.h> |
| 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 |
| 352 | @@ -23,7 +23,6 @@ |
| 353 | #include <config.h> |
| 354 | #endif |
| 355 | |
| 356 | -#define _GNU_SOURCE |
| 357 | #include <string.h> |
| 358 | #include <fcntl.h> |
| 359 | #include <unistd.h> |
| 360 | -- |
| 361 | 2.17.1 |
| 362 | |