[ovs-dev] [PATCH 9/9] compat: Use nla_parse deprecated functions

Gregory Rose gvrose8192 at gmail.com
Mon Feb 24 22:53:52 UTC 2020


On 2/24/2020 2:42 PM, Greg Rose wrote:
> Changes for in kernel generated netlink attribute parsing functions
> require our out of tree driver to use the deprecated forms of those
> functions.  Otherwise the message parsing will return -EINVAL because
> NLA_F_NESTED is not set in the nla_type field.
>
> Signed-off-by: Greg Rose <gvrose8192 at gmail.com>

Misplaced the cover letter but in any case passes travis here:
https://travis-ci.org/gvrose8192/ovs-experimental/builds/654524798

And passes check-kmod without any regressions on a couple of systems I 
checked.

- Greg

> ---
>   acinclude.m4                                | 3 +++
>   datapath/linux/compat/include/net/netlink.h | 5 +++++
>   2 files changed, 8 insertions(+)
>
> diff --git a/acinclude.m4 b/acinclude.m4
> index a55c905..43d1576 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -1072,6 +1072,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
>     OVS_FIND_FIELD_IFELSE([$KSRC/include/net/genetlink.h], [genl_ops],
>                           [policy],
>                           [OVS_DEFINE([HAVE_GENL_OPS_POLICY])])
> +  OVS_GREP_IFELSE([$KSRC/include/net/netlink.h],
> +                  [nla_parse_deprecated_strict],
> +                  [OVS_DEFINE([HAVE_NLA_PARSE_DEPRECATED_STRICT])])
>   
>     if cmp -s datapath/linux/kcompat.h.new \
>               datapath/linux/kcompat.h >/dev/null 2>&1; then
> diff --git a/datapath/linux/compat/include/net/netlink.h b/datapath/linux/compat/include/net/netlink.h
> index 34fc346..7c0d993 100644
> --- a/datapath/linux/compat/include/net/netlink.h
> +++ b/datapath/linux/compat/include/net/netlink.h
> @@ -143,6 +143,10 @@ static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value,
>   
>   #endif
>   
> +#ifdef HAVE_NLA_PARSE_DEPRECATED_STRICT
> +#define nla_parse_nested nla_parse_nested_deprecated
> +#define nla_parse nla_parse_deprecated_strict
> +#else
>   #ifndef HAVE_NETLINK_EXT_ACK
>   struct netlink_ext_ack;
>   
> @@ -164,6 +168,7 @@ static inline int rpl_nla_parse(struct nlattr **tb, int maxtype,
>   }
>   #define nla_parse rpl_nla_parse
>   #endif
> +#endif /* HAVE_NLA_PARSE_DEPRECATED_STRICT */
>   
>   #ifndef HAVE_NLA_NEST_START_NOFLAG
>   static inline struct nlattr *rpl_nla_nest_start_noflag(struct sk_buff *skb,



More information about the dev mailing list