1*4882a593SmuzhiyunFrom 2e2eab070384834036c1458c669070ed17d81dbe Mon Sep 17 00:00:00 2001 2*4882a593SmuzhiyunFrom: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 3*4882a593SmuzhiyunDate: Wed, 10 Feb 2016 23:15:36 +0100 4*4882a593SmuzhiyunSubject: [PATCH] sysdep.c: don't include <linux/if_tun.h> on Linux 5*4882a593SmuzhiyunMIME-Version: 1.0 6*4882a593SmuzhiyunContent-Type: text/plain; charset=UTF-8 7*4882a593SmuzhiyunContent-Transfer-Encoding: 8bit 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunIncluding <linux/if_tun.h> in sysdep.c is not necessary since sysdep.h 10*4882a593Smuzhiyunalready includes <netinet/if_ether.h>. And this is actually 11*4882a593Smuzhiyunpotentially harmful since both files redefine the same 'struct 12*4882a593Smuzhiyunethhdr', causing the following build failure with the musl C library: 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunIn file included from sysdep.h:28:0, 15*4882a593Smuzhiyun from sysdep.c:71: 16*4882a593Smuzhiyun.../buildroot/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/netinet/if_ether.h:96:8: error: redefinition of ‘struct ethhdr’ 17*4882a593Smuzhiyun struct ethhdr { 18*4882a593Smuzhiyun ^ 19*4882a593SmuzhiyunIn file included from .../buildroot/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/linux/if_tun.h:20:0, 20*4882a593Smuzhiyun from sysdep.c:62: 21*4882a593Smuzhiyun.../buildroot/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/linux/if_ether.h:138:8: note: originally defined here 22*4882a593Smuzhiyun struct ethhdr { 23*4882a593Smuzhiyun ^ 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunOriginal patch from: 26*4882a593Smuzhiyunhttp://git.alpinelinux.org/cgit/aports/tree/testing/vpnc/working.patch 27*4882a593Smuzhiyun 28*4882a593SmuzhiyunSigned-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 29*4882a593Smuzhiyun--- 30*4882a593Smuzhiyun sysdep.c | 4 +--- 31*4882a593Smuzhiyun 1 file changed, 1 insertion(+), 3 deletions(-) 32*4882a593Smuzhiyun 33*4882a593Smuzhiyundiff --git a/sysdep.c b/sysdep.c 34*4882a593Smuzhiyunindex d8f181d..f83543d 100644 35*4882a593Smuzhiyun--- a/sysdep.c 36*4882a593Smuzhiyun+++ b/sysdep.c 37*4882a593Smuzhiyun@@ -58,13 +58,11 @@ 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun #if defined(__DragonFly__) 40*4882a593Smuzhiyun #include <net/tun/if_tun.h> 41*4882a593Smuzhiyun-#elif defined(__linux__) 42*4882a593Smuzhiyun-#include <linux/if_tun.h> 43*4882a593Smuzhiyun #elif defined(__APPLE__) 44*4882a593Smuzhiyun /* no header for tun */ 45*4882a593Smuzhiyun #elif defined(__CYGWIN__) 46*4882a593Smuzhiyun #include "tap-win32.h" 47*4882a593Smuzhiyun-#else 48*4882a593Smuzhiyun+#elif !defined(__linux__) 49*4882a593Smuzhiyun #include <net/if_tun.h> 50*4882a593Smuzhiyun #endif 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun-- 53*4882a593Smuzhiyun2.6.4 54*4882a593Smuzhiyun 55