From: Sapan Bhatia Date: Thu, 2 Sep 2010 20:07:49 +0000 (-0400) Subject: Create tun devices in addition to tap devices X-Git-Tag: vsys-scripts-0.95-21~4 X-Git-Url: http://git.onelab.eu/?p=vsys-scripts.git;a=commitdiff_plain;h=303a6f2294ef018acfa08ac2737bea7b4f865e7b Create tun devices in addition to tap devices --- diff --git a/support/tap_test.c b/support/tap_test.c new file mode 100644 index 0000000..947019f --- /dev/null +++ b/support/tap_test.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include + +#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; +}