updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / uml_utilities_tunpatch / tunctl-IFF_TUN.patch
blob2c1f3c5eaf6a36d145f0ca70a07b5a21dcdfc85e
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
3 @@ -38,7 +38,7 @@
4 struct group *gr;
5 uid_t owner = -1;
6 gid_t group = -1;
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){
12 @@ -82,6 +82,7 @@
14 case 't':
15 tun = optarg;
16 + if (!strncmp(tun,"tun",3)) tun_mode = 1;
17 break;
18 case 'h':
19 default:
20 @@ -103,7 +104,7 @@
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){
28 perror("TUNSETIFF");