From e5130495d7d4083d58ab76c26001aa27f5fc13db Mon Sep 17 00:00:00 2001 From: Ivo Timmermans Date: Sun, 15 Oct 2000 19:53:15 +0000 Subject: [PATCH] Wrap the tun/tap code in #ifdef HAVE_TUNTAP --- src/net.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/net.c b/src/net.c index 0e251bee..fecf7e6e 100644 --- a/src/net.c +++ b/src/net.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.c,v 1.35.4.36 2000/10/15 00:59:34 guus Exp $ + $Id: net.c,v 1.35.4.37 2000/10/15 19:53:15 zarq Exp $ */ #include "config.h" @@ -39,7 +39,10 @@ /* Next two includes are for tun/tap support */ #include -#include "/usr/src/linux/include/linux/if_tun.h" + +#ifdef HAVE_LINUX_IF_TUN_H +#include +#endif #include #include @@ -332,12 +335,19 @@ int setup_tap_fd(void) int nfd; const char *tapfname; config_t const *cfg; + +#ifdef HAVE_TUNTAP struct ifreq ifr; +#endif cp if((cfg = get_config_val(config, tapdevice))) tapfname = cfg->data.ptr; else +#ifdef HAVE_TUNTAP tapfname = "/dev/misc/net/tun"; +#else + tapfname = "/dev/tap0"; +#endif cp if((nfd = open(tapfname, O_RDWR | O_NONBLOCK)) < 0) { @@ -347,8 +357,8 @@ cp cp tap_fd = nfd; +#ifdef HAVE_TUNTAP /* Ok now check if this is an old ethertap or a new tun/tap thingie */ - memset(&ifr, 0, sizeof(ifr)); cp ifr.ifr_flags = IFF_TAP; @@ -363,6 +373,7 @@ cp else /* Setup inetaddr/netmask etc */; } +#endif cp return 0; -- 2.20.1