From c0a0ac4f414cd17caead7c1066b016ddbc28b9ce Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 12 Jan 2011 13:08:08 -0800 Subject: [PATCH] datapath: Backport more Netlink functions. Signed-off-by: Ben Pfaff Acked-by: Jesse Gross --- acinclude.m4 | 3 ++- .../linux-2.6/compat-2.6/include/net/netlink.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 3b691647..6fc1c7a1 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 2ee321be..52238d8b 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 */ -- 2.30.2