git://git.onelab.eu
/
vsys-scripts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2dcbc9c
)
Create tun devices in addition to tap devices
author
Sapan Bhatia
<gwsapan@gmail.com>
Thu, 2 Sep 2010 20:07:49 +0000
(16:07 -0400)
committer
Sapan Bhatia
<gwsapan@gmail.com>
Thu, 2 Sep 2010 20:07:49 +0000
(16:07 -0400)
support/tap_test.c
[new file with mode: 0644]
patch
|
blob
diff --git a/support/tap_test.c
b/support/tap_test.c
new file mode 100644
(file)
index 0000000..
947019f
--- /dev/null
+++ b/
support/tap_test.c
@@ -0,0
+1,26
@@
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <linux/if.h>
+#include <linux/if_tun.h>
+
+#include "tunalloc.h"
+
+int main(void)
+{
+ printf("Allocating tap device via VSYS\n");
+
+ char if_name[IFNAMSIZ];
+
+ int tun_fd = tun_alloc(IFF_TAP, if_name);
+
+ printf("Allocated tap device: %s fd=%d\n", if_name, tun_fd);
+
+ printf("Sleeping for 120 secs...\n");
+
+ sleep(120);
+
+ printf("Closing\n");
+
+ return 0;
+}