[ovs-dev] [netlink v5 50/61] datapath: Backport more Netlink functions.

Ben Pfaff blp at nicira.com
Thu Jan 27 00:23:33 UTC 2011


Signed-off-by: Ben Pfaff <blp at nicira.com>
Acked-by: Jesse Gross <jesse at nicira.com>
---
 acinclude.m4                                       |    3 ++-
 .../linux-2.6/compat-2.6/include/net/netlink.h     |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 3b69164..6fc1c7a 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -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
 
diff --git a/datapath/linux-2.6/compat-2.6/include/net/netlink.h b/datapath/linux-2.6/compat-2.6/include/net/netlink.h
index 2ee321b..52238d8 100644
--- a/datapath/linux-2.6/compat-2.6/include/net/netlink.h
+++ b/datapath/linux-2.6/compat-2.6/include/net/netlink.h
@@ -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 */
-- 
1.7.1





More information about the dev mailing list