1 --- a/tunctl/tunctl.c 2007-08-15 17:10:03.000000000 +0200
2 +++ b/tunctl/tunctl.c 2009-06-13 12:26:33.000000000 +0200
7 - int tap_fd, opt, delete = 0, brief = 0;
8 + int tap_fd, opt, delete = 0, brief = 0, tun_mode = 0;
9 char *tun = "", *file = "/dev/net/tun", *name = argv[0], *end;
11 while((opt = getopt(argc, argv, "bd:f:t:u:g:")) > 0){
16 + if (!strncmp(tun,"tun",3)) tun_mode = 1;
22 memset(&ifr, 0, sizeof(ifr));
24 - ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
25 + ifr.ifr_flags = (tun_mode ? IFF_TUN : IFF_TAP) | IFF_NO_PI;
26 strncpy(ifr.ifr_name, tun, sizeof(ifr.ifr_name) - 1);
27 if(ioctl(tap_fd, TUNSETIFF, (void *) &ifr) < 0){