summaryrefslogtreecommitdiff
path: root/tunDevice.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2007-06-19 14:33:25 +0000
committerChristian Pointner <equinox@anytun.org>2007-06-19 14:33:25 +0000
commitccc883ebacf9d016c5f4e2bfec1c0e493bba9793 (patch)
treea7657e0d9215443cd1870380a114290d53c20023 /tunDevice.cpp
parentyet another clean of main (diff)
read on tunDevice works now
Diffstat (limited to 'tunDevice.cpp')
-rw-r--r--tunDevice.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/tunDevice.cpp b/tunDevice.cpp
index 0f17fb7..84b6964 100644
--- a/tunDevice.cpp
+++ b/tunDevice.cpp
@@ -92,7 +92,10 @@ TunDevice::TunDevice(const char* dev_name, const char* ifcfg_lp, const char* ifc
// rp = inet_addr("192.168.199.1");
dev_ = init_tun(dev_name, NULL, ifcfg_lp, ifcfg_rnmp, lp, rp, 0, NULL);
- //init_tun_post(dev_, NULL, NULL);
+ struct frame frame; // just for win32
+ struct tuntap_options options; // win32 & linux
+ options.txqueuelen = 100; // just for linux
+ init_tun_post(dev_, &frame, &options);
if(!dev_)
throw std::runtime_error("can't init tun/tap device");
@@ -113,10 +116,10 @@ short TunDevice::read(Buffer& buf)
struct pollfd pfd[1];
pfd[0].fd = tun_event_handle(dev_);
-// pfd[0].events = POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI | POLLOUT | POLLWRNORM | POLLWRBAND | POLLERR | POLLHUP | POLLNVAL;
- pfd[0].events = POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI;
+ pfd[0].events = POLLIN | POLLPRI;
+ pfd[0].revents = 0;
poll(pfd, 1, -1);
- return pfd[0].revents;//read_tun(dev_, buf, buf.getLength());
+ return read_tun(dev_, buf, buf.getLength());
}
int TunDevice::write(Buffer& buf)