[ovs-dev] [PATCH 07/12] netlink: Make netlink-protocol.h compatible with <linux/netlink.h>.

Ben Pfaff blp at nicira.com
Wed Dec 8 18:25:24 UTC 2010


On Tue, Dec 07, 2010 at 02:19:48PM -0800, Jesse Gross wrote:
> On Tue, Dec 7, 2010 at 11:00 AM, Ben Pfaff <blp at nicira.com> wrote:
> > Until now, netlink-protocol.h and <linux/netlink.h> 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 <linux/netlink.h> where it is available.
> 
> Currently these Netlink files are only compiled if HAVE_NETLINK is
> defined, which obviously needs to change if we want to use Netlink in
> platform independent code.
> 
> More generally, I wonder whether it is a good idea to have a copy of
> this header file, which is only used on non-Linux platforms as it will
> almost certainly bitrot.  It seems better to always use our local
> copy, so at least thinks will break in more obvious ways.  I didn't
> see anywhere that directly includes the Linux Netlink headers, so I'm
> not sure exactly what conflict you are worrying about (presumably it
> would be in netdev-linux.c).  If any of the platform independent code
> needs to use things not provided in our header file, they will break
> on other OSs.

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 <linux/if_link.h> for the definition of rtnl_link_stats64, and
<linux/if_link.h> includes <linux/netlink.h>.

(I'll add that to the commit log.)

I generally agree about bit-rot, but I don't see a way to avoid it.  I'm
all ears, though.  It might be mitigated by the fact that this header
file has not changed since 2008, so there isn't much churn to cause rot.
Or maybe we could start doing regular builds on non-Linux platforms.

What do you think we should do?




More information about the dev mailing list