From 032fc7a937a99728fd73f642950e45fb59ea55e5 Mon Sep 17 00:00:00 2001 From: Sergey Matveychuk Date: Fri, 11 Mar 2005 13:51:32 +0000 Subject: VDE is a user-mode ethernet simulation. It's quite useful for hooking together multiple qemu instances into a single virtual network without needing root access. It can also be used for tunneling or other network simulation tasks. PR: ports/76874 Submitted by: Craig Boston --- net/vde/files/patch-tuntap.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 net/vde/files/patch-tuntap.c (limited to 'net/vde/files/patch-tuntap.c') diff --git a/net/vde/files/patch-tuntap.c b/net/vde/files/patch-tuntap.c new file mode 100644 index 000000000000..43b31617ea17 --- /dev/null +++ b/net/vde/files/patch-tuntap.c @@ -0,0 +1,45 @@ +--- tuntap.c Sat Jan 29 15:02:08 2005 ++++ tuntap.c Sun Jan 30 00:27:23 2005 +@@ -11,8 +11,16 @@ + #include + #include + #include ++#ifdef __FreeBSD__ ++#include ++#include ++#endif + #include ++#ifdef __FreeBSD__ ++#include ++#else + #include ++#endif + #include "port.h" + #include "switch.h" + +@@ -28,13 +36,16 @@ + + int open_tap(char *dev) + { ++#ifndef __FreeBSD__ + struct ifreq ifr; ++#endif + int fd; + +- if((fd = open("/dev/net/tun", O_RDWR)) < 0){ +- printlog(LOG_ERR,"Failed to open /dev/net/tun %s",strerror(errno)); ++ if((fd = open(dev, O_RDWR)) < 0){ ++ printlog(LOG_ERR,"Failed to open %s %s", dev, strerror(errno)); + return(-1); + } ++#ifndef __FreeBSD__ + memset(&ifr, 0, sizeof(ifr)); + ifr.ifr_flags = IFF_TAP | IFF_NO_PI; + strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name) - 1); +@@ -43,5 +54,6 @@ + close(fd); + return(-1); + } ++#endif + return(fd); + } -- cgit v1.2.3