Skip to contentSkip to conversation

Presume that Linux is always IPv6 capable at build time

PATCH NAK David Sommerseth 5 participants 19 messages Apr 26, 2012 – Apr 27, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Presume that Linux is always IPv6 capable at build time

These days it is highly unlikely that OpenVPN will be built in a non-IPv6 capable Linux environment. So remove compile-time related macros identifying that.

This also solves an issue which was introduced in commit 51bd56f46f55177cf0f8b where HAVE_TUN_PI and HAVE_IPHDR is no longer detected. As these macros where only used to detect if IPv6 support was available on Linux, it makes no sense looking for them any more.

---
 configure.ac      |   13 -------------
 src/openvpn/tun.c |   19 -------------------
 2 files changed, 0 insertions(+), 32 deletions(-)
configure.ac +0 -13
index e962323..4286866 100644
@@ -404,7 +404,6 @@ AC_CHECK_HEADERS(
 	,
 	[[${SOCKET_INCLUDES}]]
 )
-
 AC_CHECK_TYPES(
 	[in_addr_t],
 	,
@@ -412,18 +411,6 @@ AC_CHECK_TYPES(
 	[[${SOCKET_INCLUDES}]]
 )
 AC_CHECK_TYPE(
-	[struct tun_pi],
-	[AC_DEFINE(HAVE_TUN_PI, 1, [struct tun_pi needed for IPv6 support])],
-	,
-	[[${SOCKET_INCLUDES}]]
-)
-AC_CHECK_TYPE(
-	[struct iphdr],
-	[AC_DEFINE(HAVE_IPHDR, 1, [struct iphdr needed for IPv6 support])],
-	,
-	[[${SOCKET_INCLUDES}]]
-)
-AC_CHECK_TYPE(
 	[struct sock_extended_err],
 	[AC_DEFINE(HAVE_SOCK_EXTENDED_ERR, 1, [struct sock_extended_err needed for extended socket error support])],
 	,
src/openvpn/tun.c +0 -19
index b99071c..63e6f77 100644
@@ -1373,14 +1373,6 @@ close_tun_generic (struct tuntap *tt)
 #error header file linux/sockios.h required
 #endif
 
-#if defined(HAVE_TUN_PI) && defined(HAVE_IPHDR) && defined(HAVE_IOVEC) && defined(ETH_P_IPV6) && defined(ETH_P_IP) && defined(HAVE_READV) && defined(HAVE_WRITEV)
-#define LINUX_IPV6 1
-/* #warning IPv6 ON */
-#else
-#define LINUX_IPV6 0
-/* #warning IPv6 OFF */
-#endif
-
 #if !PEDANTIC
 
 void
@@ -1388,13 +1380,6 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
 {
   struct ifreq ifr;
 
-  /* warn if a very old linux version is used & --tun-ipv6 set
-   */
-#if LINUX_IPV6 == 0
-  if ( tt->ipv6 )
-    msg (M_WARN, "NOTE: explicit support for IPv6 tun devices is not provided for this OS");
-#endif
-
   /*
    * We handle --dev null specially, we do not open /dev/null for this.
    */
@@ -1623,7 +1608,6 @@ close_tun (struct tuntap *tt)
 int
 write_tun (struct tuntap* tt, uint8_t *buf, int len)
 {
-#if LINUX_IPV6
   if (tt->ipv6)
     {
       struct tun_pi pi;
@@ -1649,14 +1633,12 @@ write_tun (struct tuntap* tt, uint8_t *buf, int len)
       return(ret - sizeof(pi));
     }
   else
-#endif
     return write (tt->fd, buf, len);
 }
 
 int
 read_tun (struct tuntap* tt, uint8_t *buf, int len)
 {
-#if LINUX_IPV6
   if (tt->ipv6)
     {
       struct iovec vect[2];
@@ -1672,7 +1654,6 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len)
       return(ret - sizeof(pi));
     }
   else
-#endif
     return read (tt->fd, buf, len);
 }
 
Signature · 1 line
1.7.4.4
#1 lore raw

Hi,

Quoted 8 lines · David Sommerseth

These days it is highly unlikely that OpenVPN will be built in a non-IPv6 capable Linux environment. So remove compile-time related macros identifying that.

This also solves an issue which was introduced in commit 51bd56f46f55177cf0f8b where HAVE_TUN_PI and HAVE_IPHDR is no longer detected. As these macros where only used to detect if IPv6 support was available on Linux, it makes no sense looking for them any more.

ACK. What he said.

(I'm don't particularily insist on the configure.ac change if that turns out to be controversial - but the tun.c change really removes old cruft that should have gone away years 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]...
#2 lore raw
In reply to David Sommerseth

Hi David,

2012/4/26 David Sommerseth <[email protected]...>:

Quoted 2 lines

These days it is highly unlikely that OpenVPN will be built in a non-IPv6 capable Linux environment.

Agreed.

Quoted 4 lines

This also solves an issue which was introduced in commit 51bd56f46f55177cf0f8b where HAVE_TUN_PI and HAVE_IPHDR is no longer detected.  As these macros where only used to detect if IPv6 support was available on Linux, it makes no sense looking for them any more.

Gert appears to be happy, so I'm happy, but I don't quite understand what you're saying here. What part broke? HAVE_TUN_PI and HAVE_IPHDR aren't always detected although they should be? Or the failed detection affects non-Linux systems? Something else? Just curious ...

Cheers
Fabian

#3 lore raw

Hi,

Quoted 4 lines · Fabian Knittel

Gert appears to be happy, so I'm happy, but I don't quite understand what you're saying here. What part broke? HAVE_TUN_PI and HAVE_IPHDR aren't always detected although they should be? Or the failed detection affects non-Linux systems? Something else? Just curious ...

The actual problem was that the failed detection led to LINUX_IPV6 being set to "0", which in turn led to IPv6 failure on tun interfaces (due to not taking the extra header bytes on the tun interface into account).

Since this is all legacy stuff anyway, throwing out the #ifdef's and the detection logic (for stuff we know that *has* to be there on any Linux version we support) is much easier than trying to make it work.

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]...
#4 lore raw
In reply to David Sommerseth

I plan to add --enable-ipv6/--disable-ipv6 to explicit support ipv6. This is part of syshead fixups.
Cleaning a lot of code of autoconf auto detection of socket functions.

Quoted 124 lines · David Sommerseth

These days it is highly unlikely that OpenVPN will be built in a non-IPv6 capable Linux environment.  So remove compile-time related macros identifying that.

This also solves an issue which was introduced in commit 51bd56f46f55177cf0f8b where HAVE_TUN_PI and HAVE_IPHDR is no longer detected.  As these macros where only used to detect if IPv6 support was available on Linux, it makes no sense looking for them any more.

---
 configure.ac      |   13 -------------
 src/openvpn/tun.c |   19 -------------------

 2 files changed, 0 insertions(+), 32 deletions(-)
configure.ac +0 -0
index e962323..4286866 100644
@@ -404,7 +404,6 @@ AC_CHECK_HEADERS(
        ,

       [[${SOCKET_INCLUDES}]]
 )
-
 AC_CHECK_TYPES(
       [in_addr_t],
       ,

configure.ac +0 -0
@@ -412,18 +411,6 @@ AC_CHECK_TYPES(

       [[${SOCKET_INCLUDES}]]
 )
 AC_CHECK_TYPE(
-       [struct tun_pi],
-       [AC_DEFINE(HAVE_TUN_PI, 1, [struct tun_pi needed for IPv6 support])],
-       ,
-       [[${SOCKET_INCLUDES}]]

configure.ac +0 -8
-)
-AC_CHECK_TYPE(
-       [struct iphdr],
-       [AC_DEFINE(HAVE_IPHDR, 1, [struct iphdr needed for IPv6 support])],
-       ,
-       [[${SOCKET_INCLUDES}]]
-)
-AC_CHECK_TYPE(

       [struct sock_extended_err],
       [AC_DEFINE(HAVE_SOCK_EXTENDED_ERR, 1, [struct sock_extended_err needed for extended socket error support])], ,

src/openvpn/tun.c +0 -8
index b99071c..63e6f77 100644
@@ -1373,14 +1373,6 @@ close_tun_generic (struct tuntap *tt)
  #error header file linux/sockios.h required
  #endif
 
-#if defined(HAVE_TUN_PI) && defined(HAVE_IPHDR) && defined(HAVE_IOVEC) && defined(ETH_P_IPV6) && defined(ETH_P_IP) && defined(HAVE_READV) && defined(HAVE_WRITEV)
-#define LINUX_IPV6 1
-/* #warning IPv6 ON */
-#else
-#define LINUX_IPV6 0
-/* #warning IPv6 OFF */
-#endif
-
  #if !PEDANTIC
 

 void

src/openvpn/tun.c +0 -7
@@ -1388,13 +1380,6 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
  {
   struct ifreq ifr;
 
-  /* warn if a very old linux version is used & --tun-ipv6 set
-   */
-#if LINUX_IPV6 == 0
-  if ( tt->ipv6 )
-    msg (M_WARN, "NOTE: explicit support for IPv6 tun devices is not provided for this OS");
-#endif
-
   /*
    * We handle --dev null specially, we do not open /dev/null for this.
    */
@@ -1623,7 +1608,6 @@ close_tun (struct tuntap *tt)

 int
 write_tun (struct tuntap* tt, uint8_t *buf, int len) {
-#if LINUX_IPV6
  if (tt->ipv6)
    {
      struct tun_pi pi;

src/openvpn/tun.c +0 -0
@@ -1649,14 +1633,12 @@ write_tun (struct tuntap* tt, uint8_t *buf, int len)
       return(ret - sizeof(pi));
     }

  else
-#endif
    return write (tt->fd, buf, len);
 }

 int
 read_tun (struct tuntap* tt, uint8_t *buf, int len) {
-#if LINUX_IPV6
  if (tt->ipv6)
    {
      struct iovec vect[2];

src/openvpn/tun.c +0 -0
@@ -1672,7 +1654,6 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len)
       return(ret - sizeof(pi));
     }

  else
-#endif
    return read (tt->fd, buf, len);
 }

--
1.7.4.4

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#5 lore raw

Hi,

Quoted 1 line · Alon Bar-Lev

I plan to add --enable-ipv6/--disable-ipv6 to explicit support ipv6.

NAK.

We considered this, and this will add a shitload of #ifdefs which will make maintenance of the code a lot harder.

(We actually *removed* all the #ifdefs of JJO's IPv6 transport code, because it really hurt)

We're in the year 2012, there are no operating systems without IPv6 support anymore, and it does not make sense to have a VPN implementation that has no IPv6 support.

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]...
#6 lore raw

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

Quoted 11 lines · Gert Doering

Hi,

Quoted 2 lines · Alon Bar-Lev

I plan to add --enable-ipv6/--disable-ipv6 to explicit support ipv6.

NAK.

We considered this, and this will add a shitload of #ifdefs which will make maintenance of the code a lot harder.

Quoted 6 lines

(We actually *removed* all the #ifdefs of JJO's IPv6 transport code, because it really hurt)

We're in the year 2012, there are no operating systems without IPv6 support anymore, and it does not make sense to have a VPN implementation that has no IPv6 support.

Just for the record, I completely agree with Gert here. Actually we should focus on getting OpenVPN work better in IPv6-only environments
- - but that's probably something for the 2.4 cycle.

kind regards,

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

iEYEARECAAYFAk+ZhqIACgkQDC186MBRfrpv2QCgoc6BtPxufXasfiXS8e2VZFwJ 5bAAn2CrZ4I8HJ+vyc6LI3PMnF2LKJI0
=xyRg
-----END PGP SIGNATURE-----

#7 lore raw
Quoted 15 lines · David Sommerseth
Quoted 14 lines · Gert Doering

Hi,

Quoted 2 lines · Alon Bar-Lev

I plan to add --enable-ipv6/--disable-ipv6 to explicit support ipv6.

NAK.

We considered this, and this will add a shitload of #ifdefs which will make maintenance of the code a lot harder.

(We actually *removed* all the #ifdefs of JJO's IPv6 transport code, because it really hurt)

Quoted 8 lines
Quoted 3 lines

We're in the year 2012, there are no operating systems without IPv6 support anymore, and it does not make sense to have a VPN implementation that has no IPv6 support.

Just for the record, I completely agree with Gert here.  Actually we should focus on getting OpenVPN work better in IPv6-only environments
- - but that's probably something for the 2.4 cycle.

At embedded system and several distros like Gentoo, the ipv6 should be made enable/disabled, just like any other project.
It is the same #ifdef as we already have these in code. Even in 2012 kernels can be compiled without ipv6.

Alon.

#8 lore raw
Quoted 26 lines · Alon Bar-Lev
Quoted 15 lines · David Sommerseth
Quoted 14 lines · Gert Doering

Hi,

Quoted 2 lines · Alon Bar-Lev

I plan to add --enable-ipv6/--disable-ipv6 to explicit support ipv6.

NAK.

We considered this, and this will add a shitload of #ifdefs which will make maintenance of the code a lot harder.

(We actually *removed* all the #ifdefs of JJO's IPv6 transport code, because it really hurt)

Quoted 8 lines
Quoted 3 lines

We're in the year 2012, there are no operating systems without IPv6 support anymore, and it does not make sense to have a VPN implementation that has no IPv6 support.

Just for the record, I completely agree with Gert here.  Actually we should focus on getting OpenVPN work better in IPv6-only environments
- - but that's probably something for the 2.4 cycle.

Quoted 6 lines

At embedded system and several distros like Gentoo, the ipv6 should be made enable/disabled, just like any other project.
It is the same #ifdef as we already have these in code. Even in 2012 kernels can be compiled without ipv6.

Alon.

Just to see other project relevance:
---

# equery hasuse ipv6
 * Searching for USE flag ipv6 ...
[IP-] [  ] app-admin/syslog-ng-3.2.5:0
[IP-] [  ] dev-lang/python-2.7.2-r3:2.7
[IP-] [  ] dev-lang/python-3.2.2:3.2
[IP-] [  ] dev-libs/libxml2-2.7.8-r5:2
[IP-] [  ] mail-mta/ssmtp-2.64-r2:0
[IP-] [  ] media-libs/mediastreamer-2.7.3-r3:0
[IP-] [  ] net-analyzer/net-snmp-5.4.2.1-r4:0
[IP-] [  ] net-analyzer/netcat6-1.0-r2:0
[IP-] [  ] net-analyzer/tcpdump-3.9.8-r1:0
[IP-] [  ] net-analyzer/wireshark-1.6.6:0
[IP-] [  ] net-dialup/ppp-2.4.5-r1:0
[IP-] [  ] net-dns/bind-tools-9.8.1:0
[IP-] [  ] net-dns/dnsmasq-2.57:0
[IP-] [  ] net-firewall/iptables-1.4.12.1:0
[IP-] [  ] net-ftp/ftp-0.17-r7:0
[IP-] [  ] net-libs/libpcap-1.1.1-r1:0
[IP-] [  ] net-libs/ortp-0.16.5:0
[IP-] [  ] net-misc/curl-7.24.0:0
[IP-] [  ] net-misc/iperf-2.0.5:0
[IP-] [  ] net-misc/iputils-20101006-r2:0
[IP-] [  ] net-misc/ntp-4.2.6_p3:0
[IP-] [  ] net-misc/rsync-3.0.9:0
[IP-] [  ] net-misc/wget-1.12-r3:0
[IP-] [  ] net-nds/openldap-2.4.30:0
[IP-] [  ] sys-apps/busybox-1.19.3-r1:0
[IP-] [  ] sys-apps/tcp-wrappers-7.6-r8:0
[IP-] [  ] sys-process/lsof-4.85-r2:0
[IP-] [  ] sys-process/psmisc-22.14:0
[IP-] [  ] x11-apps/xauth-1.0.6:0
[IP-] [  ] x11-apps/xhost-1.0.4:0
[IP-] [  ] x11-base/xorg-server-1.11.2-r2:0
[IP-] [  ] x11-libs/libICE-1.0.7:0
[IP-] [  ] x11-libs/libSM-1.2.0:0
[IP-] [  ] x11-libs/libX11-1.4.4:0
[IP-] [  ] x11-libs/libXfont-1.4.4:0
[IP-] [  ] x11-libs/libXmu-1.1.0:0
---
#9 lore raw
In reply to Alon Bar-Lev

Hi Alon,

2012/4/26 Alon Bar-Lev <[email protected]...>:

Quoted 4 lines

At embedded system and several distros like Gentoo, the ipv6 should be made enable/disabled, just like any other project.
It is the same #ifdef as we already have these in code. Even in 2012 kernels can be compiled without ipv6.

If embedded systems really need to save space, maybe we should make IPv4 optional instead? :)

Cheers
Fabian

#10 lore raw
Quoted 10 lines · Fabian Knittel

Hi Alon,

2012/4/26 Alon Bar-Lev <[email protected]...>:

Quoted 4 lines

At embedded system and several distros like Gentoo, the ipv6 should be made enable/disabled, just like any other project.
It is the same #ifdef as we already have these in code. Even in 2012 kernels can be compiled without ipv6.

If embedded systems really need to save space, maybe we should make IPv4 optional instead? :)

OK :)
Agreed... However, I don't know (yet) software that allow disable ipv4 while enable ipv6... :)
However, enable ipv4 disable ipv6 is something that is doable and common.

Alon.

#11 lore raw
In reply to Alon Bar-Lev

Hi,

Quoted 4 lines · Alon Bar-Lev

At embedded system and several distros like Gentoo, the ipv6 should be made enable/disabled, just like any other project.
It is the same #ifdef as we already have these in code. Even in 2012 kernels can be compiled without ipv6.

Enabling/disabling IPv6 for "just some piece of random code that can open up network sockets" is easy, and usually not even worth the extra lines of code ("just pass different options to getaddrinfo() and/or bind()").

Given the nature of OpenVPN, and that almost everything in the code (except for the crypto stuff) is related to IP packets or IP addresses, it's not that straightforward here.

Adding IPv6 to the OpenVPN code base touched well over 100 different places of the code, and to really make it optional (to get the space saving worth for an embedded system) you'd have to have #ifdef's at all these places, in the config data structures, and so on - this is lots of work, especially maintaining both code paths and testing all this, with dubious benefits. As I said, we got bitten by JJO's decision to make IPv6 transport conditonal, and decided to get *rid* of those #ifdefs for the sake of "less code paths, less maintenance effort".

I'm not sure you can find packages that have had working IPv6 support, and then decided to make it conditional afterwards. Usually IPv6 was added at some point, and it was added conditionalized, because that package can also be compiled on older systems without IPv6 - since we have the luxury of not supporting anything that has no tun/tap interface, we have the same luxury of not having to bother with anything that has no IPv6. (Even if you compile the Linux kernel and glibc without IPv6, the API stuff - getaddrinfo(), inet_ntop(), etc., will still be there, because they are IP version agnostic - they will fail if you actually try to *use* them for IPv6, but you can compile and run the same applications just fine).

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]...
#12 lore raw
Quoted 28 lines · Gert Doering

Hi,

Quoted 4 lines · Alon Bar-Lev

At embedded system and several distros like Gentoo, the ipv6 should be made enable/disabled, just like any other project.
It is the same #ifdef as we already have these in code. Even in 2012 kernels can be compiled without ipv6.

Enabling/disabling IPv6 for "just some piece of random code that can open up network sockets" is easy, and usually not even worth the extra lines of code ("just pass different options to getaddrinfo() and/or bind()").

Given the nature of OpenVPN, and that almost everything in the code (except for the crypto stuff) is related to IP packets or IP addresses, it's not that straightforward here.

Adding IPv6 to the OpenVPN code base touched well over 100 different places of the code, and to really make it optional (to get the space saving worth for an embedded system) you'd have to have #ifdef's at all these places, in the config data structures, and so on - this is lots of work, especially maintaining both code paths and testing all this, with dubious benefits.  As I said, we got bitten by JJO's decision to make IPv6 transport conditonal, and decided to get *rid* of those #ifdefs for the sake of "less code paths, less maintenance effort".

Quoted 12 lines

I'm not sure you can find packages that have had working IPv6 support, and then decided to make it conditional afterwards.  Usually IPv6 was added at some point, and it was added conditionalized, because that package can also be compiled on older systems without IPv6 - since we have the luxury of not supporting anything that has no tun/tap interface, we have the same luxury of not having to bother with anything that has no IPv6.  (Even if you compile the Linux kernel and glibc without IPv6, the API stuff - getaddrinfo(), inet_ntop(), etc., will still be there, because they are IP version agnostic - they will fail if you actually try to *use* them for IPv6, but you can compile and run the same applications just fine).

Right, the ipv6 was added indeed differently, without this conditionals. Because of this I did not perform this task as part of the major build cleanup, and left this for the next phase.
Most of the lowlevel network code already has #ifdefs, I will try my best to find a way to do the conditional without much changes.

Alon.

#13 lore raw

Hi,

Quoted 1 line · Alon Bar-Lev

Right, the ipv6 was added indeed differently, without this conditionals.

You missed the part that JJO's IPv6 code *was* added with conditionals, and that caused problems. We *removed* the conditionals, and the resulting code is easier to maintain now.

Quoted 4 lines

Because of this I did not perform this task as part of the major build cleanup, and left this for the next phase.
Most of the lowlevel network code already has #ifdefs, I will try my best to find a way to do the conditional without much changes.

I don't think that this is a useful way to spend your time.

Nobody has ever asked for it, and I don't see anybody volunteering to maintain the resulting extra complications.

We want to *reduce* the number of #ifdef in the code.

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]...
#14 lore raw
Quoted 14 lines · Gert Doering

Hi,

Quoted 1 line · Alon Bar-Lev

Right, the ipv6 was added indeed differently, without this conditionals.

You missed the part that JJO's IPv6 code *was* added with conditionals, and that caused problems.  We *removed* the conditionals, and the resulting code is easier to maintain now.

Quoted 4 lines

Because of this I did not perform this task as part of the major build cleanup, and left this for the next phase.
Most of the lowlevel network code already has #ifdefs, I will try my best to find a way to do the conditional without much changes.

Quoted 6 lines

I don't think that this is a useful way to spend your time.

Nobody has ever asked for it, and I don't see anybody volunteering to maintain the resulting extra complications.

We want to *reduce* the number of #ifdef in the code.

Not necessary, I would like to make it compatible with other well behaved projects out there.

Alon.

#15 lore raw

Hi,

Quoted 4 lines · Alon Bar-Lev
Quoted 1 line

We want to *reduce* the number of #ifdef in the code.

Not necessary, I would like to make it compatible with other well behaved projects out there.

You are young, and will learn.

"Well behaved projects" are not those that have too many build options.

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]...
#16 lore raw

PATCH 1/1 Clean-up: Presume that Linux is always IPv6 capable at build time

In reply to David Sommerseth

These days it is highly unlikely that OpenVPN will be built in a non-IPv6 capable Linux environment. So remove compile-time related macros identifying that.

This also solves an issue which was introduced in commit 51bd56f46f55177cf0f8b where HAVE_TUN_PI is no longer detected. The tun_pi struct is defined in linux/if_tun.h, which will be checked for later on. As this struct has history in linux/if_tun.h all back to the beginning of the kernel git tree (2.6.12-rc2, April 2005), it is considered not needed to check for this struct explicit.

[ v2: Commit 7c0a2b5f2b4409 modifies some of the checks this patch touches. This
patch just adopts to those changes ]

---
 configure.ac      |    6 ------
 src/openvpn/tun.c |   19 -------------------
 2 files changed, 0 insertions(+), 25 deletions(-)
configure.ac +0 -6
index 8ac5ac4..e808cb4 100644
@@ -415,12 +415,6 @@ AC_CHECK_TYPES(
 	[[${SOCKET_INCLUDES}]]
 )
 AC_CHECK_TYPE(
-	[struct tun_pi],
-	[AC_DEFINE([HAVE_TUN_PI], [1], [struct tun_pi needed for IPv6 support])],
-	,
-	[[${SOCKET_INCLUDES}]]
-)
-AC_CHECK_TYPE(
 	[struct iphdr],
 	[AC_DEFINE([HAVE_IPHDR], [1], [struct iphdr needed for IPv6 support])],
 	,
src/openvpn/tun.c +0 -19
index 227bfde..633150f 100644
@@ -1373,14 +1373,6 @@ close_tun_generic (struct tuntap *tt)
 #error header file linux/sockios.h required
 #endif
 
-#if defined(HAVE_TUN_PI) && defined(HAVE_IPHDR) && defined(HAVE_IOVEC) && defined(ETH_P_IPV6) && defined(ETH_P_IP) && defined(HAVE_READV) && defined(HAVE_WRITEV)
-#define LINUX_IPV6 1
-/* #warning IPv6 ON */
-#else
-#define LINUX_IPV6 0
-/* #warning IPv6 OFF */
-#endif
-
 #if !PEDANTIC
 
 void
@@ -1388,13 +1380,6 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
 {
   struct ifreq ifr;
 
-  /* warn if a very old linux version is used & --tun-ipv6 set
-   */
-#if LINUX_IPV6 == 0
-  if ( tt->ipv6 )
-    msg (M_WARN, "NOTE: explicit support for IPv6 tun devices is not provided for this OS");
-#endif
-
   /*
    * We handle --dev null specially, we do not open /dev/null for this.
    */
@@ -1623,7 +1608,6 @@ close_tun (struct tuntap *tt)
 int
 write_tun (struct tuntap* tt, uint8_t *buf, int len)
 {
-#if LINUX_IPV6
   if (tt->ipv6)
     {
       struct tun_pi pi;
@@ -1649,14 +1633,12 @@ write_tun (struct tuntap* tt, uint8_t *buf, int len)
       return(ret - sizeof(pi));
     }
   else
-#endif
     return write (tt->fd, buf, len);
 }
 
 int
 read_tun (struct tuntap* tt, uint8_t *buf, int len)
 {
-#if LINUX_IPV6
   if (tt->ipv6)
     {
       struct iovec vect[2];
@@ -1672,7 +1654,6 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len)
       return(ret - sizeof(pi));
     }
   else
-#endif
     return read (tt->fd, buf, len);
 }
 
Signature · 1 line
1.7.4.4
#17 lore raw

Re: [Openvpn-devel] [PATCH] Clean-up: Presume that Linux is always IPv6 capable at build time

ACK (regardless my disable-ipv6 plans :) )

Quoted 114 lines · David Sommerseth

These days it is highly unlikely that OpenVPN will be built in a non-IPv6 capable Linux environment.  So remove compile-time related macros identifying that.

This also solves an issue which was introduced in commit 51bd56f46f55177cf0f8b where HAVE_TUN_PI is no longer detected.  The tun_pi struct is defined in linux/if_tun.h, which will be checked for later on.  As this struct has history in linux/if_tun.h all back to the beginning of the kernel git tree (2.6.12-rc2, April 2005), it is considered not needed to check for this struct explicit.

[ v2: Commit 7c0a2b5f2b4409 modifies some of the checks this patch touches.  This patch just adopts to those changes ]

---
 configure.ac      |    6 ------
 src/openvpn/tun.c |   19 -------------------

 2 files changed, 0 insertions(+), 25 deletions(-)
configure.ac +0 -0
index 8ac5ac4..e808cb4 100644
@@ -415,12 +415,6 @@ AC_CHECK_TYPES(

       [[${SOCKET_INCLUDES}]]
 )
 AC_CHECK_TYPE(
-       [struct tun_pi],
-       [AC_DEFINE([HAVE_TUN_PI], [1], [struct tun_pi needed for IPv6 support])],
-       ,
-       [[${SOCKET_INCLUDES}]]

configure.ac +0 -2
-)
-AC_CHECK_TYPE(

       [struct iphdr],
       [AC_DEFINE([HAVE_IPHDR], [1], [struct iphdr needed for IPv6 support])], ,

src/openvpn/tun.c +0 -8
index 227bfde..633150f 100644
@@ -1373,14 +1373,6 @@ close_tun_generic (struct tuntap *tt)
  #error header file linux/sockios.h required
  #endif
 
-#if defined(HAVE_TUN_PI) && defined(HAVE_IPHDR) && defined(HAVE_IOVEC) && defined(ETH_P_IPV6) && defined(ETH_P_IP) && defined(HAVE_READV) && defined(HAVE_WRITEV)
-#define LINUX_IPV6 1
-/* #warning IPv6 ON */
-#else
-#define LINUX_IPV6 0
-/* #warning IPv6 OFF */
-#endif
-
  #if !PEDANTIC
 

 void

src/openvpn/tun.c +0 -7
@@ -1388,13 +1380,6 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
  {
   struct ifreq ifr;
 
-  /* warn if a very old linux version is used & --tun-ipv6 set
-   */
-#if LINUX_IPV6 == 0
-  if ( tt->ipv6 )
-    msg (M_WARN, "NOTE: explicit support for IPv6 tun devices is not provided for this OS");
-#endif
-
   /*
    * We handle --dev null specially, we do not open /dev/null for this.
    */
@@ -1623,7 +1608,6 @@ close_tun (struct tuntap *tt)

 int
 write_tun (struct tuntap* tt, uint8_t *buf, int len) {
-#if LINUX_IPV6
  if (tt->ipv6)
    {
      struct tun_pi pi;

src/openvpn/tun.c +0 -0
@@ -1649,14 +1633,12 @@ write_tun (struct tuntap* tt, uint8_t *buf, int len)
       return(ret - sizeof(pi));
     }

  else
-#endif
    return write (tt->fd, buf, len);
 }

 int
 read_tun (struct tuntap* tt, uint8_t *buf, int len) {
-#if LINUX_IPV6
  if (tt->ipv6)
    {
      struct iovec vect[2];

src/openvpn/tun.c +0 -0
@@ -1672,7 +1654,6 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len)
       return(ret - sizeof(pi));
     }

  else
-#endif
    return read (tt->fd, buf, len);
 }

--
1.7.4.4

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#18 lore raw

Re: [Openvpn-devel] [PATCH] Clean-up: Presume that Linux is always IPv6 capable at build time

In reply to David Sommerseth

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

Quoted 12 lines · David Sommerseth

These days it is highly unlikely that OpenVPN will be built in a non-IPv6 capable Linux environment. So remove compile-time related macros identifying that.

This also solves an issue which was introduced in commit 51bd56f46f55177cf0f8b where HAVE_TUN_PI is no longer detected. The tun_pi struct is defined in linux/if_tun.h, which will be checked for later on. As this struct has history in linux/if_tun.h all back to the beginning of the kernel git tree (2.6.12-rc2, April 2005), it is considered not needed to check for this struct explicit.

Quoted 8 lines

[ v2: Commit 7c0a2b5f2b4409 modifies some of the checks this patch touches. This patch just adopts to those changes ]

configure.ac | 6 ------ src/openvpn/tun.c | 19
------------------- 2 files changed, 0 insertions(+), 25 deletions(-)

Applied to master on -testing and -stable trees.

commit bff413d5c47645b525988a66c138abf7d198e228

Author: David Sommerseth <[email protected]...>
Date:   Fri Apr 27 12:10:25 2012 +0200
    Clean-up: Presume that Linux is always IPv6 capable at build time

    Signed-off-by: David Sommerseth <[email protected]...>
    Acked-by: Gert Doering <[email protected]...>
    Acked-by: Alon Bar-Lev <[email protected]...>

kind regards,

David Sommerseth

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

iEYEARECAAYFAk+agSsACgkQDC186MBRfrqVtgCggr0fDHbXxEdIC0lYMlMWYXWm jpsAniboqsuuFVwmrf8EA4C2tfl1q7op
=a0V/
-----END PGP SIGNATURE-----