From e3e532dd16a1a0a77b251d6e8e63ffa4bbd83be7 Mon Sep 17 00:00:00 2001 From: rgirada Date: Fri, 3 May 2019 10:35:48 -0700 Subject: [PATCH] Pimd : S,G Mroute entries are not expiring even after KAT expiry, become stale entries. Topology: -------- Source | FHR | RP ------ LHR --- Recv1 | Recv2 Root case : ----------- When RP acts as a LHR i.e RP has a local receiver and registed for the same group where LHR connected receiver also registered for the same multicast group.When RP receives a (s,g) join form LHR , it increments upstream ref count to two to track the Local membership as well.But at the time of KAT expiry in RP , upstream reference is not being removed Which is added to track local membership which is causing to make these entries as stale in RP and FHR. Fix : Made the change such that it removes the upstream reference if it is added to track the local memberships. Signed-off-by: Rajesh Girada --- pimd/pim_upstream.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index b708e86a20..d829d01347 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -1181,8 +1181,16 @@ struct pim_upstream *pim_upstream_keep_alive_timer_proc( "kat expired on %s[%s]; remove stream reference", up->sg_str, pim->vrf->name); PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(up->flags); - up = pim_upstream_del(pim, up, __PRETTY_FUNCTION__); - } else if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(up->flags)) { + + /* Return if upstream entry got deleted.*/ + if (!pim_upstream_del(pim, up, __PRETTY_FUNCTION__)) + return NULL; + } + /* upstream reference would have been added to track the local + * membership if it is LHR. We have to clear it when KAT expires. + * Otherwise would result in stale entry with uncleared ref count. + */ + if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(up->flags)) { struct pim_upstream *parent = up->parent; PIM_UPSTREAM_FLAG_UNSET_SRC_LHR(up->flags); -- 2.39.5