compat: Add genlmsg_parse() helper function.
authorJoe Stringer <joestringer@nicira.com>
Thu, 22 Jan 2015 00:42:51 +0000 (16:42 -0800)
committerJoe Stringer <joestringer@nicira.com>
Fri, 27 Feb 2015 18:58:37 +0000 (10:58 -0800)
The first user will be the next patch.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
acinclude.m4
datapath/linux/compat/include/net/genetlink.h

index d8b415e..18598b3 100644 (file)
@@ -364,6 +364,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genlmsg_new_unicast])
   OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [netlink_has_listeners(net->genl_sock],
                   [OVS_DEFINE([HAVE_GENL_HAS_LISTENERS_TAKES_NET])])
+  OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genlmsg_parse])
   OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_cisco_register])
   OVS_GREP_IFELSE([$KSRC/include/net/ipv6.h], [IP6_FH_F_SKIP_RH])
   OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_get_be16])
index 8d1b89e..9edfd31 100644 (file)
@@ -130,4 +130,15 @@ static inline int rpl_genl_has_listeners(struct genl_family *family,
 
 #endif /* HAVE_GENL_HAS_LISTENERS */
 
+#ifndef HAVE_GENLMSG_PARSE
+static inline int genlmsg_parse(const struct nlmsghdr *nlh,
+                               const struct genl_family *family,
+                               struct nlattr *tb[], int maxtype,
+                               const struct nla_policy *policy)
+{
+       return nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype,
+                          policy);
+}
+#endif
+
 #endif /* genetlink.h */