From 365a25176bf854112b37c56888979d7755ab0d72 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 7 Dec 2010 09:33:27 -0800 Subject: [PATCH] netlink: Make netlink-protocol.h compatible with . Until now, netlink-protocol.h and could not both be included by a single source file, because they contained conflicting definitions. This commit fixes the problem, by having netlink-protocol.h delegate to where it is available. Here's an example of the problem: odp-util.c includes both datapath-protocol.h and will need netlink-protocol.h also so that it can look through actions defined as struct nlattr. datapath-protocol.h includes for the definition of rtnl_link_stats64, and includes . Acked-by: Jesse Gross --- lib/netlink-protocol.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/netlink-protocol.h b/lib/netlink-protocol.h index 486e6a088..77f5c8965 100644 --- a/lib/netlink-protocol.h +++ b/lib/netlink-protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008 Nicira Networks. + * Copyright (c) 2008, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,24 @@ /* Netlink protocol definitions. * - * These definitions are equivalent to those in the Linux 2.6 kernel headers, - * without requiring those headers to be available. */ + * Netlink is a message framing format described in RFC 3549 and used heavily + * in Linux to access the network stack. Open vSwitch uses AF_NETLINK sockets + * for this purpose on Linux. But on all platforms, Open vSwitch uses Netlink + * message framing internally for certain purposes. + * + * This header provides access to the Netlink message framing definitions + * regardless of platform. On Linux, it includes the proper headers directly; + * on other platforms it directly defines the structures and macros itself. + */ #include #include #include "util.h" +#ifdef HAVE_NETLINK +#include +#include +#else #define NETLINK_GENERIC 16 struct sockaddr_nl { @@ -137,5 +148,6 @@ enum { }; #define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) +#endif /* !HAVE_NETLINK */ #endif /* netlink-protocol.h */ -- 2.43.0