X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fd_tuntap.c;h=ddcd431a300da20c90cb39e3cfa1d11b51426e05;hb=bf6948cbaf9fd4e1bf94ced5c3dafa9e9d9a6dd0;hp=0f538eb7d9dca8952fe994ba96ca92e40efbbc29;hpb=734018b3473b516452c1302607b198bb0ab5aa1d;p=vsys-scripts.git diff --git a/fd_tuntap.c b/fd_tuntap.c index 0f538eb..ddcd431 100644 --- a/fd_tuntap.c +++ b/fd_tuntap.c @@ -45,7 +45,7 @@ int send_vif_fd(int sock_fd, int vif_fd, char *vif_name) 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); @@ -105,9 +105,13 @@ int main(int argc, char *argv[]) } /* 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); + } } @@ -126,7 +130,7 @@ int main(int argc, char *argv[]) /* 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; }