netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, mkubecek@suse.cz
Subject: Re: [PATCH net-next 1/6] netlink: add support for ext_ack missing attributes
Date: Wed, 24 Aug 2022 09:36:09 -0700	[thread overview]
Message-ID: <20220824093609.688d48ac@kernel.org> (raw)
In-Reply-To: <a3dabe052337a85e1f54d6119bda0c6414325edc.camel@sipsolutions.net>

On Wed, 24 Aug 2022 10:09:55 +0200 Johannes Berg wrote:
> On Tue, 2022-08-23 at 21:50 -0700, Jakub Kicinski wrote:
> > The @offset points to the
> > nest which should have contained the attribute  
> 
> I find this a bit tedious, tbh. You already kernel-side have patch 2 and
> patch 3 that pass different things here.
> 
> Maybe it would be better to have this point to the _end_ of the {nest,
> message} header, which - if there are any - would be equivalent to the
> first sibling attribute?

Pointing at the start of a nest is easier because I can reuse the same
"attr walking" logic in user space as for finding invalid attributes 
to find the nest.

> Though I guess one way or the other userspace has to have an if that
> asks whether or not it's in a nest or the top-level namespace.
> 
> Hmm.
> 
> How about we just _remove_ the NLMSGERR_ATTR_MISS_NEST attribute if it's
> not missing in a nested attribute? That would make sense from the naming
> too:
>  * NLMSGERR_ATTR_MISS_TYPE - which attribute type you missed
>  * NLMSGERR_ATTR_MISS_NEST - which nesting you missed it in, _if any_
> 
> 
> And that way the if simplifies down to something like
> 
> 	if (tb[NLMSGERR_ATTR_MISS_NEST])
> 
> in the consumer too, and you don't need GENL_REQ_ATTR_CHECK() at all,
> you just pass NULL to the second argument of NL_REQ_ATTR_CHECK().

Sounds good!

  parent reply	other threads:[~2022-08-24 16:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24  4:50 [PATCH net-next 0/6] netlink: support reporting missing attributes Jakub Kicinski
2022-08-24  4:50 ` [PATCH net-next 1/6] netlink: add support for ext_ack " Jakub Kicinski
2022-08-24  8:09   ` Johannes Berg
2022-08-24  8:13     ` Johannes Berg
2022-08-24 16:36     ` Jakub Kicinski [this message]
2022-08-24  4:50 ` [PATCH net-next 2/6] netlink: add helper for extack attr presence checking Jakub Kicinski
2022-08-24  4:50 ` [PATCH net-next 3/6] genetlink: add helper for checking required attrs and use it in devlink Jakub Kicinski
2022-08-24 19:44   ` Johannes Berg
2022-08-24 22:46     ` Jakub Kicinski
2022-08-24  4:50 ` [PATCH net-next 4/6] devlink: use missing attribute ext_ack Jakub Kicinski
2022-08-24  4:50 ` [PATCH net-next 5/6] ethtool: strset: report missing ETHTOOL_A_STRINGSET_ID via ext_ack Jakub Kicinski
2022-08-24  4:50 ` [PATCH net-next 6/6] ethtool: report missing header via ext_ack in the default handler 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=20220824093609.688d48ac@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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).