summaryrefslogtreecommitdiff
path: root/src/uanytun.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2008-12-27 15:20:28 +0000
committerChristian Pointner <equinox@anytun.org>2008-12-27 15:20:28 +0000
commit3f9fa03e027ef6db9ae7f8f5815a16e6ad6dd66c (patch)
treee98d80378768c33531b1eab71c14a185b940e0b9 /src/uanytun.c
parentadded 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.c19
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);
+ }
}