947019f0467168d8568432475423ec483a97a2fc
[vsys-scripts.git] / support / tap_test.c
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <sys/socket.h>
4 #include <linux/if.h>
5 #include <linux/if_tun.h>
6
7 #include "tunalloc.h"
8
9 int main(void)
10 {
11     printf("Allocating tap device via VSYS\n");
12
13     char if_name[IFNAMSIZ];
14
15     int tun_fd = tun_alloc(IFF_TAP, if_name);
16
17     printf("Allocated tap device: %s fd=%d\n", if_name, tun_fd);
18
19     printf("Sleeping for 120 secs...\n");
20
21     sleep(120);
22
23     printf("Closing\n");
24
25     return 0;
26 }