[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231031015756.1843599-1-sunytt@google.com>
Date: Tue, 31 Oct 2023 09:57:56 +0800
From: Yang Sun <sunytt@...gle.com>
To: davem@...emloft.net, dsahern@...nel.org
Cc: edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, Yang Sun <sunytt@...gle.com>
Subject: [PATCH] net: ipmr_base: Check iif when returning a (*, G) MFC
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@...gle.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
Powered by blists - more mailing lists