netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: "Michal Kubecek" <mkubecek@suse.cz>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Kevin 'ldir' Darbyshire-Bryant" <ldir@darbyshire-bryant.me.uk>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Paul Blakey" <paulb@mellanox.com>,
	"John Hurley" <john.hurley@netronome.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	"dcaratti@redhat.com" <dcaratti@redhat.com>,
	"David Ahern" <dsahern@gmail.com>,
	"Simon Horman" <simon.horman@netronome.com>
Subject: Re: [PATCH net-next v6] net: sched: Introduce act_ctinfo action
Date: Thu, 13 Jun 2019 17:12:42 -0300	[thread overview]
Message-ID: <20190613201242.GI3436@localhost.localdomain> (raw)
In-Reply-To: <20190612143458.0b6fe526@cakuba.netronome.com>

On Wed, Jun 12, 2019 at 02:34:58PM -0700, Jakub Kicinski wrote:
> On Wed, 12 Jun 2019 21:18:59 +0200, Michal Kubecek wrote:
> > On Wed, Jun 12, 2019 at 08:56:10PM +0200, Johannes Berg wrote:
> > > (switching to my personal email)
> > >   
> > > > > I can't add these actions with current net-next and iproute-next:
> > > > > # ~/iproute2/tc/tc action add action ctinfo dscp 0xfc000000 0x01000000
> > > > > Error: NLA_F_NESTED is missing.
> > > > > We have an error talking to the kernel
> > > > > 
> > > > > This also happens with the current post of act_ct and should also
> > > > > happen with the act_mpls post (thus why Cc'ing John as well).
> > > > > 
> > > > > I'm not sure how we should fix this. In theory the kernel can't get
> > > > > stricter with userspace here, as that breaks user applications as
> > > > > above, so older actions can't use the more stricter parser. Should we
> > > > > have some actions behaving one way, and newer ones in a different way?
> > > > > That seems bad.  
> > > 
> > > I think you could just fix all of the actions in userspace, since the
> > > older kernel would allow both with and without the flag, and then from a
> > > userspace POV it all behaves the same, just the kernel accepts some
> > > things without the flag for compatibility with older iproute2?
> > >   
> > > > > Or maybe all actions should just use nla_parse_nested_deprecated()?
> > > > > I'm thinking this last. Yet, then the _deprecated suffix may not make
> > > > > much sense here. WDYT?  
> > > > 
> > > > Surely for new actions we can require strict validation, there is
> > > > no existing user space to speak of..    
> > > 
> > > That was the original idea.
> > >   
> > > > Perhaps act_ctinfo and act_ct
> > > > got slightly confused with the race you described, but in principle
> > > > there is nothing stopping new actions from implementing the user space
> > > > correctly, right?  
> > > 
> > > There's one potential thing where you have a new command in netlink
> > > (which thus will use strict validation), but you use existing code in
> > > userspace to build the netlink message or parts thereof?
> > > 
> > > But then again you can just fix that while you test it, and the current
> > > and older kernel will accept the stricter version for the existing use
> > > of the existing code too, right?  
> > 
> > Userspace can safely set NLA_F_NESTED on every nested attribute as there
> > are only few places in kernel where nla->type is accessed directly
> > rather than through nla_type() and those are rather specific (mostly
> > when attribute type is actually used as an array index). So the best
> > course of action would be letting userspace always set NLA_F_NESTED.
> > So kernel can only by strict on newly added attributes but userspace can
> > (and should) set NLA_F_NESTED always.
> > 
> > The opposite direction (kernel -> userspace) is more tricky as we can
> > never be sure there isn't some userspace client accessing the type directly
> > without masking out the flags. Thus kernel can only set NLA_F_NESTED on
> > new attributes where there cannot be any userspace program used to it
> > not being set.
> 
> Agreed, so it's just the slight inconsistency in the dumps, which I'd
> think is a fair price to pay here.  Old user space won't recognize the
> new attributes, anyway, so doesn't matter what flags they have..

Thanks for your inputs. In summary, being able to do extra validations
for new actions is worth the inconsitency then.

  Marcelo

  reply	other threads:[~2019-06-13 20:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 17:03 [PATCH net-next v6] net: sched: Introduce act_ctinfo action Kevin 'ldir' Darbyshire-Bryant
2019-05-28 18:08 ` Toke Høiland-Jørgensen
2019-05-28 18:52   ` Kevin 'ldir' Darbyshire-Bryant
2019-05-28 19:38     ` Toke Høiland-Jørgensen
2019-05-28 22:06 ` Cong Wang
2019-05-30  4:44 ` David Miller
2019-05-30 12:01   ` Kevin 'ldir' Darbyshire-Bryant
2019-06-12 18:02 ` Marcelo Ricardo Leitner
2019-06-12 18:46   ` Jakub Kicinski
2019-06-12 18:52     ` Marcelo Ricardo Leitner
2019-06-12 18:56     ` Johannes Berg
2019-06-12 19:18       ` Michal Kubecek
2019-06-12 21:34         ` Jakub Kicinski
2019-06-13 20:12           ` Marcelo Ricardo Leitner [this message]
2019-06-13 11:18         ` [RFC PATCH net-next] sched: act_ctinfo: use extack error reporting Kevin Darbyshire-Bryant
2019-06-13 12:55           ` Marcelo Ricardo Leitner
2019-06-13  8:33     ` [PATCH net-next v6] net: sched: Introduce act_ctinfo action Simon Horman
2019-06-13  9:09       ` Kevin 'ldir' Darbyshire-Bryant
2019-06-13 10:47         ` Kevin 'ldir' Darbyshire-Bryant
2019-06-13 10:53         ` Toke Høiland-Jørgensen
2019-06-13 20:08         ` Marcelo Ricardo Leitner
2019-06-14  9:09           ` [PATCH net-next] sched: act_ctinfo: use extack error reporting Kevin Darbyshire-Bryant
2019-06-14 15:57             ` David Miller

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=20190613201242.GI3436@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=dcaratti@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=johannes@sipsolutions.net \
    --cc=john.hurley@netronome.com \
    --cc=ldir@darbyshire-bryant.me.uk \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=paulb@mellanox.com \
    --cc=simon.horman@netronome.com \
    --cc=toke@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).