Commit 539fba12 authored by Mattia Dongili's avatar Mattia Dongili

Added support to open TUN devices in TUN mode instead of just TAP.

Thanks to Nathaniel Wesley Filardo <nwf@cs.jhu.edu>.
Signed-off-by: 's avatarMattia Dongili <malattia@linux.it>
parent 77429daf
uml-utilities (20070815.1-2) UNRELEASED; urgency=medium
uml-utilities (20070815.1-1) unstable; urgency=low
* Bump compat level to latest. (Closes: #817708)
* Stop setting permissions on /dev/net/tun. (Closes: #516691, #760425)
......@@ -6,8 +6,10 @@ uml-utilities (20070815.1-2) UNRELEASED; urgency=medium
garbage like a .pc directory that confuses dpkg-source.
* Added support for "status" action to init script. Thanks Peter Eisentraut
<petere@debian.org>. (Closes: #646879)
* Added support to open TUN devices in TUN mode instead of just TAP. Thanks
to Nathaniel Wesley Filardo <nwf@cs.jhu.edu>. (Closes: #462922)
-- Mattia Dongili <malattia@debian.org> Wed, 13 Jul 2016 22:49:08 -0700
-- Mattia Dongili <malattia@debian.org> Wed, 13 Jul 2016 23:03:09 -0700
uml-utilities (20070815-1.4) unstable; urgency=low
......
Author: nwf
Description: Allow creation of IFF_TUN devices
Index: uml-utilities/tunctl/tunctl.c
===================================================================
--- uml-utilities.orig/tunctl/tunctl.c
+++ uml-utilities/tunctl/tunctl.c
@@ -28,6 +28,7 @@ static void Usage(char *name)
fprintf(stderr, "The default tun clone device is /dev/net/tun - some systems"
" use\n/dev/misc/net/tun instead\n\n");
fprintf(stderr, "-b will result in brief output (just the device name)\n");
+ fprintf(stderr, "-3 will open the interface in TUN mode, not TAP mode.\n");
exit(1);
}
@@ -38,10 +39,10 @@ int main(int argc, char **argv)
struct group *gr;
uid_t owner = -1;
gid_t group = -1;
- int tap_fd, opt, delete = 0, brief = 0;
+ int tap_fd, opt, delete = 0, brief = 0, tun_mode = 0;
char *tun = "", *file = "/dev/net/tun", *name = argv[0], *end;
- while((opt = getopt(argc, argv, "bd:f:t:u:g:")) > 0){
+ while((opt = getopt(argc, argv, "3bd:f:t:u:g:")) > 0){
switch(opt) {
case 'b':
brief = 1;
@@ -83,6 +84,9 @@ int main(int argc, char **argv)
case 't':
tun = optarg;
break;
+ case '3':
+ tun_mode = 1;
+ break;
case 'h':
default:
Usage(name);
@@ -102,8 +106,7 @@ int main(int argc, char **argv)
}
memset(&ifr, 0, sizeof(ifr));
-
- ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
+ ifr.ifr_flags = (tun_mode ? IFF_TUN : IFF_TAP) | IFF_NO_PI;
strncpy(ifr.ifr_name, tun, sizeof(ifr.ifr_name) - 1);
if(ioctl(tap_fd, TUNSETIFF, (void *) &ifr) < 0){
perror("TUNSETIFF");
leave_uml_util.spec.alone.patch
dont_link_against_ncurses.patch
add_tun_mode_to_tunctl.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment