diff options
author | Christian Pointner <equinox@anytun.org> | 2008-12-27 15:20:28 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2008-12-27 15:20:28 +0000 |
commit | 3f9fa03e027ef6db9ae7f8f5815a16e6ad6dd66c (patch) | |
tree | e98d80378768c33531b1eab71c14a185b940e0b9 /src/uanytun.c | |
parent | added empty tun.c and h (diff) |
added first version of tun device (needs furhter testing)
Diffstat (limited to 'src/uanytun.c')
-rw-r--r-- | src/uanytun.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/uanytun.c b/src/uanytun.c index 162ad5d..82085b4 100644 --- a/src/uanytun.c +++ b/src/uanytun.c @@ -47,11 +47,24 @@ int main(int argc, char* argv[]) signal_init(); // chrootAndDrop("/var/run/", "nobody"); - daemonize(); - log_printf(INFO, "running in background now"); +// daemonize(); +// log_printf(INFO, "running in background now"); + + tun_device_t* dev; + tun_init(&dev, "tun0", "tun", "192.168.23.1", "192.168.23.2"); + if(!dev) { + log_printf(ERR, "error on tun_init"); + exit -1; + } + log_printf(INFO, "entering main loop"); - while(1) sleep(1); + u_int8_t buf[1600]; + int len = 0; + while(1) { + len = tun_read(dev, buf, 1600); + printf("read %d bytes from device\n", len); + } } |