Commit c4ee0fee authored by Manni's avatar Manni

fix

parent d43161dd
......@@ -49,8 +49,17 @@ int main(int argc, char *argv[]) {
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
auto raw = socket(AF_INET, SOCK_RAW, IPPROTO_IPIP);
if(raw < 0){
perror("socket init error");
}
auto tun = open("/dev/net/tun", O_RDWR);
ioctl(tun, TUNSETIFF, &ifr);
if(tun < 0){
perror("tun init error");
}
if(ioctl(tun, TUNSETIFF, &ifr) < 0){
perror("ioctl error");
}
remote = inet_addr(argv[1]);
......@@ -61,4 +70,4 @@ int main(int argc, char *argv[]) {
std::thread t2(outbound, raw, tun);
t1.join();
t2.join();
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment