- 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>
... | ... |
@@ -86,8 +86,7 @@ struct link_socket_actual |
86 | 86 |
union { |
87 | 87 |
#ifdef HAVE_IN_PKTINFO |
88 | 88 |
struct in_pktinfo in4; |
89 |
-#endif |
|
90 |
-#ifdef IP_RECVDSTADDR |
|
89 |
+#elif defined(IP_RECVDSTADDR) |
|
91 | 90 |
struct in_addr in4; |
92 | 91 |
#endif |
93 | 92 |
struct in6_pktinfo in6; |
... | ... |
@@ -589,8 +588,7 @@ addr_defined_ipi (const struct link_socket_actual *lsa) |
589 | 589 |
switch (lsa->dest.addr.sa.sa_family) { |
590 | 590 |
#ifdef HAVE_IN_PKTINFO |
591 | 591 |
case AF_INET: return lsa->pi.in4.ipi_spec_dst.s_addr != 0; |
592 |
-#endif |
|
593 |
-#ifdef IP_RECVDSTADDR |
|
592 |
+#elif defined(IP_RECVDSTADDR) |
|
594 | 593 |
case AF_INET: return lsa->pi.in4.s_addr != 0; |
595 | 594 |
#endif |
596 | 595 |
case AF_INET6: return !IN6_IS_ADDR_UNSPECIFIED(&lsa->pi.in6.ipi6_addr); |
... | ... |
@@ -57,6 +57,12 @@ |
57 | 57 |
#define srandom srand |
58 | 58 |
#endif |
59 | 59 |
|
60 |
+#if defined(__APPLE__) |
|
61 |
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070 |
|
62 |
+#define __APPLE_USE_RFC_3542 1 |
|
63 |
+#endif |
|
64 |
+#endif |
|
65 |
+ |
|
60 | 66 |
#ifdef HAVE_SYS_TYPES_H |
61 | 67 |
#include <sys/types.h> |
62 | 68 |
#endif |
... | ... |
@@ -401,6 +407,14 @@ |
401 | 401 |
#endif |
402 | 402 |
|
403 | 403 |
/* |
404 |
+ * Does this platform define SOL_IP |
|
405 |
+ * or only bsd-style IPPROTO_IP ? |
|
406 |
+ */ |
|
407 |
+#ifndef SOL_IP |
|
408 |
+#define SOL_IP IPPROTO_IP |
|
409 |
+#endif |
|
410 |
+ |
|
411 |
+/* |
|
404 | 412 |
* Disable ESEC |
405 | 413 |
*/ |
406 | 414 |
#if 0 |
... | ... |
@@ -1060,11 +1060,11 @@ do_ifconfig (struct tuntap *tt, |
1060 | 1060 |
{ |
1061 | 1061 |
struct route r; |
1062 | 1062 |
CLEAR (r); |
1063 |
- r.defined = true; |
|
1063 |
+ r.flags = RT_DEFINED; |
|
1064 | 1064 |
r.network = tt->local & tt->remote_netmask; |
1065 | 1065 |
r.netmask = tt->remote_netmask; |
1066 | 1066 |
r.gateway = tt->local; |
1067 |
- add_route (&r, tt, 0, es); |
|
1067 |
+ add_route (&r, tt, 0, NULL, es); |
|
1068 | 1068 |
} |
1069 | 1069 |
|
1070 | 1070 |
if ( do_ipv6 ) |