[ovs-dev] [PATCH 4/7] compat: Add genlmsg_parse() helper function.

Joe Stringer joestringer at nicira.com
Thu Feb 19 19:13:12 UTC 2015


The first user will be the next patch.

Signed-off-by: Joe Stringer <joestringer at nicira.com>
Acked-by: Pravin B Shelar <pshelar at nicira.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
---
 acinclude.m4                                  |    1 +
 datapath/linux/compat/include/net/genetlink.h |   11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/acinclude.m4 b/acinclude.m4
index c2f45ce..88badf1 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -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/gre.h], [gre_handle_offloads])
   OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h], [iptunnel_xmit.*net],
diff --git a/datapath/linux/compat/include/net/genetlink.h b/datapath/linux/compat/include/net/genetlink.h
index 8d1b89e..9edfd31 100644
--- a/datapath/linux/compat/include/net/genetlink.h
+++ b/datapath/linux/compat/include/net/genetlink.h
@@ -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 */
-- 
1.7.10.4




More information about the dev mailing list