From: Johannes Berg <johannes@sipsolutions.net>
To: David Ahern <dsahern@gmail.com>, netdev@vger.kernel.org
Subject: Re: [RFC 2/5] netlink: set extack error message in nla_validate()
Date: Tue, 18 Sep 2018 19:36:57 +0200 [thread overview]
Message-ID: <1537292217.610.0.camel@sipsolutions.net> (raw)
In-Reply-To: <f21246a8-6c0a-e99d-96fb-f6e549f78563@gmail.com> (sfid-20180918_191810_537033_2D7C6060)
On Tue, 2018-09-18 at 10:18 -0700, David Ahern wrote:
> On 9/18/18 6:12 AM, Johannes Berg wrote:
> > diff --git a/lib/nlattr.c b/lib/nlattr.c
> > index 120ad569e13d..efbd6c1aff29 100644
> > --- a/lib/nlattr.c
> > +++ b/lib/nlattr.c
> > @@ -181,9 +181,13 @@ int nla_validate(const struct nlattr *head, int len, int maxtype,
> > int rem;
> >
> > nla_for_each_attr(nla, head, len, rem) {
> > - int err = validate_nla(nla, maxtype, policy, NULL);
> > + static const char _msg[] = "Attribute failed policy validation";
> > + const char *msg = _msg;
> > + int err = validate_nla(nla, maxtype, policy, &msg);
> >
> > if (err < 0) {
> > + if (extack)
> > + extack->_msg = msg;
> > NL_SET_BAD_ATTR(extack, nla);
> > return err;
> > }
> >
>
> I take it this set is on top of another set - the NLA_REJECT?
Yeah, these two:
https://patchwork.ozlabs.org/project/netdev/list/?series=65982
johannes
next prev parent reply other threads:[~2018-09-18 23:10 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 13:12 [RFC 1/5] netlink: remove NLA_NESTED_COMPAT Johannes Berg
2018-09-18 13:12 ` [RFC 2/5] netlink: set extack error message in nla_validate() Johannes Berg
2018-09-18 17:18 ` David Ahern
2018-09-18 17:36 ` Johannes Berg [this message]
2018-09-18 13:12 ` [RFC 3/5] netlink: combine validate/parse functions Johannes Berg
2018-09-18 13:12 ` [RFC 4/5] netlink: prepare validate extack setting for recursion Johannes Berg
2018-09-19 3:37 ` Marcelo Ricardo Leitner
2018-09-19 9:25 ` Johannes Berg
2018-09-19 9:44 ` Jiri Benc
2018-09-19 18:46 ` Marcelo Ricardo Leitner
2018-09-19 19:19 ` Johannes Berg
2018-09-19 21:10 ` Marcelo Ricardo Leitner
2018-09-20 8:14 ` Johannes Berg
2018-09-20 17:48 ` Marcelo Ricardo Leitner
2018-09-19 9:10 ` Jiri Benc
2018-09-19 9:15 ` Johannes Berg
2018-09-19 9:28 ` Jiri Benc
2018-09-19 9:44 ` Johannes Berg
2018-09-18 13:12 ` [RFC 5/5] netlink: allow NLA_NESTED to specify nested policy to validate Johannes Berg
2018-09-18 17:18 ` [RFC 1/5] netlink: remove NLA_NESTED_COMPAT David Ahern
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=1537292217.610.0.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.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).