From 41a115e4f0eb9ff5847e4b7a268003fdbf321b88 Mon Sep 17 00:00:00 2001 From: Anuradha Karuppiah Date: Fri, 15 Nov 2019 12:22:27 -0800 Subject: [PATCH] pimd: fixup JD macro to use "peer-msdp-sa" check instead of I_am_RP check JD macro is defined by the RFC as - bool JoinDesired(S,G) { return (immediate_olist(S,G) != NULL OR (KeepaliveTimer(S,G) is running AND inherited_olist(S,G) != NULL)) } However for MSDP synced SA the KAT will not be running so an exception is needed. Earlier I had done this by relaxing KAT_run requirements entirely on the RP. However as that prevents the source from being aged out in some cases I have made the check more narrow i.e. has to an MSDP peer added entry. Ticket: CM-24398 Signed-off-by: Anuradha Karuppiah --- pimd/pim_msdp.c | 7 ++++++- pimd/pim_upstream.c | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 65bfebec3b..8a18594fd7 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -126,7 +126,12 @@ static void pim_msdp_sa_upstream_del(struct pim_msdp_sa *sa) if (PIM_UPSTREAM_FLAG_TEST_SRC_MSDP(up->flags)) { PIM_UPSTREAM_FLAG_UNSET_SRC_MSDP(up->flags); sa->flags |= PIM_MSDP_SAF_UP_DEL_IN_PROG; - pim_upstream_del(sa->pim, up, __PRETTY_FUNCTION__); + up = pim_upstream_del(sa->pim, up, __PRETTY_FUNCTION__); + /* re-eval joinDesired; clearing peer-msdp-sa flag can + * cause JD to change + */ + if (up) + pim_upstream_update_join_desired(sa->pim, up); sa->flags &= ~PIM_MSDP_SAF_UP_DEL_IN_PROG; } diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 411e767645..26cc68abf8 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -933,6 +933,15 @@ void pim_upstream_ref(struct pim_upstream *up, int flags, const char *name) pim_upstream_update_use_rpt(up, true /*update_mroute*/); } + /* re-eval joinDesired; clearing peer-msdp-sa flag can + * cause JD to change + */ + if (!PIM_UPSTREAM_FLAG_TEST_SRC_MSDP(up->flags) && + PIM_UPSTREAM_FLAG_TEST_SRC_MSDP(flags)) { + PIM_UPSTREAM_FLAG_SET_SRC_MSDP(up->flags); + pim_upstream_update_join_desired(up->pim, up); + } + up->flags |= flags; ++up->ref_count; if (PIM_DEBUG_PIM_TRACE) @@ -1073,6 +1082,12 @@ static bool pim_upstream_empty_immediate_olist(struct pim_instance *pim, return true; } + +static inline bool pim_upstream_is_msdp_peer_sa(struct pim_upstream *up) +{ + return PIM_UPSTREAM_FLAG_TEST_SRC_MSDP(up->flags); +} + /* * bool JoinDesired(*,G) { * if (immediate_olist(*,G) != NULL) @@ -1105,7 +1120,7 @@ int pim_upstream_evaluate_join_desired(struct pim_instance *pim, empty_inh_oil = pim_upstream_empty_inherited_olist(up); if (!empty_inh_oil && (pim_upstream_is_kat_running(up) || - I_am_RP(pim, up->sg.grp))) + pim_upstream_is_msdp_peer_sa(up))) return true; return false;