summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank de Brabander <debrabander@gmail.com>2012-02-22 11:49:15 -0800
committerDavid Sommerseth <davids@redhat.com>2012-06-13 12:19:44 +0200
commitfe8a7f0cc25e6b9492bf0613025873c7a5f46ca5 (patch)
treebce29f958ac83b1d82d231a0763465309ef039c1
parent21ae2ec2b963e33e1b48b6cf9069e774b3f656b1 (diff)
downloadopenvpn-fe8a7f0cc25e6b9492bf0613025873c7a5f46ca5.tar.gz
openvpn-fe8a7f0cc25e6b9492bf0613025873c7a5f46ca5.tar.xz
openvpn-fe8a7f0cc25e6b9492bf0613025873c7a5f46ca5.zip
Fix reported compile issues on OSX 10.6.8
This is not the a problem when building using the latest Mac OS X SDK. I've did a quick search and it seems to be a more common issue on some (old) Darwin platforms. [ Additional review note from Gert Doering: IPV6_PKTINFO is part of the "extended socket API" defined in RFC2292. That RFC used IPV6_PKTINFO both for receiving the destination IPv6 address in UDP packets, and for setting the source address for outgoing packets. RFC2292 was updated by RFC3542, which renamed the "receive" function to IPV6_RECVPKTINFO, leaving the "sending" function as IPV6_PKTINFO - and, subsequently, in FreeBSD they have different "setsockopt()" opcodes. So, on a system that has *both*, we need to use IPV6_RECVPKTINFO for receving (turning it on with setsockopt) to make --multihome work, and IPV6_PKTINFO for sending (which we don't actually do). On a system that only has IPV6_PKTINFO, because it's API only implements 2292 (MacOS up until 10.6), use IPV6_PKTINFO for setsockopt(). Now, the interesting question is whether a 10.5-compiled openvpn.exe will behave correctly under 10.7 if --multihome is active... ] Signed-off-by: Frank de Brabander <debrabander@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: eb2837a3-ce55-4f52-b2fe-f822efc661f7@l14g2000vbe.googlegroups.com URL: http://article.gmane.org/gmane.network.openvpn.devel/5591 Signed-off-by: David Sommerseth <davids@redhat.com>
-rw-r--r--src/openvpn/socket.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 6b1f8d2..54ebce7 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -899,8 +899,13 @@ create_socket_udp6 (const unsigned int flags)
else if (flags & SF_USE_IP_PKTINFO)
{
int pad = 1;
+#ifndef IPV6_RECVPKTINFO /* Some older Darwin platforms require this */
+ if (setsockopt (sd, IPPROTO_IPV6, IPV6_PKTINFO,
+ (void*)&pad, sizeof(pad)) < 0)
+#else
if (setsockopt (sd, IPPROTO_IPV6, IPV6_RECVPKTINFO,
(void*)&pad, sizeof(pad)) < 0)
+#endif
msg(M_SOCKERR, "UDP: failed setsockopt for IPV6_RECVPKTINFO");
}
#endif