xorg-server: not available with musl on ARM
[buildroot-gz.git] / package / socat / 0004-xio-tun-remove-if_tun.h-kernel-header.patch
blob7704123f30e8ec1729d993c4f97b2f19206b906f
1 From 1c141194e3587cc8124e5f4512dc3030e5a104b1 Mon Sep 17 00:00:00 2001
2 From: Romain Naour <romain.naour@gmail.com>
3 Date: Sun, 28 Aug 2016 22:06:09 +0200
4 Subject: [PATCH] xio-tun: remove if_tun.h kernel header
6 xio-tun mixes userspace and kernel headers.
8 http://wiki.musl-libc.org/wiki/FAQ#Q:_why_am_i_getting_.22error:_redefinition_of_struct_ethhdr.2Ftcphdr.2Fetc.22_.3F
10 Signed-off-by: Romain Naour <romain.naour@gmail.com>
11 ---
12 config.h.in | 3 ---
13 configure.in | 8 +-------
14 sysincludes.h | 3 ---
15 xio-tun.c | 6 ++++++
16 4 files changed, 7 insertions(+), 13 deletions(-)
18 diff --git a/config.h.in b/config.h.in
19 index 9058bf8..ed0962c 100644
20 --- a/config.h.in
21 +++ b/config.h.in
22 @@ -258,9 +258,6 @@
23 /* Define if you have the <linux/errqueue.h> header file. */
24 #undef HAVE_LINUX_ERRQUEUE_H
26 -/* Define if you have the <linux/if_tun.h> header file. */
27 -#undef HAVE_LINUX_IF_TUN_H
29 /* Define if you have the <netpacket/packet.h> header file. */
30 #undef HAVE_NETPACKET_PACKET_H
32 diff --git a/configure.in b/configure.in
33 index 1d2e76f..27bb3d5 100644
34 --- a/configure.in
35 +++ b/configure.in
36 @@ -78,7 +78,7 @@ AC_CHECK_HEADERS(arpa/nameser.h)
38 AC_HEADER_RESOLV()
40 -AC_CHECK_HEADERS(termios.h linux/if_tun.h)
41 +AC_CHECK_HEADERS(termios.h)
42 AC_CHECK_HEADERS(net/if_dl.h)
43 AC_CHECK_HEADERS(linux/types.h)
44 AC_CHECK_HEADER(linux/errqueue.h, AC_DEFINE(HAVE_LINUX_ERRQUEUE_H), [], [#include <sys/time.h>
45 @@ -680,12 +680,6 @@ AC_ARG_ENABLE(tun, [ --disable-tun disable TUN/TAP support],
46 esac],
47 [AC_MSG_RESULT(yes); WITH_TUN=1 ])
50 -if ! test "$ac_cv_header_linux_if_tun_h" = 'yes'; then
51 - AC_MSG_WARN(include file linux/if_tun.h not found, disabling TUN)
52 - WITH_TUN=
53 -fi
55 if test -n "$WITH_TUN"; then
56 AC_DEFINE(WITH_TUN)
58 diff --git a/sysincludes.h b/sysincludes.h
59 index 98dff77..28067f4 100644
60 --- a/sysincludes.h
61 +++ b/sysincludes.h
62 @@ -142,9 +142,6 @@
63 #if HAVE_NETINET_IF_ETHER_H
64 #include <netinet/if_ether.h>
65 #endif
66 -#if HAVE_LINUX_IF_TUN_H
67 -#include <linux/if_tun.h>
68 -#endif
70 #if HAVE_TERMIOS_H && _WITH_TERMIOS
71 #include <termios.h>
72 diff --git a/xio-tun.c b/xio-tun.c
73 index 0628d27..f965a7e 100644
74 --- a/xio-tun.c
75 +++ b/xio-tun.c
76 @@ -14,6 +14,12 @@
78 #include "xio-tun.h"
80 +/* TUNSETIFF flags from if_tun.h kernel header */
81 +#define IFF_TUN 0x0001
82 +#define IFF_TAP 0x0002
83 +#define IFF_NO_PI 0x1000
85 +#define TUNSETIFF _IOW('T', 202, int)
87 static int xioopen_tun(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
89 --
90 2.5.5