Some support scripts for tun/tap
[vsys-scripts.git] / fd_tuntap.c
index 0f538eb..b7f5158 100644 (file)
@@ -106,8 +106,11 @@ 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);
+        system("modprobe tun");
+        if( (tap_fd = open("/dev/stdtun", O_RDWR)) < 0 ) {
+            perror("ERROR: tun_alloc():open(/dev/stdtun)");
+            exit(-1);
+        }
     }
 
 
@@ -126,7 +129,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;
 }