From f307eeb37640adb92cf92eb61ec26ac9ac30ac97 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 10 Dec 2010 14:42:17 -0800 Subject: [PATCH] datapath: Add compat support for nla_type(). The datapath code uses nla_type() but it was only introduced in 2.6.24. The NLA_TYPE_MASK definition has to go above the #include because recursively #include . Signed-off-by: Ben Pfaff Acked-by: Jesse Gross --- .../linux-2.6/compat-2.6/include/linux/netlink.h | 8 +++++++- datapath/linux-2.6/compat-2.6/include/net/netlink.h | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/datapath/linux-2.6/compat-2.6/include/linux/netlink.h b/datapath/linux-2.6/compat-2.6/include/linux/netlink.h index fba899ec..16660977 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/netlink.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/netlink.h @@ -3,8 +3,14 @@ #include #include_next -#include +#ifndef NLA_TYPE_MASK +#define NLA_F_NESTED (1 << 15) +#define NLA_F_NET_BYTEORDER (1 << 14) +#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) +#endif + +#include #include #ifndef NLMSG_DEFAULT_SIZE 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 2f979fec..c6f5e04f 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 @@ -1,6 +1,7 @@ #ifndef __NET_NETLINK_WRAPPER_H #define __NET_NETLINK_WRAPPER_H 1 +#include #include_next #ifndef HAVE_NLA_NUL_STRING @@ -37,4 +38,16 @@ static inline __be16 nla_get_be16(struct nlattr *nla) } #endif /* !HAVE_NLA_GET_BE16 */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) +/** + * nla_type - attribute type + * @nla: netlink attribute + */ +static inline int nla_type(const struct nlattr *nla) +{ + return nla->nla_type & NLA_TYPE_MASK; +} +#endif + #endif /* net/netlink.h */ -- 2.30.2