netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: dsa@cumulusnetworks.com
Cc: stephen@networkplumber.org, netdev@vger.kernel.org,
	jakub.kicinski@netronome.com
Subject: Re: [PATCH net-next iproute2 1/3] netlink: import netlink message parsing from kernel
Date: Tue, 02 May 2017 14:51:02 -0400 (EDT)	[thread overview]
Message-ID: <20170502.145102.1235504926303235504.davem@davemloft.net> (raw)
In-Reply-To: <3acddce9-5421-637e-8b2b-ae8dd5c7b29a@cumulusnetworks.com>

From: David Ahern <dsa@cumulusnetworks.com>
Date: Tue, 2 May 2017 12:39:51 -0600

> On 5/2/17 12:03 PM, Stephen Hemminger wrote:
>> Then use libmnl it is already used in several other places in iproute2.
>> Eventually, I would like to use it everywhere and get rid of old netlink parser.
>> 
> 
> Why? libmnl is not going to simplify the iproute2 code.

Agreed.

> Look at attribute validation. Importing the kernel code into iproute2,
> the API is very familiar to anyone hacking on the kernel side:
> 
> +       if (nla_parse(tb, NLMSGERR_ATTR_MAX, attr, alen, extack_policy)
> != 0) {
> +               fprintf(stderr,
> +                       "Failed to parse extended error attributes\n");
> +               return 0;
> +       }
> +
> 
> ie., you pass a policy to the parse routine and the checking is part of
> nla_parse. The implementation of nla_parse and validate_nla are quite
> easy to read.
> 
> Now take a look at what devlink has for validation - attr_cb. IMO very
> unreadable and puts the burden on the app using the libmnl API.

Also agreed.

Stephen I totally agree with David, asking him to use libmnl for this is
not reasonable nor is it even a good idea given the above.

  reply	other threads:[~2017-05-02 18:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02  3:18 [PATCH net-next iproute2 0/3] ip: Initial support for extack errors David Ahern
2017-05-02  3:18 ` [PATCH net-next iproute2 1/3] netlink: import netlink message parsing from kernel David Ahern
2017-05-02 15:25   ` Stephen Hemminger
2017-05-02 16:51     ` David Ahern
2017-05-02 17:00       ` David Miller
2017-05-02 18:03         ` Stephen Hemminger
2017-05-02 18:39           ` David Ahern
2017-05-02 18:51             ` David Miller [this message]
2017-05-02 19:49   ` Stephen Hemminger
2017-05-02 20:39     ` David Ahern
2017-05-02 21:20       ` Stephen Hemminger
2017-05-02  3:18 ` [PATCH net-next iproute2 2/3] netlink: Add support for extended ack to rtnl_talk David Ahern
2017-05-02  3:18 ` [PATCH net-next iproute2 3/3] ip link: Add extack handling for setlink David Ahern
2017-05-02  3:34 ` [PATCH net-next iproute2 0/3] ip: Initial support for extack errors Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170502.145102.1235504926303235504.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).