summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/connman/connman/includes.patch
blob: 9f7395cbbbb1fe4ba7383cef51162d5569b6748e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
Fix various issues which cause problems under musl.

Upstream-Status: Backport [bd1326ba7d68df38c5ccaafd2403a5fb30bd452b]
Signed-off-by: Ross Burton <ross.burton@intel.com>

From 630516bcc0233b047f65665c003201ba6e77453d Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Tue, 9 Aug 2016 16:22:36 +0100
Subject: [PATCH 1/3] Use AC_USE_SYSTEM_EXTENSIONS

Instead of using #define _GNU_SOURCE in some source files which causes problems
when building with musl as more files need the define, simply use
AC_USE_SYSTEM_EXTENSIONS in configure.ac to get it defined globally.
---
 configure.ac       | 1 +
 gdhcp/client.c     | 1 -
 plugins/tist.c     | 1 -
 src/backtrace.c    | 1 -
 src/inet.c         | 1 -
 src/log.c          | 1 -
 src/ntp.c          | 1 -
 src/resolver.c     | 1 -
 src/rfkill.c       | 1 -
 src/stats.c        | 1 -
 src/timezone.c     | 1 -
 tools/stats-tool.c | 1 -
 tools/tap-test.c   | 1 -
 tools/wispr.c      | 1 -
 vpn/plugins/vpn.c  | 1 -
 15 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6e66ab3..bacf5ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,7 @@ AC_SUBST(abs_top_srcdir)
 AC_SUBST(abs_top_builddir)
 
 AC_LANG_C
+AC_USE_SYSTEM_EXTENSIONS
 
 AC_PROG_CC
 AM_PROG_CC_C_O
diff --git a/gdhcp/client.c b/gdhcp/client.c
index fbb40ab..3aeb089 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
diff --git a/plugins/tist.c b/plugins/tist.c
index ad5ef79..cc2800a 100644
--- a/plugins/tist.c
+++ b/plugins/tist.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdbool.h>
 #include <stdlib.h>
diff --git a/src/backtrace.c b/src/backtrace.c
index 6a66c0a..4dbdda8 100644
--- a/src/backtrace.c
+++ b/src/backtrace.c
@@ -24,7 +24,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/src/inet.c b/src/inet.c
index 69ded19..81d92c2 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -25,7 +25,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
diff --git a/src/log.c b/src/log.c
index 9bae4a3..f7e82e5 100644
--- a/src/log.c
+++ b/src/log.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <unistd.h>
 #include <stdarg.h>
diff --git a/src/ntp.c b/src/ntp.c
index dd246eb..db8ae96 100644
--- a/src/ntp.c
+++ b/src/ntp.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/src/resolver.c b/src/resolver.c
index fbe4be7..ef61f92 100644
--- a/src/resolver.c
+++ b/src/resolver.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/src/rfkill.c b/src/rfkill.c
index 2bfb092..af49d12 100644
--- a/src/rfkill.c
+++ b/src/rfkill.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/src/stats.c b/src/stats.c
index 26343b1..cfcdc94 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <sys/mman.h>
 #include <sys/types.h>
diff --git a/src/timezone.c b/src/timezone.c
index e346b11..8e91267 100644
--- a/src/timezone.c
+++ b/src/timezone.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <errno.h>
 #include <stdio.h>
 #include <fcntl.h>
diff --git a/tools/stats-tool.c b/tools/stats-tool.c
index b076478..428d94b 100644
--- a/tools/stats-tool.c
+++ b/tools/stats-tool.c
@@ -22,7 +22,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/tools/tap-test.c b/tools/tap-test.c
index fdc098a..57917f5 100644
--- a/tools/tap-test.c
+++ b/tools/tap-test.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/tools/wispr.c b/tools/wispr.c
index d5f9341..e56dfc1 100644
--- a/tools/wispr.c
+++ b/tools/wispr.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/vpn/plugins/vpn.c b/vpn/plugins/vpn.c
index 9a42385..479c3a7 100644
--- a/vpn/plugins/vpn.c
+++ b/vpn/plugins/vpn.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
-- 
2.8.1


From b8b7878e6cb2a1ed4fcfa256f7e232511a40e3d9 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Tue, 9 Aug 2016 15:37:50 +0100
Subject: [PATCH 2/3] Check for in6_pktinfo.ipi6_addr explicitly

Instead of assuming that just glibc has this structure, check for it at
configure as musl also has it.

Based on work by Khem Raj <raj.khem@gmail.com>.
---
 configure.ac   | 2 ++
 gdhcp/common.h | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index bacf5ec..ad00456 100644
--- a/configure.ac
+++ b/configure.ac
@@ -186,6 +186,8 @@ AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
 AC_CHECK_HEADERS([execinfo.h])
 AM_CONDITIONAL([BACKTRACE], [test "${ac_cv_header_execinfo_h}" = "yes"])
 
+AC_CHECK_MEMBERS([struct in6_pktinfo.ipi6_addr], [], [], [[#include <netinet/in.h>]])
+
 AC_CHECK_FUNC(signalfd, dummy=yes,
 			AC_MSG_ERROR(signalfd support is required))
 
diff --git a/gdhcp/common.h b/gdhcp/common.h
index 75abc18..6899499 100644
--- a/gdhcp/common.h
+++ b/gdhcp/common.h
@@ -19,6 +19,7 @@
  *
  */
 
+#include <config.h>
 #include <netinet/udp.h>
 #include <netinet/ip.h>
 
@@ -170,8 +171,8 @@ static const uint8_t dhcp_option_lengths[] = {
 	[OPTION_U32]	= 4,
 };
 
-/* already defined within netinet/in.h if using GNU compiler */
-#ifndef __USE_GNU
+/* already defined within netinet/in.h if using glibc or musl */
+#ifndef HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR
 struct in6_pktinfo {
 	struct in6_addr ipi6_addr;  /* src/dst IPv6 address */
 	unsigned int ipi6_ifindex;  /* send/recv interface index */
-- 
2.8.1


From c0726e432fa0274a2b9c70179b03df6720972816 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Tue, 9 Aug 2016 15:19:23 +0100
Subject: [PATCH 3/3] Rationalise includes

gweb/gresolv.c uses snprintf() and isspace() so it should include stdio.h and
ctype.h.

tools/dnsproxy-test uses functions from stdio.h.

musl warns when sys/ headers are included when the non-sys form should be used,
so switch sys/errno.h and so on to errno.h.

musl also causes redefinition errors when pieces of the networking headers are
included, so remove the redundant includes.

Based on work by Khem Raj <raj.khem@gmail.com>.
---
 gweb/gresolv.c               | 2 ++
 plugins/wifi.c               | 3 +--
 src/ippool.c                 | 1 -
 src/iptables.c               | 2 +-
 src/tethering.c              | 2 --
 tools/dhcp-test.c            | 1 -
 tools/dnsproxy-test.c        | 1 +
 tools/private-network-test.c | 2 +-
 tools/tap-test.c             | 2 +-
 9 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/gweb/gresolv.c b/gweb/gresolv.c
index 8a51a9f..d55027c 100644
--- a/gweb/gresolv.c
+++ b/gweb/gresolv.c
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <resolv.h>
+#include <stdio.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 9d56671..148131d 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -30,9 +30,8 @@
 #include <string.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
-#include <linux/if_arp.h>
-#include <linux/wireless.h>
 #include <net/ethernet.h>
+#include <linux/wireless.h>
 
 #ifndef IFF_LOWER_UP
 #define IFF_LOWER_UP	0x10000
diff --git a/src/ippool.c b/src/ippool.c
index cea1dcc..8a645da 100644
--- a/src/ippool.c
+++ b/src/ippool.c
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/errno.h>
 #include <sys/socket.h>
 
 #include "connman.h"
diff --git a/src/iptables.c b/src/iptables.c
index 5ef757a..82e3ac4 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -28,7 +28,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/errno.h>
+#include <errno.h>
 #include <sys/socket.h>
 #include <xtables.h>
 #include <inttypes.h>
diff --git a/src/tethering.c b/src/tethering.c
index 3153349..ad062d5 100644
--- a/src/tethering.c
+++ b/src/tethering.c
@@ -31,10 +31,8 @@
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
-#include <linux/sockios.h>
 #include <string.h>
 #include <fcntl.h>
-#include <linux/if_tun.h>
 #include <netinet/in.h>
 #include <linux/if_bridge.h>
 
diff --git a/tools/dhcp-test.c b/tools/dhcp-test.c
index c34e10a..eae66fc 100644
--- a/tools/dhcp-test.c
+++ b/tools/dhcp-test.c
@@ -33,7 +33,6 @@
 #include <arpa/inet.h>
 #include <net/route.h>
 #include <net/ethernet.h>
-#include <linux/if_arp.h>
 
 #include <gdhcp/gdhcp.h>
 
diff --git a/tools/dnsproxy-test.c b/tools/dnsproxy-test.c
index 551cae9..371e2e2 100644
--- a/tools/dnsproxy-test.c
+++ b/tools/dnsproxy-test.c
@@ -24,6 +24,7 @@
 #endif
 
 #include <errno.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/tools/private-network-test.c b/tools/private-network-test.c
index 3dd115b..2828bb3 100644
--- a/tools/private-network-test.c
+++ b/tools/private-network-test.c
@@ -32,7 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <signal.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/signalfd.h>
 #include <unistd.h>
 
diff --git a/tools/tap-test.c b/tools/tap-test.c
index 57917f5..cb3ee62 100644
--- a/tools/tap-test.c
+++ b/tools/tap-test.c
@@ -28,7 +28,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/ioctl.h>
 
 #include <netinet/in.h>
-- 
2.8.1