@@ -15,6 +15,7 @@
* limitations under the License.
*/
+#if !defined(__MACH__)
#include <config.h>
#include "netdev-provider.h"
@@ -1825,3 +1826,4 @@ af_link_ioctl(unsigned long command, const void *arg)
: 0);
}
#endif
+#endif /* !defined(__MACH__) */
@@ -38,6 +38,11 @@
VLOG_DEFINE_THIS_MODULE(route_table_bsd);
+/* OS X does not define RT_ROUNDUP() or equivalent macro. */
+#if defined(__MACH__)
+#define RT_ROUNDUP(l) ((l) > 0 ? ROUND_UP((l), sizeof(long)) : sizeof(long))
+#endif
+
bool
route_table_fallback_lookup(ovs_be32 ip, char name[], ovs_be32 *gw)
{
@@ -162,6 +167,8 @@ retry:
sa = (struct sockaddr *)((char *)sa + SA_SIZE(sa));
#elif defined(__NetBSD__)
sa = (struct sockaddr *)((char *)sa + RT_ROUNDUP(sa->sa_len));
+#elif defined(__MACH__)
+ sa = (struct sockaddr *)((char *)sa + RT_ROUNDUP(sa->sa_len));
#else
#error unimplemented
#endif
@@ -128,7 +128,9 @@ rtbsd_notifier_run(void)
case RTM_IFINFO:
/* Since RTM_IFANNOUNCE messages are smaller than RTM_IFINFO
* messages, the same buffer may be used. */
+#ifndef __MACH__ /* OS X does not implement RTM_IFANNOUNCE */
case RTM_IFANNOUNCE:
+#endif
rtbsd_report_change(&msg);
break;
default:
@@ -180,11 +182,13 @@ rtbsd_report_change(const struct if_msghdr *msg)
change.if_index = msg->ifm_index;
if_indextoname(msg->ifm_index, change.if_name);
break;
+#ifndef __MACH__ /* OS X does not implement RTM_IFANNOUNCE */
case RTM_IFANNOUNCE:
ahdr = (const struct if_announcemsghdr *) msg;
change.if_index = ahdr->ifan_index;
strncpy(change.if_name, ahdr->ifan_name, IF_NAMESIZE);
break;
+#endif
}
LIST_FOR_EACH (notifier, node, &all_notifiers) {
Conditional compilation to account for: - OS X does not implement RTM_IFANNOUNCE. - OS X does not implement tap netdeivces. - OS X does not implement RT_ROUNDUP(). Signed-off-by: Lance Richardson <lrichard@redhat.com> --- Changes from v1: - Combined patches 4 and 5 into patch number 4 - Added implementation of RT_ROUNDUP() for OS X lib/netdev-bsd.c | 2 ++ lib/route-table-bsd.c | 7 +++++++ lib/rtbsd.c | 4 ++++ 3 files changed, 13 insertions(+)