datapath: Add compat support for nla_type().
[sliver-openvswitch.git] / datapath / linux-2.6 / compat-2.6 / include / net / netlink.h
index 2f979fe..c6f5e04 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __NET_NETLINK_WRAPPER_H
 #define __NET_NETLINK_WRAPPER_H 1
 
+#include <linux/version.h>
 #include_next <net/netlink.h>
 
 #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 */