From: Yang Sun <sunytt@google.com>
To: davem@davemloft.net, dsahern@kernel.org
Cc: edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, Yang Sun <sunytt@google.com>
Subject: [PATCH] net: ipmr_base: Check iif when returning a (*, G) MFC
Date: Tue, 31 Oct 2023 09:57:56 +0800 [thread overview]
Message-ID: <20231031015756.1843599-1-sunytt@google.com> (raw)
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.
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)
return c;
/* It's ok if the vifi is part of the static tree */
--
2.42.0.820.g83a721a137-goog
next reply other threads:[~2023-10-31 1:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-31 1:57 Yang Sun [this message]
2023-11-02 9:52 ` [PATCH] net: ipmr_base: Check iif when returning a (*, G) MFC Ido Schimmel
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=20231031015756.1843599-1-sunytt@google.com \
--to=sunytt@google.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.