Skip to contentSkip to conversation

Remove support for Linux 2.2 configuration fallback

PATCH In review David Sommerseth 3 participants 4 messages Jun 3, 2011 – Jun 4, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove support for Linux 2.2 configuration fallback

When configuring OpenVPN nowadays, the TUN/TAP configuration can sometimes jump into the Linux 2.2 fallback code paths, which will also fails. The reason it jumps into fallback mode is that the tun/tap device already exists or that /dev/net/tun does not exist. This can be very confusing, as /dev/tunX which the fallback mode tries to use, does not exist on Linux 2.4 and newer.

Considering that the last Linux 2.2 update was released 25-Feb-2004 and the first Linux 2.4 release came 04-Jan-2001, there are no reasonable reasons to help users to stay on outdated kernels. I consider this extra code path just waste of bytes ... so lets make the world simpler.

---
 openvpn.8 |   10 +---------
 tun.c     |   13 ++-----------
 2 files changed, 3 insertions(+), 20 deletions(-)
openvpn.8 +1 -9
index 5cbf4c5..b6ea9e4 100644
@@ -5747,11 +5747,6 @@ Make device:
 
 Load driver:
 .B modprobe tun
-
-If you have Linux 2.2 or earlier, you should obtain version 1.1 of the
-TUN/TAP driver from
-.I http://vtun.sourceforge.net/tun/
-and follow the installation instructions.
 .\"*********************************************************
 .SH EXAMPLES
 Prior to running these examples, you should have OpenVPN installed on two
@@ -5772,10 +5767,7 @@ If you installed from RPM, the
 .B mknod
 step may be omitted, because the RPM install does that for you.
 
-If you have Linux 2.2, you should obtain version 1.1 of the
-TUN/TAP driver from
-.I http://vtun.sourceforge.net/tun/
-and follow the installation instructions.
+Only Linux 2.4 and newer are supported.
 
 For other platforms, consult the INSTALL file at
 .I http://openvpn.net/install.html
tun.c +2 -11
index 8cdd248..1abcf6d 100644
@@ -1369,7 +1369,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
       if ((tt->fd = open (node, O_RDWR)) < 0)
 	{
 	  msg (M_WARN | M_ERRNO, "Note: Cannot open TUN/TAP dev %s", node);
-	  goto linux_2_2_fallback;
+	  return;
 	}
 
       /*
@@ -1413,7 +1413,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
       if (ioctl (tt->fd, TUNSETIFF, (void *) &ifr) < 0)
 	{
 	  msg (M_WARN | M_ERRNO, "Note: Cannot ioctl TUNSETIFF %s", dev);
-	  goto linux_2_2_fallback;
+	  return;
 	}
 
       msg (M_INFO, "TUN/TAP device %s opened", ifr.ifr_name);
@@ -1449,15 +1449,6 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
       tt->actual_name = string_alloc (ifr.ifr_name, NULL);
     }
   return;
-
- linux_2_2_fallback:
-  msg (M_INFO, "Note: Attempting fallback to kernel 2.2 TUN/TAP interface");
-  if (tt->fd >= 0)
-    {
-      close (tt->fd);
-      tt->fd = -1;
-    }
-  open_tun_generic (dev, dev_type, dev_node, false, true, tt);
 }
 
 #else
Signature · 1 line
1.7.4.4
#1 lore raw

Hi,

Quoted 5 lines · David Sommerseth

Considering that the last Linux 2.2 update was released 25-Feb-2004 and the first Linux 2.4 release came 04-Jan-2001, there are no reasonable reasons to help users to stay on outdated kernels. I consider this extra code path just waste of bytes ... so lets make the world simpler.

Basically, I agree on the idea, but I think there's more that should be thrown out...

#if defined(TARGET_LINUX)

#ifdef HAVE_LINUX_IF_TUN_H /* New driver support */

...

#else

void
open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu ntap *tt)
{
open_tun_generic (dev, dev_type, dev_node, false, true, tt);
}

#endif /* HAVE_LINUX_IF_TUN_H */

...

/*
* This can be removed in future
* when all systems will use newer
* linux-headers
*/
#ifndef TUNSETOWNER
#define TUNSETOWNER _IOW('T', 204, int)
#endif
#ifndef TUNSETGROUP
#define TUNSETGROUP _IOW('T', 206, int)
#endif

and of course...

#if LINUX_IPV6 == 0
if ( tt->ipv6 )
msg (M_WARN, "NOTE: explicit support for IPv6 tun devices is not provided fo
r this OS");
#endif

... so: consider this an ACK, but there's more to do :-)

Now, what did we agree was the oldest linux distribution that we wanted to support? Need to setup a VM with that, and then rip out stuff, and verify that things still compile, ...

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 46 lines · Gert Doering

Hi,

Quoted 5 lines · David Sommerseth

Considering that the last Linux 2.2 update was released 25-Feb-2004 and the first Linux 2.4 release came 04-Jan-2001, there are no reasonable reasons to help users to stay on outdated kernels. I consider this extra code path just waste of bytes ... so lets make the world simpler.

Basically, I agree on the idea, but I think there's more that should be thrown out...

#if defined(TARGET_LINUX)

#ifdef HAVE_LINUX_IF_TUN_H /* New driver support */

...

#else

void
open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu ntap *tt)
{
open_tun_generic (dev, dev_type, dev_node, false, true, tt);
}

#endif /* HAVE_LINUX_IF_TUN_H */

...

/*
* This can be removed in future
* when all systems will use newer
* linux-headers
*/
#ifndef TUNSETOWNER
#define TUNSETOWNER _IOW('T', 204, int)
#endif
#ifndef TUNSETGROUP
#define TUNSETGROUP _IOW('T', 206, int)
#endif

and of course...

Quoted 8 lines

#if LINUX_IPV6 == 0
if ( tt->ipv6 )
msg (M_WARN, "NOTE: explicit support for IPv6 tun devices is not provided fo
r this OS");
#endif

... so: consider this an ACK, but there's more to do :-)

Thanks! Yeah, this is just something I stumbled upon lately, but I saw that there are more stuff which can be cleaned up! I just take some smaller steps :) More to come when I got more time to look at it :)

Quoted 3 lines

Now, what did we agree was the oldest linux distribution that we wanted to support? Need to setup a VM with that, and then rip out stuff, and verify that things still compile, ...

I think James once said Red Hat Enterprise Linux 4.6. However, the officially supported RHEL4 release is to my knowledge 4.9. That's based on a Linux 2.6.9 kernel, iirc.

Kind regards,

David Sommerseth

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk3pI78ACgkQDC186MBRfroA8QCgiA23jM9MX7PGs4Y9IZ+Ml7cD zp8AniNMOSLMVYBb/SBfA0+GVEvqBSaR
=hEeB
-----END PGP SIGNATURE-----

#3 lore raw

Hi,

Quoted 2 lines · David Sommerseth

Thanks! Yeah, this is just something I stumbled upon lately, but I saw that there are more stuff which can be cleaned up!

Indeed. I think this is actually something for the rest of the v2.3 preparation time... cleaning up plattform after plattform. With the t_client test frame work, and Samuli's build cluster, we can be reasonably sure that things still work...

[..]

Quoted 3 lines

I think James once said Red Hat Enterprise Linux 4.6. However, the officially supported RHEL4 release is to my knowledge 4.9. That's based on a Linux 2.6.9 kernel, iirc.

I think it would be useful to have RHEL4 buildslave - so we can see right away if we break that system. Even older systems would then have to be fixed on-demand if really needed...

Even the embedded world (OpenWRT) moved to 2.6 a while ago :-)

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...