netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Yang Sun <sunytt@google.com>
Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	nicolas.dichtel@6wind.com
Subject: Re: [PATCH] net: ipmr_base: Check iif when returning a (*, G) MFC
Date: Thu, 2 Nov 2023 11:52:51 +0200	[thread overview]
Message-ID: <ZUNxcxMq8EW0cVUT@shredder> (raw)
In-Reply-To: <20231031015756.1843599-1-sunytt@google.com>

+ Nicolas

On Tue, Oct 31, 2023 at 09:57:56AM +0800, Yang Sun wrote:
> Looking for a (*, G) MFC returns the first match without checking
> the iif. This can return a MFC not intended for a packet's iif and
> forwarding the packet with this MFC will not work correctly.
> 
> When looking up for a (*, G) MFC, check that the MFC's iif is
> the same as the packet's iif.

Is this a regression (doesn't seem that way)? If not, the change should
be targeted at net-next which is closed right now:

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

> 
> Signed-off-by: Yang Sun <sunytt@google.com>
> ---
>  net/ipv4/ipmr_base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/ipmr_base.c b/net/ipv4/ipmr_base.c
> index 271dc03fc6db..5cf7c7088dfe 100644
> --- a/net/ipv4/ipmr_base.c
> +++ b/net/ipv4/ipmr_base.c
> @@ -97,7 +97,7 @@ void *mr_mfc_find_any(struct mr_table *mrt, int vifi, void *hasharg)
>  
>  	list = rhltable_lookup(&mrt->mfc_hash, hasharg, *mrt->ops.rht_params);
>  	rhl_for_each_entry_rcu(c, tmp, list, mnode) {
> -		if (c->mfc_un.res.ttls[vifi] < 255)
> +		if (c->mfc_parent == vifi && c->mfc_un.res.ttls[vifi] < 255)

What happens if the route doesn't have an iif (-1)? It won't match
anymore?

>  			return c;
>  
>  		/* It's ok if the vifi is part of the static tree */
> -- 
> 2.42.0.820.g83a721a137-goog
> 
> 

  reply	other threads:[~2023-11-02  9:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31  1:57 [PATCH] net: ipmr_base: Check iif when returning a (*, G) MFC Yang Sun
2023-11-02  9:52 ` Ido Schimmel [this message]
2023-11-02 11:52   ` Yang Sun
     [not found]   ` <CAF+qgb4gW8vBb8c2xDHfsXsm1-O2KCwXMCTUcT2mYqED51fHoQ@mail.gmail.com>
2023-11-02 14:19     ` Nicolas Dichtel
2023-11-03 11:05       ` Yang Sun
2023-11-03 14:21         ` Nicolas Dichtel

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=ZUNxcxMq8EW0cVUT@shredder \
    --to=idosch@idosch.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=pabeni@redhat.com \
    --cc=sunytt@google.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).