[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180119140232.1191999c@xeon-e3>
Date: Fri, 19 Jan 2018 14:02:31 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: David Ahern <dsahern@...il.com>
Cc: Arkadi Sharshevsky <arkadis@...lanox.com>, netdev@...r.kernel.org,
davem@...emloft.net, mlxsw@...lanox.com
Subject: Re: [PATCH iproute2] devlink: Ignore unknown attributes
On Thu, 18 Jan 2018 20:42:44 -0800
David Ahern <dsahern@...il.com> wrote:
> On 1/17/18 5:28 AM, Arkadi Sharshevsky wrote:
> > In case of extending the UAPI old packages would break.
> >
> > Signed-off-by: Arkadi Sharshevsky <arkadis@...lanox.com>
> > ---
> > devlink/devlink.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/devlink/devlink.c b/devlink/devlink.c
> > index 39cda06..c9d1838 100644
> > --- a/devlink/devlink.c
> > +++ b/devlink/devlink.c
> > @@ -343,7 +343,7 @@ static int attr_cb(const struct nlattr *attr, void *data)
> > int type;
> >
> > if (mnl_attr_type_valid(attr, DEVLINK_ATTR_MAX) < 0)
> > - return MNL_CB_ERROR;
> > + return MNL_CB_OK;
> >
> > type = mnl_attr_get_type(attr);
> > if (mnl_attr_validate(attr, devlink_policy[type]) < 0)
> >
>
> What's the point of calling mnl_attr_type_valid if you disregard a
> failure? you might as well not call mnl_attr_type_valid at all.
The way mnl handles attributes, you have to have a callback and it is up
to the callback to copy the values it wants. The idea is that old code
running against a newer kernel will have a smaller array of attributes
it wants, and only copy those.
Powered by blists - more mailing lists