From: Ben Pfaff Date: Wed, 12 Jan 2011 21:08:08 +0000 (-0800) Subject: datapath: Backport more Netlink functions. X-Git-Tag: v1.1.0~389 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=c0a0ac4f414cd17caead7c1066b016ddbc28b9ce datapath: Backport more Netlink functions. Signed-off-by: Ben Pfaff Acked-by: Jesse Gross --- diff --git a/acinclude.m4 b/acinclude.m4 index 3b691647b..6fc1c7a1e 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 2ee321be8..52238d8b6 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 */