msg.msg_flags = 0;
/* Send the interface name as the iov */
- vec.iov_base = &vif_name;
+ vec.iov_base = vif_name;
vec.iov_len = strlen(vif_name)+1;
while ((retval = sendmsg(sock_fd, &msg, 0)) == -1 && errno == EINTR);
}
/* Open tun device */
- if( (tap_fd = open("/dev/stdtun", O_RDWR)) < 0 ) {
- perror("ERROR: tun_alloc():open(/dev/stdtun)");
- exit(-1);
+ if( (tap_fd = open("/dev/net/tun", O_RDWR)) < 0 ) {
+ system("modprobe tun");
+ system("ln -sf /dev/net/tun /dev/stdtun");
+ if( (tap_fd = open("/dev/net/tun", O_RDWR)) < 0 ) {
+ perror("ERROR: tun_alloc():open(/dev/net/tun)");
+ exit(-1);
+ }
}
/* Send tap_fd to slice */
- //send_vif_fd(control_channel_fd, tap_fd, if_name);
+ send_vif_fd(control_channel_fd, tap_fd, if_name);
return 0;
}