summaryrefslogtreecommitdiff
path: root/src/uanytun.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2008-12-27 17:27:45 +0000
committerChristian Pointner <equinox@anytun.org>2008-12-27 17:27:45 +0000
commitc930c97326d576f13a52dc3a4595d99fac1ed2e7 (patch)
tree2ce2f896827631a1657b1c89945ce0ddd1d9027e /src/uanytun.c
parentfixed some memory errors at tun device (diff)
some more memory erros @ tun device fixed
added exec script for post up scripts
Diffstat (limited to 'src/uanytun.c')
-rw-r--r--src/uanytun.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/uanytun.c b/src/uanytun.c
index fca5e40..ffdfdf3 100644
--- a/src/uanytun.c
+++ b/src/uanytun.c
@@ -36,11 +36,12 @@
#include <stdio.h>
#include "log.h"
-#include "daemon.h"
#include "signal.h"
-
#include "tun.h"
+#include "daemon.h"
+#include "sysexec.h"
+
int main(int argc, char* argv[])
{
log_init("uanytun", DAEMON);
@@ -51,25 +52,26 @@ int main(int argc, char* argv[])
// log_printf(INFO, "running in background now");
tun_device_t* dev;
- tun_init(&dev, "tun0", "tun", "192.168.23.1", "192.168.23.2");
+ tun_init(&dev, NULL, "tun", "192.168.23.1", "192.168.23.2");
if(!dev) {
log_printf(ERR, "error on tun_init");
- exit -1;
+ exit(-1);
}
+/* int ret = exec_script("post-up.sh", dev->actual_name_); */
+/* log_printf(NOTICE, "post-up script returned %d", ret); */
log_printf(INFO, "entering main loop");
u_int8_t buf[1600];
int len = 0;
unsigned int cnt = 0;
- while(cnt < 10) {
+ while(cnt < 5) {
len = tun_read(dev, buf, 1600);
printf("read %d bytes from device\n", len);
+// tun_write(dev, buf, len);
cnt++;
}
tun_close(&dev);
return 0;
}
-
-