netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>,
	roopa@nvidia.com
Cc: David Ahern <dsahern@gmail.com>,
	netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Ido Schimmel <idosch@nvidia.com>,
	Jakub Kicinski <kuba@kernel.org>, Andrei Vagin <avagin@gmail.com>,
	Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
	Alexander Mikhalitsyn <alexander@mihalicyn.com>
Subject: Re: [PATCH net-next] rtnetlink: add RTNH_REJECT_MASK
Date: Tue, 30 Nov 2021 12:28:17 +0200	[thread overview]
Message-ID: <YaX8wa5R/r5sbca5@shredder> (raw)
In-Reply-To: <20211130125352.4bbcc68c01fe763c1f43bfdc@virtuozzo.com>

On Tue, Nov 30, 2021 at 12:53:52PM +0300, Alexander Mikhalitsyn wrote:
> On Tue, 30 Nov 2021 11:28:32 +0200
> Ido Schimmel <idosch@idosch.org> wrote:
> 
> > On Tue, Nov 30, 2021 at 11:35:17AM +0300, Alexander Mikhalitsyn wrote:
> > > On Tue, 30 Nov 2021 09:59:25 +0200
> > > Ido Schimmel <idosch@idosch.org> wrote:
> > > > Looking at the patch again, what is the motivation to expose
> > > > RTNH_REJECT_MASK to user space? iproute2 already knows that it only
> > > > makes sense to set RTNH_F_ONLINK. Can't we just do:
> > > 
> > > Sorry, but that's not fully clear for me, why we should exclude RTNH_F_ONLINK?
> > > I thought that we should exclude RTNH_F_DEAD and RTNH_F_LINKDOWN just because
> > > kernel doesn't allow to set these flags.
> > 
> > I don't think we should exclude RTNH_F_ONLINK. I'm saying that it is the
> > only flag that it makes sense to send to the kernel in the ancillary
> > header of RTM_NEWROUTE messages. The rest of the RNTH_F_* flags are
> > either not used by the kernel or are only meant to be sent from the
> > kernel to user space. Due to omission, they are mistakenly allowed.
> 
> Ah, okay, so, the patch should be like
> 
> diff --git a/ip/iproute.c b/ip/iproute.c
> index 1447a5f78f49..0e6dad2b67e5 100644
> --- a/ip/iproute.c
> +++ b/ip/iproute.c
> @@ -1632,6 +1632,8 @@ static int save_route(struct nlmsghdr *n, void *arg)
>         if (!filter_nlmsg(n, tb, host_len))
>                 return 0;
>  
> +       r->rtm_flags &= RTNH_F_ONLINK;
> +
>         ret = write(STDOUT_FILENO, n, n->nlmsg_len);
>         if ((ret > 0) && (ret != n->nlmsg_len)) {
>                 fprintf(stderr, "Short write while saving nlmsg\n");
> 
> to filter out all flags *except* RTNH_F_ONLINK.

Yes

> 
> But what about discussion from
> https://lore.kernel.org/netdev/ff405eae-21d9-35f4-1397-b6f9a29a57ff@nvidia.com/
> 
> As far as I understand Roopa, we have to save at least RTNH_F_OFFLOAD flag too,
> for instance, if user uses Cumulus and want to dump/restore routes.
> 
> I'm sorry if I misunderstood something.

Roopa, do you see a problem with the above patch?

  reply	other threads:[~2021-11-30 10:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 16:02 [RFC PATCH iproute2] ip route: save: exclude rtnh_flags which can't be set Alexander Mikhalitsyn
2021-11-11 16:02 ` [RFC PATCH net-next] rtnetlink: add RTNH_F_REJECT_MASK Alexander Mikhalitsyn
2021-11-11 17:48   ` Jakub Kicinski
2021-11-11 17:51     ` Alexander Mikhalitsyn
2021-11-11 17:56       ` Jakub Kicinski
2021-11-11 18:01         ` Alexander Mikhalitsyn
2021-11-11 19:13   ` David Ahern
2021-11-11 19:23     ` Alexander Mikhalitsyn
2021-11-11 22:19       ` David Ahern
2021-11-12  1:02         ` Roopa Prabhu
2021-11-12  2:27           ` David Ahern
2021-11-26 13:43 ` [PATCH iproute2] ip route: save: exclude rtnh_flags which can't be set Alexander Mikhalitsyn
2021-11-26 13:43   ` [PATCH net-next] rtnetlink: add RTNH_REJECT_MASK Alexander Mikhalitsyn
2021-11-28 14:01     ` Ido Schimmel
2021-11-29  0:19       ` David Ahern
2021-11-30  7:59         ` Ido Schimmel
2021-11-30  8:35           ` Alexander Mikhalitsyn
2021-11-30  9:28             ` Ido Schimmel
2021-11-30  9:53               ` Alexander Mikhalitsyn
2021-11-30 10:28                 ` Ido Schimmel [this message]
2021-11-30 15:12                   ` David Ahern
2021-11-30  8:18       ` Alexander Mikhalitsyn
2021-11-28 13:09   ` [PATCH iproute2] ip route: save: exclude rtnh_flags which can't be set Ido Schimmel

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=YaX8wa5R/r5sbca5@shredder \
    --to=idosch@idosch.org \
    --cc=alexander.mikhalitsyn@virtuozzo.com \
    --cc=alexander@mihalicyn.com \
    --cc=avagin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ptikhomirov@virtuozzo.com \
    --cc=roopa@nvidia.com \
    --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).