vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

commit 95fa2229beeaca4fbad9a3870a8f397dcd674489
parent 5b9a5aabc3cbe6a784a75eaeedb6e2419a702802
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date:   Mon, 13 Sep 2010 00:02:47 +0200

ethertap in darwin

Diffstat:
Msrc/9vx/Makefrag | 4++--
Msrc/9vx/ethertap.c | 18++++++++++++++++++
2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/9vx/Makefrag b/src/9vx/Makefrag @@ -3,7 +3,7 @@ PLAN9VX=1 PLAN9GUI=x11 PLAN9AUDIO=unix PLAN9PCAP=nopcap -PLAN9TAP=notap +PLAN9TAP=ethertap endif ifeq ($(OS),darwin) @@ -11,7 +11,7 @@ PLAN9VX=1 PLAN9GUI=osx PLAN9AUDIO=none PLAN9PCAP=nopcap -PLAN9TAP=notap +PLAN9TAP=ethertap endif ifeq ($(OS),freebsd) diff --git a/src/9vx/ethertap.c b/src/9vx/ethertap.c @@ -16,6 +16,9 @@ #include "etherif.h" #include "vether.h" +#if defined(__APPLE__) +#include <sys/socket.h> +#endif #include <net/if.h> #include <sys/ioctl.h> @@ -67,6 +70,21 @@ opentap(char *dev) return -1; return fd; } +#elif defined(__APPLE__) +static int +opentap(char *dev) +{ + int fd; + char *tap0 = "/dev/tap0"; + + if(dev == nil) + dev = tap0; + if((fd = open(dev, O_RDWR)) < 0) { + iprint("tap: open failed with: %d\n", errno); + return -1; + } + return fd; +} #endif static int