vx32

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

commit 5654a648070778957c68e7d1246cf545ae88e510
parent 2f41534cd3f741e2685551986e88659f7b168ed2
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date:   Sat,  5 Jun 2010 19:14:25 +0200

9vx.ini understands netdev=tap /dev/net/tun

Diffstat:
src/9vx/ethertap.c | 7++++++-
src/9vx/main.c | 11+++++++----
2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/9vx/ethertap.c b/src/9vx/ethertap.c @@ -24,6 +24,8 @@ #include "a/etherif.h" +extern char *netdev; + static uchar anyea[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff,}; typedef struct Ctlr Ctlr; @@ -39,8 +41,11 @@ setup(char *dev) { int fd; struct ifreq ifr; + char *defaultdev = "/dev/net/tun"; - if((fd = open("/dev/net/tun", O_RDWR)) < 0) + if(!netdev) + netdev = defaultdev; + if((fd = open(netdev, O_RDWR)) < 0) return -1; if(dev){ memset(&ifr, 0, sizeof ifr); diff --git a/src/9vx/main.c b/src/9vx/main.c @@ -238,11 +238,10 @@ main(int argc, char **argv) initrc ? "i " : "", usetty ? "t " : ""); if(vether) print("-n "); - if(netdev){ - if(nettap) - print("tap "); + if(nettap) + print("tap "); + if(netdev) print("%s ", netdev); - } if(macaddr) print("-m %s ", macaddr); print("-r %s -u %s\n", localroot, username); @@ -391,6 +390,10 @@ iniopt(char *name, char *value) usetty = 1; else if(strcmp(name, "netdev") == 0 && !netdev){ vether = 1; + if(strncmp(value, "tap", 3) == 0) { + nettap = 1; + value += 4; + } netdev = value; } else if(strcmp(name, "macaddr") == 0 && !macaddr){