diff options
author | JuanJo Ciarlante <jjo+ml@google.com> | 2011-09-19 16:07:14 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2011-09-21 15:19:41 +0200 |
commit | c02a84051297d97ba5955b93cdf479393b1dc1f8 (patch) | |
tree | 31a9c12dc12af2af1b1623ab060231571e09c2aa | |
parent | 79a5aa44ca30b0a9c5ba067f099bc1b97d8454e0 (diff) | |
download | openvpn-c02a84051297d97ba5955b93cdf479393b1dc1f8.tar.gz openvpn-c02a84051297d97ba5955b93cdf479393b1dc1f8.tar.xz openvpn-c02a84051297d97ba5955b93cdf479393b1dc1f8.zip |
fix ipv6 compilation under macosx >= 1070 - v3
- use __APPLE_USE_RFC_3542 for macosx build environment >= 1070
- define SOL_IP from IPPROTO_IP if it's missing
In Linux man 7 ip says:
"Using SOL_IP socket options level isn't portable, BSD-based
stacks use IPPROTO_IP level."
Signed-off-by: JuanJo Ciarlante <jjo+ml@google.com>
Tested-by: Eric F Crist <ecrist@secure-computing.net>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
-rw-r--r-- | socket.c | 3 | ||||
-rw-r--r-- | socket.h | 6 | ||||
-rw-r--r-- | syshead.h | 14 | ||||
-rw-r--r-- | tun.c | 4 |
4 files changed, 19 insertions, 8 deletions
@@ -2878,8 +2878,7 @@ struct openvpn_in4_pktinfo struct cmsghdr cmsghdr; #ifdef HAVE_IN_PKTINFO struct in_pktinfo pi4; -#endif -#ifdef IP_RECVDSTADDR +#elif defined(IP_RECVDSTADDR) struct in_addr pi4; #endif }; @@ -86,8 +86,7 @@ struct link_socket_actual union { #ifdef HAVE_IN_PKTINFO struct in_pktinfo in4; -#endif -#ifdef IP_RECVDSTADDR +#elif defined(IP_RECVDSTADDR) struct in_addr in4; #endif struct in6_pktinfo in6; @@ -589,8 +588,7 @@ addr_defined_ipi (const struct link_socket_actual *lsa) switch (lsa->dest.addr.sa.sa_family) { #ifdef HAVE_IN_PKTINFO case AF_INET: return lsa->pi.in4.ipi_spec_dst.s_addr != 0; -#endif -#ifdef IP_RECVDSTADDR +#elif defined(IP_RECVDSTADDR) case AF_INET: return lsa->pi.in4.s_addr != 0; #endif case AF_INET6: return !IN6_IS_ADDR_UNSPECIFIED(&lsa->pi.in6.ipi6_addr); @@ -57,6 +57,12 @@ #define srandom srand #endif +#if defined(__APPLE__) +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070 +#define __APPLE_USE_RFC_3542 1 +#endif +#endif + #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif @@ -401,6 +407,14 @@ #endif /* + * Does this platform define SOL_IP + * or only bsd-style IPPROTO_IP ? + */ +#ifndef SOL_IP +#define SOL_IP IPPROTO_IP +#endif + +/* * Disable ESEC */ #if 0 @@ -1060,11 +1060,11 @@ do_ifconfig (struct tuntap *tt, { struct route r; CLEAR (r); - r.defined = true; + r.flags = RT_DEFINED; r.network = tt->local & tt->remote_netmask; r.netmask = tt->remote_netmask; r.gateway = tt->local; - add_route (&r, tt, 0, es); + add_route (&r, tt, 0, NULL, es); } if ( do_ipv6 ) |