]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix reported compile issues on OSX 10.6.8
authorFrank de Brabander <debrabander@gmail.com>
Wed, 22 Feb 2012 19:49:15 +0000 (11:49 -0800)
committerDavid Sommerseth <davids@redhat.com>
Wed, 13 Jun 2012 10:19:44 +0000 (12:19 +0200)
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>
src/openvpn/socket.c

index 6b1f8d2012fa35ba52fc7249e1879ed63b748443..54ebce752515ddf756b64a304d7d7332a54c4c16 100644 (file)
@@ -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