netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ipmr_base: Check iif when returning a (*, G) MFC
@ 2023-10-31  1:57 Yang Sun
  2023-11-02  9:52 ` Ido Schimmel
  0 siblings, 1 reply; 6+ messages in thread
From: Yang Sun @ 2023-10-31  1:57 UTC (permalink / raw)
  To: davem, dsahern; +Cc: edumazet, kuba, pabeni, netdev, Yang Sun

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-11-03 14:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).