datapath: Backport more Netlink functions.
authorBen Pfaff <blp@nicira.com>
Wed, 12 Jan 2011 21:08:08 +0000 (13:08 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 28 Jan 2011 05:08:41 +0000 (21:08 -0800)
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
acinclude.m4
datapath/linux-2.6/compat-2.6/include/net/netlink.h

index 3b691647b5cecef069ed213a042e177781cc0bc8..6fc1c7a1ee7c396b9bdd445039a2d0aeae91f4f0 100644 (file)
@@ -1,6 +1,6 @@
 # -*- autoconf -*-
 
-# Copyright (c) 2008, 2009, 2010 Nicira Networks.
+# Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -200,6 +200,7 @@ AC_DEFUN([OVS_CHECK_LINUX26_COMPAT], [
 
   OVS_GREP_IFELSE([$KSRC26/include/net/netlink.h], [NLA_NUL_STRING])
   OVS_GREP_IFELSE([$KSRC26/include/net/netlink.h], [nla_get_be16])
+  OVS_GREP_IFELSE([$KSRC26/include/net/netlink.h], [nla_find_nested])
 
   OVS_CHECK_LOG2_H
 
index 2ee321be8a26f73be1e2cddde6cb1c2915da0cbd..52238d8b670b60feea198caca1c1cbd085d3a3f4 100644 (file)
@@ -111,4 +111,21 @@ static inline int nla_type(const struct nlattr *nla)
 }
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+#define nla_parse_nested(tb, maxtype, nla, policy) \
+       nla_parse_nested(tb, maxtype, (struct nlattr *)(nla), policy)
+#endif
+
+#ifndef nla_for_each_nested
+#define nla_for_each_nested(pos, nla, rem) \
+       nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem)
+#endif
+
+#ifndef HAVE_NLA_FIND_NESTED
+static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
+{
+       return nla_find(nla_data(nla), nla_len(nla), attrtype);
+}
+#endif
+
 #endif /* net/netlink.h */