From: Joe Stringer Date: Thu, 22 Jan 2015 00:42:51 +0000 (-0800) Subject: compat: Add genlmsg_parse() helper function. X-Git-Tag: v2.4.0~552 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=c623ba497a10fc8526d529261453facf227d468e;p=cascardo%2Fovs.git compat: Add genlmsg_parse() helper function. The first user will be the next patch. Signed-off-by: Joe Stringer Acked-by: Pravin B Shelar Signed-off-by: David S. Miller --- diff --git a/acinclude.m4 b/acinclude.m4 index d8b415eeb..18598b333 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/ipv6.h], [IP6_FH_F_SKIP_RH]) OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_get_be16]) diff --git a/datapath/linux/compat/include/net/genetlink.h b/datapath/linux/compat/include/net/genetlink.h index 8d1b89e37..9edfd3142 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 */